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/gio"
12 "github.com/bnema/puregotk/v4/gobject"
13 "github.com/bnema/puregotk/v4/gobject/types"
14)
15
16type AnyFilterClass struct {
17 _ structs.HostLayout
18}
19
20func (x *AnyFilterClass) GoPointer() uintptr {
21 return uintptr(unsafe.Pointer(x))
22}
23
24type EveryFilterClass struct {
25 _ structs.HostLayout
26}
27
28func (x *EveryFilterClass) GoPointer() uintptr {
29 return uintptr(unsafe.Pointer(x))
30}
31
32type MultiFilterClass struct {
33 _ structs.HostLayout
34}
35
36func (x *MultiFilterClass) GoPointer() uintptr {
37 return uintptr(unsafe.Pointer(x))
38}
39
40// Matches an item when at least one of its filters matches.
41//
42// To add filters to a `GtkAnyFilter`, use [method@Gtk.MultiFilter.append].
43type AnyFilter struct {
44 MultiFilter
45}
46
47var xAnyFilterGLibType func() types.GType
48
49func AnyFilterGLibType() types.GType {
50 return xAnyFilterGLibType()
51}
52
53func AnyFilterNewFromInternalPtr(ptr uintptr) *AnyFilter {
54 cls := &AnyFilter{}
55 cls.Ptr = ptr
56 return cls
57}
58
59var xNewAnyFilter func() uintptr
60
61// Creates a new empty "any" filter.
62//
63// Use [method@Gtk.MultiFilter.append] to add filters to it.
64//
65// This filter matches an item if any of the filters added to it
66// matches the item. In particular, this means that if no filter
67// has been added to it, the filter matches no item.
68func NewAnyFilter() *AnyFilter {
69 var cls *AnyFilter
70
71 cret := xNewAnyFilter()
72
73 if cret == 0 {
74 return nil
75 }
76 cls = &AnyFilter{}
77 cls.Ptr = cret
78 return cls
79}
80
81func (c *AnyFilter) GoPointer() uintptr {
82 if c == nil {
83 return 0
84 }
85 return c.Ptr
86}
87
88func (c *AnyFilter) SetGoPointer(ptr uintptr) {
89 c.Ptr = ptr
90}
91
92// Get the item at @position.
93//
94// If @position is greater than the number of items in @list, %NULL is
95// returned.
96//
97// %NULL is never returned for an index that is smaller than the length
98// of the list.
99//
100// See also: g_list_model_get_n_items()
101func (x *AnyFilter) GetItem(PositionVar uint) uintptr {
102
103 cret := gio.XGListModelGetItem(x.GoPointer(), PositionVar)
104 return cret
105}
106
107// Gets the type of the items in @list.
108//
109// All items returned from g_list_model_get_item() are of the type
110// returned by this function, or a subtype, or if the type is an
111// interface, they are an implementation of that interface.
112//
113// The item type of a #GListModel can not change during the life of the
114// model.
115func (x *AnyFilter) GetItemType() types.GType {
116
117 cret := gio.XGListModelGetItemType(x.GoPointer())
118 return cret
119}
120
121// Gets the number of items in @list.
122//
123// Depending on the model implementation, calling this function may be
124// less efficient than iterating the list with increasing values for
125// @position until g_list_model_get_item() returns %NULL.
126func (x *AnyFilter) GetNItems() uint {
127
128 cret := gio.XGListModelGetNItems(x.GoPointer())
129 return cret
130}
131
132// Get the item at @position.
133//
134// If @position is greater than the number of items in @list, %NULL is
135// returned.
136//
137// %NULL is never returned for an index that is smaller than the length
138// of the list.
139//
140// This function is meant to be used by language bindings in place
141// of g_list_model_get_item().
142//
143// See also: g_list_model_get_n_items()
144func (x *AnyFilter) GetObject(PositionVar uint) *gobject.Object {
145 var cls *gobject.Object
146
147 cret := gio.XGListModelGetObject(x.GoPointer(), PositionVar)
148
149 if cret == 0 {
150 return nil
151 }
152 cls = &gobject.Object{}
153 cls.Ptr = cret
154 return cls
155}
156
157// Emits the #GListModel::items-changed signal on @list.
158//
159// This function should only be called by classes implementing
160// #GListModel. It has to be called after the internal representation
161// of @list has been updated, because handlers connected to this signal
162// might query the new state of the list.
163//
164// Implementations must only make changes to the model (as visible to
165// its consumer) in places that will not cause problems for that
166// consumer. For models that are driven directly by a write API (such
167// as #GListStore), changes can be reported in response to uses of that
168// API. For models that represent remote data, changes should only be
169// made from a fresh mainloop dispatch. It is particularly not
170// permitted to make changes in response to a call to the #GListModel
171// consumer API.
172//
173// Stated another way: in general, it is assumed that code making a
174// series of accesses to the model via the API, without returning to the
175// mainloop, and without calling other code, will continue to view the
176// same contents of the model.
177func (x *AnyFilter) ItemsChanged(PositionVar uint, RemovedVar uint, AddedVar uint) {
178
179 gio.XGListModelItemsChanged(x.GoPointer(), PositionVar, RemovedVar, AddedVar)
180
181}
182
183// Gets the ID of the @buildable object.
184//
185// `GtkBuilder` sets the name based on the ID attribute
186// of the `<object>` tag used to construct the @buildable.
187func (x *AnyFilter) GetBuildableId() string {
188
189 cret := XGtkBuildableGetBuildableId(x.GoPointer())
190 return cret
191}
192
193// Matches an item when each of its filters matches.
194//
195// To add filters to a `GtkEveryFilter`, use [method@Gtk.MultiFilter.append].
196type EveryFilter struct {
197 MultiFilter
198}
199
200var xEveryFilterGLibType func() types.GType
201
202func EveryFilterGLibType() types.GType {
203 return xEveryFilterGLibType()
204}
205
206func EveryFilterNewFromInternalPtr(ptr uintptr) *EveryFilter {
207 cls := &EveryFilter{}
208 cls.Ptr = ptr
209 return cls
210}
211
212var xNewEveryFilter func() uintptr
213
214// Creates a new empty "every" filter.
215//
216// Use [method@Gtk.MultiFilter.append] to add filters to it.
217//
218// This filter matches an item if each of the filters added to it
219// matches the item. In particular, this means that if no filter
220// has been added to it, the filter matches every item.
221func NewEveryFilter() *EveryFilter {
222 var cls *EveryFilter
223
224 cret := xNewEveryFilter()
225
226 if cret == 0 {
227 return nil
228 }
229 cls = &EveryFilter{}
230 cls.Ptr = cret
231 return cls
232}
233
234func (c *EveryFilter) GoPointer() uintptr {
235 if c == nil {
236 return 0
237 }
238 return c.Ptr
239}
240
241func (c *EveryFilter) SetGoPointer(ptr uintptr) {
242 c.Ptr = ptr
243}
244
245// Get the item at @position.
246//
247// If @position is greater than the number of items in @list, %NULL is
248// returned.
249//
250// %NULL is never returned for an index that is smaller than the length
251// of the list.
252//
253// See also: g_list_model_get_n_items()
254func (x *EveryFilter) GetItem(PositionVar uint) uintptr {
255
256 cret := gio.XGListModelGetItem(x.GoPointer(), PositionVar)
257 return cret
258}
259
260// Gets the type of the items in @list.
261//
262// All items returned from g_list_model_get_item() are of the type
263// returned by this function, or a subtype, or if the type is an
264// interface, they are an implementation of that interface.
265//
266// The item type of a #GListModel can not change during the life of the
267// model.
268func (x *EveryFilter) GetItemType() types.GType {
269
270 cret := gio.XGListModelGetItemType(x.GoPointer())
271 return cret
272}
273
274// Gets the number of items in @list.
275//
276// Depending on the model implementation, calling this function may be
277// less efficient than iterating the list with increasing values for
278// @position until g_list_model_get_item() returns %NULL.
279func (x *EveryFilter) GetNItems() uint {
280
281 cret := gio.XGListModelGetNItems(x.GoPointer())
282 return cret
283}
284
285// Get the item at @position.
286//
287// If @position is greater than the number of items in @list, %NULL is
288// returned.
289//
290// %NULL is never returned for an index that is smaller than the length
291// of the list.
292//
293// This function is meant to be used by language bindings in place
294// of g_list_model_get_item().
295//
296// See also: g_list_model_get_n_items()
297func (x *EveryFilter) GetObject(PositionVar uint) *gobject.Object {
298 var cls *gobject.Object
299
300 cret := gio.XGListModelGetObject(x.GoPointer(), PositionVar)
301
302 if cret == 0 {
303 return nil
304 }
305 cls = &gobject.Object{}
306 cls.Ptr = cret
307 return cls
308}
309
310// Emits the #GListModel::items-changed signal on @list.
311//
312// This function should only be called by classes implementing
313// #GListModel. It has to be called after the internal representation
314// of @list has been updated, because handlers connected to this signal
315// might query the new state of the list.
316//
317// Implementations must only make changes to the model (as visible to
318// its consumer) in places that will not cause problems for that
319// consumer. For models that are driven directly by a write API (such
320// as #GListStore), changes can be reported in response to uses of that
321// API. For models that represent remote data, changes should only be
322// made from a fresh mainloop dispatch. It is particularly not
323// permitted to make changes in response to a call to the #GListModel
324// consumer API.
325//
326// Stated another way: in general, it is assumed that code making a
327// series of accesses to the model via the API, without returning to the
328// mainloop, and without calling other code, will continue to view the
329// same contents of the model.
330func (x *EveryFilter) ItemsChanged(PositionVar uint, RemovedVar uint, AddedVar uint) {
331
332 gio.XGListModelItemsChanged(x.GoPointer(), PositionVar, RemovedVar, AddedVar)
333
334}
335
336// Gets the ID of the @buildable object.
337//
338// `GtkBuilder` sets the name based on the ID attribute
339// of the `<object>` tag used to construct the @buildable.
340func (x *EveryFilter) GetBuildableId() string {
341
342 cret := XGtkBuildableGetBuildableId(x.GoPointer())
343 return cret
344}
345
346// Base class for filters that combine multiple filters.
347type MultiFilter struct {
348 Filter
349}
350
351var xMultiFilterGLibType func() types.GType
352
353func MultiFilterGLibType() types.GType {
354 return xMultiFilterGLibType()
355}
356
357func MultiFilterNewFromInternalPtr(ptr uintptr) *MultiFilter {
358 cls := &MultiFilter{}
359 cls.Ptr = ptr
360 return cls
361}
362
363var xMultiFilterAppend func(uintptr, uintptr)
364
365// Adds a filter.
366func (x *MultiFilter) Append(FilterVar *Filter) {
367
368 xMultiFilterAppend(x.GoPointer(), FilterVar.GoPointer())
369
370}
371
372var xMultiFilterRemove func(uintptr, uint)
373
374// Removes a filter.
375//
376// If @position is larger than the number of filters,
377// nothing happens.
378func (x *MultiFilter) Remove(PositionVar uint) {
379
380 xMultiFilterRemove(x.GoPointer(), PositionVar)
381
382}
383
384func (c *MultiFilter) GoPointer() uintptr {
385 if c == nil {
386 return 0
387 }
388 return c.Ptr
389}
390
391func (c *MultiFilter) SetGoPointer(ptr uintptr) {
392 c.Ptr = ptr
393}
394
395// GetPropertyNItems gets the "n-items" property.
396// The number of items.
397//
398// See [method@Gio.ListModel.get_n_items].
399func (x *MultiFilter) GetPropertyNItems() uint {
400 var v gobject.Value
401 x.GetProperty("n-items", &v)
402 return v.GetUint()
403}
404
405// Get the item at @position.
406//
407// If @position is greater than the number of items in @list, %NULL is
408// returned.
409//
410// %NULL is never returned for an index that is smaller than the length
411// of the list.
412//
413// See also: g_list_model_get_n_items()
414func (x *MultiFilter) GetItem(PositionVar uint) uintptr {
415
416 cret := gio.XGListModelGetItem(x.GoPointer(), PositionVar)
417 return cret
418}
419
420// Gets the type of the items in @list.
421//
422// All items returned from g_list_model_get_item() are of the type
423// returned by this function, or a subtype, or if the type is an
424// interface, they are an implementation of that interface.
425//
426// The item type of a #GListModel can not change during the life of the
427// model.
428func (x *MultiFilter) GetItemType() types.GType {
429
430 cret := gio.XGListModelGetItemType(x.GoPointer())
431 return cret
432}
433
434// Gets the number of items in @list.
435//
436// Depending on the model implementation, calling this function may be
437// less efficient than iterating the list with increasing values for
438// @position until g_list_model_get_item() returns %NULL.
439func (x *MultiFilter) GetNItems() uint {
440
441 cret := gio.XGListModelGetNItems(x.GoPointer())
442 return cret
443}
444
445// Get the item at @position.
446//
447// If @position is greater than the number of items in @list, %NULL is
448// returned.
449//
450// %NULL is never returned for an index that is smaller than the length
451// of the list.
452//
453// This function is meant to be used by language bindings in place
454// of g_list_model_get_item().
455//
456// See also: g_list_model_get_n_items()
457func (x *MultiFilter) GetObject(PositionVar uint) *gobject.Object {
458 var cls *gobject.Object
459
460 cret := gio.XGListModelGetObject(x.GoPointer(), PositionVar)
461
462 if cret == 0 {
463 return nil
464 }
465 cls = &gobject.Object{}
466 cls.Ptr = cret
467 return cls
468}
469
470// Emits the #GListModel::items-changed signal on @list.
471//
472// This function should only be called by classes implementing
473// #GListModel. It has to be called after the internal representation
474// of @list has been updated, because handlers connected to this signal
475// might query the new state of the list.
476//
477// Implementations must only make changes to the model (as visible to
478// its consumer) in places that will not cause problems for that
479// consumer. For models that are driven directly by a write API (such
480// as #GListStore), changes can be reported in response to uses of that
481// API. For models that represent remote data, changes should only be
482// made from a fresh mainloop dispatch. It is particularly not
483// permitted to make changes in response to a call to the #GListModel
484// consumer API.
485//
486// Stated another way: in general, it is assumed that code making a
487// series of accesses to the model via the API, without returning to the
488// mainloop, and without calling other code, will continue to view the
489// same contents of the model.
490func (x *MultiFilter) ItemsChanged(PositionVar uint, RemovedVar uint, AddedVar uint) {
491
492 gio.XGListModelItemsChanged(x.GoPointer(), PositionVar, RemovedVar, AddedVar)
493
494}
495
496// Gets the ID of the @buildable object.
497//
498// `GtkBuilder` sets the name based on the ID attribute
499// of the `<object>` tag used to construct the @buildable.
500func (x *MultiFilter) GetBuildableId() string {
501
502 cret := XGtkBuildableGetBuildableId(x.GoPointer())
503 return cret
504}
505
506func init() {
507 core.SetPackageName("GTK", "gtk4")
508 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
509 var libs []uintptr
510 for _, libPath := range core.GetPaths("GTK") {
511 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
512 if err != nil {
513 panic(err)
514 }
515 libs = append(libs, lib)
516 }
517
518 core.PuregoSafeRegister(&xAnyFilterGLibType, libs, "gtk_any_filter_get_type")
519
520 core.PuregoSafeRegister(&xNewAnyFilter, libs, "gtk_any_filter_new")
521
522 core.PuregoSafeRegister(&xEveryFilterGLibType, libs, "gtk_every_filter_get_type")
523
524 core.PuregoSafeRegister(&xNewEveryFilter, libs, "gtk_every_filter_new")
525
526 core.PuregoSafeRegister(&xMultiFilterGLibType, libs, "gtk_multi_filter_get_type")
527
528 core.PuregoSafeRegister(&xMultiFilterAppend, libs, "gtk_multi_filter_append")
529 core.PuregoSafeRegister(&xMultiFilterRemove, libs, "gtk_multi_filter_remove")
530
531}