v0.2.1 c0399be

gtkeventcontrollerfocus.go RawHistoryFolder

1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5	"structs"
6	"unsafe"
7
8	"github.com/ebitengine/purego"
9
10	"github.com/bnema/puregotk/pkg/core"
11	"github.com/bnema/puregotk/v4/glib"
12	"github.com/bnema/puregotk/v4/gobject"
13	"github.com/bnema/puregotk/v4/gobject/types"
14)
15
16type EventControllerFocusClass struct {
17	_ structs.HostLayout
18}
19
20func (x *EventControllerFocusClass) GoPointer() uintptr {
21	return uintptr(unsafe.Pointer(x))
22}
23
24// Tracks keyboard focus.
25//
26// The event controller offers [signal@Gtk.EventControllerFocus::enter]
27// and [signal@Gtk.EventControllerFocus::leave] signals, as well as
28// [property@Gtk.EventControllerFocus:is-focus] and
29// [property@Gtk.EventControllerFocus:contains-focus] properties
30// which are updated to reflect focus changes inside the widget hierarchy
31// that is rooted at the controllers widget.
32type EventControllerFocus struct {
33	EventController
34}
35
36var xEventControllerFocusGLibType func() types.GType
37
38func EventControllerFocusGLibType() types.GType {
39	return xEventControllerFocusGLibType()
40}
41
42func EventControllerFocusNewFromInternalPtr(ptr uintptr) *EventControllerFocus {
43	cls := &EventControllerFocus{}
44	cls.Ptr = ptr
45	return cls
46}
47
48var xNewEventControllerFocus func() uintptr
49
50// Creates a new event controller that will handle focus events.
51func NewEventControllerFocus() *EventControllerFocus {
52	var cls *EventControllerFocus
53
54	cret := xNewEventControllerFocus()
55
56	if cret == 0 {
57		return nil
58	}
59	cls = &EventControllerFocus{}
60	cls.Ptr = cret
61	return cls
62}
63
64var xEventControllerFocusContainsFocus func(uintptr) bool
65
66// Returns %TRUE if focus is within @self or one of its children.
67func (x *EventControllerFocus) ContainsFocus() bool {
68
69	cret := xEventControllerFocusContainsFocus(x.GoPointer())
70	return cret
71}
72
73var xEventControllerFocusIsFocus func(uintptr) bool
74
75// Returns %TRUE if focus is within @self, but not one of its children.
76func (x *EventControllerFocus) IsFocus() bool {
77
78	cret := xEventControllerFocusIsFocus(x.GoPointer())
79	return cret
80}
81
82func (c *EventControllerFocus) GoPointer() uintptr {
83	if c == nil {
84		return 0
85	}
86	return c.Ptr
87}
88
89func (c *EventControllerFocus) SetGoPointer(ptr uintptr) {
90	c.Ptr = ptr
91}
92
93// GetPropertyContainsFocus gets the "contains-focus" property.
94// %TRUE if focus is contained in the controllers widget.
95//
96// See [property@Gtk.EventControllerFocus:is-focus] for whether
97// the focus is in the widget itself or inside a descendent.
98//
99// When handling focus events, this property is updated
100// before [signal@Gtk.EventControllerFocus::enter] or
101// [signal@Gtk.EventControllerFocus::leave] are emitted.
102func (x *EventControllerFocus) GetPropertyContainsFocus() bool {
103	var v gobject.Value
104	x.GetProperty("contains-focus", &v)
105	return v.GetBoolean()
106}
107
108// GetPropertyIsFocus gets the "is-focus" property.
109// %TRUE if focus is in the controllers widget itself,
110// as opposed to in a descendent widget.
111//
112// See also [property@Gtk.EventControllerFocus:contains-focus].
113//
114// When handling focus events, this property is updated
115// before [signal@Gtk.EventControllerFocus::enter] or
116// [signal@Gtk.EventControllerFocus::leave] are emitted.
117func (x *EventControllerFocus) GetPropertyIsFocus() bool {
118	var v gobject.Value
119	x.GetProperty("is-focus", &v)
120	return v.GetBoolean()
121}
122
123// Emitted whenever the focus enters into the widget or one
124// of its descendents.
125//
126// Note that this means you may not get an ::enter signal
127// even though the widget becomes the focus location, in
128// certain cases (such as when the focus moves from a descendent
129// of the widget to the widget itself). If you are interested
130// in these cases, you can monitor the
131// [property@Gtk.EventControllerFocus:is-focus]
132// property for changes.
133func (x *EventControllerFocus) ConnectEnter(cb *func(EventControllerFocus)) uint {
134	cbPtr := uintptr(unsafe.Pointer(cb))
135	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
136		handlerID := gobject.SignalConnect(x.GoPointer(), "enter", cbRefPtr)
137		glib.SaveHandlerMapping(handlerID, cbPtr)
138		return handlerID
139	}
140
141	fcb := func(clsPtr uintptr) {
142		fa := EventControllerFocus{}
143		fa.Ptr = clsPtr
144		cbFn := *cb
145
146		cbFn(fa)
147
148	}
149	cbRefPtr := purego.NewCallback(fcb)
150	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
151	handlerID := gobject.SignalConnect(x.GoPointer(), "enter", cbRefPtr)
152	glib.SaveHandlerMapping(handlerID, cbPtr)
153	return handlerID
154}
155
156// Emitted whenever the focus leaves the widget hierarchy
157// that is rooted at the widget that the controller is attached to.
158//
159// Note that this means you may not get a ::leave signal
160// even though the focus moves away from the widget, in
161// certain cases (such as when the focus moves from the widget
162// to a descendent). If you are interested in these cases, you
163// can monitor the [property@Gtk.EventControllerFocus:is-focus]
164// property for changes.
165func (x *EventControllerFocus) ConnectLeave(cb *func(EventControllerFocus)) uint {
166	cbPtr := uintptr(unsafe.Pointer(cb))
167	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
168		handlerID := gobject.SignalConnect(x.GoPointer(), "leave", cbRefPtr)
169		glib.SaveHandlerMapping(handlerID, cbPtr)
170		return handlerID
171	}
172
173	fcb := func(clsPtr uintptr) {
174		fa := EventControllerFocus{}
175		fa.Ptr = clsPtr
176		cbFn := *cb
177
178		cbFn(fa)
179
180	}
181	cbRefPtr := purego.NewCallback(fcb)
182	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
183	handlerID := gobject.SignalConnect(x.GoPointer(), "leave", cbRefPtr)
184	glib.SaveHandlerMapping(handlerID, cbPtr)
185	return handlerID
186}
187
188func init() {
189	core.SetPackageName("GTK", "gtk4")
190	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
191	var libs []uintptr
192	for _, libPath := range core.GetPaths("GTK") {
193		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
194		if err != nil {
195			panic(err)
196		}
197		libs = append(libs, lib)
198	}
199
200	core.PuregoSafeRegister(&xEventControllerFocusGLibType, libs, "gtk_event_controller_focus_get_type")
201
202	core.PuregoSafeRegister(&xNewEventControllerFocus, libs, "gtk_event_controller_focus_new")
203
204	core.PuregoSafeRegister(&xEventControllerFocusContainsFocus, libs, "gtk_event_controller_focus_contains_focus")
205	core.PuregoSafeRegister(&xEventControllerFocusIsFocus, libs, "gtk_event_controller_focus_is_focus")
206
207}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close