v0.2.1 c0399be

gtkfilter.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 FilterClass struct {
17	_ structs.HostLayout
18
19	ParentClass gobject.ObjectClass
20
21	xMatch uintptr
22
23	xGetStrictness uintptr
24
25	xGtkReserved1 uintptr
26
27	xGtkReserved2 uintptr
28
29	xGtkReserved3 uintptr
30
31	xGtkReserved4 uintptr
32
33	xGtkReserved5 uintptr
34
35	xGtkReserved6 uintptr
36
37	xGtkReserved7 uintptr
38
39	xGtkReserved8 uintptr
40}
41
42func (x *FilterClass) GoPointer() uintptr {
43	return uintptr(unsafe.Pointer(x))
44}
45
46// OverrideMatch sets the "match" callback function.
47func (x *FilterClass) OverrideMatch(cb func(*Filter, *gobject.Object) bool) {
48	if cb == nil {
49		x.xMatch = 0
50	} else {
51		x.xMatch = purego.NewCallback(func(SelfVarp uintptr, ItemVarp uintptr) bool {
52			return cb(FilterNewFromInternalPtr(SelfVarp), gobject.ObjectNewFromInternalPtr(ItemVarp))
53		})
54	}
55}
56
57// GetMatch gets the "match" callback function.
58func (x *FilterClass) GetMatch() func(*Filter, *gobject.Object) bool {
59	if x.xMatch == 0 {
60		return nil
61	}
62	var rawCallback func(SelfVarp uintptr, ItemVarp uintptr) bool
63	purego.RegisterFunc(&rawCallback, x.xMatch)
64	return func(SelfVar *Filter, ItemVar *gobject.Object) bool {
65		return rawCallback(SelfVar.GoPointer(), ItemVar.GoPointer())
66	}
67}
68
69// OverrideGetStrictness sets the "get_strictness" callback function.
70func (x *FilterClass) OverrideGetStrictness(cb func(*Filter) FilterMatch) {
71	if cb == nil {
72		x.xGetStrictness = 0
73	} else {
74		x.xGetStrictness = purego.NewCallback(func(SelfVarp uintptr) FilterMatch {
75			return cb(FilterNewFromInternalPtr(SelfVarp))
76		})
77	}
78}
79
80// GetGetStrictness gets the "get_strictness" callback function.
81func (x *FilterClass) GetGetStrictness() func(*Filter) FilterMatch {
82	if x.xGetStrictness == 0 {
83		return nil
84	}
85	var rawCallback func(SelfVarp uintptr) FilterMatch
86	purego.RegisterFunc(&rawCallback, x.xGetStrictness)
87	return func(SelfVar *Filter) FilterMatch {
88		return rawCallback(SelfVar.GoPointer())
89	}
90}
91
92// OverrideGtkReserved1 sets the "_gtk_reserved1" callback function.
93func (x *FilterClass) OverrideGtkReserved1(cb func()) {
94	if cb == nil {
95		x.xGtkReserved1 = 0
96	} else {
97		x.xGtkReserved1 = purego.NewCallback(func() {
98			cb()
99		})
100	}
101}
102
103// GetGtkReserved1 gets the "_gtk_reserved1" callback function.
104func (x *FilterClass) GetGtkReserved1() func() {
105	if x.xGtkReserved1 == 0 {
106		return nil
107	}
108	var rawCallback func()
109	purego.RegisterFunc(&rawCallback, x.xGtkReserved1)
110	return func() {
111		rawCallback()
112	}
113}
114
115// OverrideGtkReserved2 sets the "_gtk_reserved2" callback function.
116func (x *FilterClass) OverrideGtkReserved2(cb func()) {
117	if cb == nil {
118		x.xGtkReserved2 = 0
119	} else {
120		x.xGtkReserved2 = purego.NewCallback(func() {
121			cb()
122		})
123	}
124}
125
126// GetGtkReserved2 gets the "_gtk_reserved2" callback function.
127func (x *FilterClass) GetGtkReserved2() func() {
128	if x.xGtkReserved2 == 0 {
129		return nil
130	}
131	var rawCallback func()
132	purego.RegisterFunc(&rawCallback, x.xGtkReserved2)
133	return func() {
134		rawCallback()
135	}
136}
137
138// OverrideGtkReserved3 sets the "_gtk_reserved3" callback function.
139func (x *FilterClass) OverrideGtkReserved3(cb func()) {
140	if cb == nil {
141		x.xGtkReserved3 = 0
142	} else {
143		x.xGtkReserved3 = purego.NewCallback(func() {
144			cb()
145		})
146	}
147}
148
149// GetGtkReserved3 gets the "_gtk_reserved3" callback function.
150func (x *FilterClass) GetGtkReserved3() func() {
151	if x.xGtkReserved3 == 0 {
152		return nil
153	}
154	var rawCallback func()
155	purego.RegisterFunc(&rawCallback, x.xGtkReserved3)
156	return func() {
157		rawCallback()
158	}
159}
160
161// OverrideGtkReserved4 sets the "_gtk_reserved4" callback function.
162func (x *FilterClass) OverrideGtkReserved4(cb func()) {
163	if cb == nil {
164		x.xGtkReserved4 = 0
165	} else {
166		x.xGtkReserved4 = purego.NewCallback(func() {
167			cb()
168		})
169	}
170}
171
172// GetGtkReserved4 gets the "_gtk_reserved4" callback function.
173func (x *FilterClass) GetGtkReserved4() func() {
174	if x.xGtkReserved4 == 0 {
175		return nil
176	}
177	var rawCallback func()
178	purego.RegisterFunc(&rawCallback, x.xGtkReserved4)
179	return func() {
180		rawCallback()
181	}
182}
183
184// OverrideGtkReserved5 sets the "_gtk_reserved5" callback function.
185func (x *FilterClass) OverrideGtkReserved5(cb func()) {
186	if cb == nil {
187		x.xGtkReserved5 = 0
188	} else {
189		x.xGtkReserved5 = purego.NewCallback(func() {
190			cb()
191		})
192	}
193}
194
195// GetGtkReserved5 gets the "_gtk_reserved5" callback function.
196func (x *FilterClass) GetGtkReserved5() func() {
197	if x.xGtkReserved5 == 0 {
198		return nil
199	}
200	var rawCallback func()
201	purego.RegisterFunc(&rawCallback, x.xGtkReserved5)
202	return func() {
203		rawCallback()
204	}
205}
206
207// OverrideGtkReserved6 sets the "_gtk_reserved6" callback function.
208func (x *FilterClass) OverrideGtkReserved6(cb func()) {
209	if cb == nil {
210		x.xGtkReserved6 = 0
211	} else {
212		x.xGtkReserved6 = purego.NewCallback(func() {
213			cb()
214		})
215	}
216}
217
218// GetGtkReserved6 gets the "_gtk_reserved6" callback function.
219func (x *FilterClass) GetGtkReserved6() func() {
220	if x.xGtkReserved6 == 0 {
221		return nil
222	}
223	var rawCallback func()
224	purego.RegisterFunc(&rawCallback, x.xGtkReserved6)
225	return func() {
226		rawCallback()
227	}
228}
229
230// OverrideGtkReserved7 sets the "_gtk_reserved7" callback function.
231func (x *FilterClass) OverrideGtkReserved7(cb func()) {
232	if cb == nil {
233		x.xGtkReserved7 = 0
234	} else {
235		x.xGtkReserved7 = purego.NewCallback(func() {
236			cb()
237		})
238	}
239}
240
241// GetGtkReserved7 gets the "_gtk_reserved7" callback function.
242func (x *FilterClass) GetGtkReserved7() func() {
243	if x.xGtkReserved7 == 0 {
244		return nil
245	}
246	var rawCallback func()
247	purego.RegisterFunc(&rawCallback, x.xGtkReserved7)
248	return func() {
249		rawCallback()
250	}
251}
252
253// OverrideGtkReserved8 sets the "_gtk_reserved8" callback function.
254func (x *FilterClass) OverrideGtkReserved8(cb func()) {
255	if cb == nil {
256		x.xGtkReserved8 = 0
257	} else {
258		x.xGtkReserved8 = purego.NewCallback(func() {
259			cb()
260		})
261	}
262}
263
264// GetGtkReserved8 gets the "_gtk_reserved8" callback function.
265func (x *FilterClass) GetGtkReserved8() func() {
266	if x.xGtkReserved8 == 0 {
267		return nil
268	}
269	var rawCallback func()
270	purego.RegisterFunc(&rawCallback, x.xGtkReserved8)
271	return func() {
272		rawCallback()
273	}
274}
275
276// Describes changes in a filter in more detail and allows objects
277// using the filter to optimize refiltering items.
278//
279// If you are writing an implementation and are not sure which
280// value to pass, `GTK_FILTER_CHANGE_DIFFERENT` is always a correct
281// choice.
282//
283// New values may be added in the future.
284type FilterChange int
285
286var xFilterChangeGLibType func() types.GType
287
288func FilterChangeGLibType() types.GType {
289	return xFilterChangeGLibType()
290}
291
292const (
293
294	// The filter change cannot be
295	//   described with any of the other enumeration values
296	FilterChangeDifferentValue FilterChange = 0
297	// The filter is less strict than
298	//   it was before: All items that it used to return true
299	//   still return true, others now may, too.
300	FilterChangeLessStrictValue FilterChange = 1
301	// The filter is more strict than
302	//   it was before: All items that it used to return false
303	//   still return false, others now may, too.
304	FilterChangeMoreStrictValue FilterChange = 2
305	// Similar to [enum@Gtk.FilterChange.DIFFERENT],
306	// but signs that item watches should be recreated. This is used by
307	// [class@Gtk.FilterListModel] to keep the list up-to-date when items
308	// change.
309	FilterChangeDifferentRewatchValue FilterChange = 3
310	// Similar to [enum@Gtk.FilterChange.LESS_STRICT],
311	// but signs that item watches should be recreated. This is used by
312	// [class@Gtk.FilterListModel] to keep the list up-to-date when items
313	// change.
314	FilterChangeLessStrictRewatchValue FilterChange = 4
315	// Similar to [enum@Gtk.FilterChange.MORE_STRICT],
316	// but signs that item watches should be recreated. This is used by
317	// [class@Gtk.FilterListModel] to keep the list up-to-date when items
318	// change.
319	FilterChangeMoreStrictRewatchValue FilterChange = 5
320)
321
322// Describes the known strictness of a filter.
323//
324// Note that for filters where the strictness is not known,
325// `GTK_FILTER_MATCH_SOME` is always an acceptable value,
326// even if a filter does match all or no items.
327type FilterMatch int
328
329var xFilterMatchGLibType func() types.GType
330
331func FilterMatchGLibType() types.GType {
332	return xFilterMatchGLibType()
333}
334
335const (
336
337	// The filter matches some items,
338	//   [method@Gtk.Filter.match] may return true or false
339	FilterMatchSomeValue FilterMatch = 0
340	// The filter does not match any item,
341	//   [method@Gtk.Filter.match] will always return false
342	FilterMatchNoneValue FilterMatch = 1
343	// The filter matches all items,
344	//   [method@Gtk.Filter.match] will alays return true
345	FilterMatchAllValue FilterMatch = 2
346)
347
348// Describes the filtering to be performed by a [class@Gtk.FilterListModel].
349//
350// The model will use the filter to determine if it should include items
351// or not by calling [method@Gtk.Filter.match] for each item and only
352// keeping the ones that the function returns true for.
353//
354// Filters may change what items they match through their lifetime. In that
355// case, they will emit the [signal@Gtk.Filter::changed] signal to notify
356// that previous filter results are no longer valid and that items should
357// be checked again via [method@Gtk.Filter.match].
358//
359// GTK provides various pre-made filter implementations for common filtering
360// operations. These filters often include properties that can be linked to
361// various widgets to easily allow searches.
362//
363// However, in particular for large lists or complex search methods, it is
364// also possible to subclass `GtkFilter` and provide one's own filter.
365type Filter struct {
366	gobject.Object
367}
368
369var xFilterGLibType func() types.GType
370
371func FilterGLibType() types.GType {
372	return xFilterGLibType()
373}
374
375func FilterNewFromInternalPtr(ptr uintptr) *Filter {
376	cls := &Filter{}
377	cls.Ptr = ptr
378	return cls
379}
380
381var xFilterChanged func(uintptr, FilterChange)
382
383// Notifies all users of the filter that it has changed.
384//
385// This emits the [signal@Gtk.Filter::changed] signal. Users
386// of the filter should then check items again via
387// [method@Gtk.Filter.match].
388//
389// Depending on the @change parameter, not all items need to
390// be changed, but only some. Refer to the [enum@Gtk.FilterChange]
391// documentation for details.
392//
393// This function is intended for implementers of `GtkFilter`
394// subclasses and should not be called from other functions.
395func (x *Filter) Changed(ChangeVar FilterChange) {
396
397	xFilterChanged(x.GoPointer(), ChangeVar)
398
399}
400
401var xFilterGetStrictness func(uintptr) FilterMatch
402
403// Gets the known strictness of a filter.
404//
405// If the strictness is not known, [enum@Gtk.FilterMatch.some] is returned.
406//
407// This value may change after emission of the [signal@Gtk.Filter::changed]
408// signal.
409//
410// This function is meant purely for optimization purposes. Filters can
411// choose to omit implementing it, but `GtkFilterListModel` uses it.
412func (x *Filter) GetStrictness() FilterMatch {
413
414	cret := xFilterGetStrictness(x.GoPointer())
415	return cret
416}
417
418var xFilterMatch func(uintptr, uintptr) bool
419
420// Checks if the given @item is matched by the filter or not.
421func (x *Filter) Match(ItemVar *gobject.Object) bool {
422
423	cret := xFilterMatch(x.GoPointer(), ItemVar.GoPointer())
424	return cret
425}
426
427func (c *Filter) GoPointer() uintptr {
428	if c == nil {
429		return 0
430	}
431	return c.Ptr
432}
433
434func (c *Filter) SetGoPointer(ptr uintptr) {
435	c.Ptr = ptr
436}
437
438// Emitted whenever the filter changed.
439//
440// Users of the filter should then check items again via
441// [method@Gtk.Filter.match].
442//
443// `GtkFilterListModel` handles this signal automatically.
444//
445// Depending on the @change parameter, not all items need
446// to be checked, but only some. Refer to the [enum@Gtk.FilterChange]
447// documentation for details.
448func (x *Filter) ConnectChanged(cb *func(Filter, FilterChange)) uint {
449	cbPtr := uintptr(unsafe.Pointer(cb))
450	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
451		handlerID := gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr)
452		glib.SaveHandlerMapping(handlerID, cbPtr)
453		return handlerID
454	}
455
456	fcb := func(clsPtr uintptr, ChangeVarp FilterChange) {
457		fa := Filter{}
458		fa.Ptr = clsPtr
459		cbFn := *cb
460
461		cbFn(fa, ChangeVarp)
462
463	}
464	cbRefPtr := purego.NewCallback(fcb)
465	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
466	handlerID := gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr)
467	glib.SaveHandlerMapping(handlerID, cbPtr)
468	return handlerID
469}
470
471func init() {
472	core.SetPackageName("GTK", "gtk4")
473	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
474	var libs []uintptr
475	for _, libPath := range core.GetPaths("GTK") {
476		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
477		if err != nil {
478			panic(err)
479		}
480		libs = append(libs, lib)
481	}
482
483	core.PuregoSafeRegister(&xFilterChangeGLibType, libs, "gtk_filter_change_get_type")
484
485	core.PuregoSafeRegister(&xFilterMatchGLibType, libs, "gtk_filter_match_get_type")
486
487	core.PuregoSafeRegister(&xFilterGLibType, libs, "gtk_filter_get_type")
488
489	core.PuregoSafeRegister(&xFilterChanged, libs, "gtk_filter_changed")
490	core.PuregoSafeRegister(&xFilterGetStrictness, libs, "gtk_filter_get_strictness")
491	core.PuregoSafeRegister(&xFilterMatch, libs, "gtk_filter_match")
492
493}

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