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/gdk"
12 "github.com/bnema/puregotk/v4/glib"
13 "github.com/bnema/puregotk/v4/gobject"
14 "github.com/bnema/puregotk/v4/gobject/types"
15)
16
17type TreeStoreClass struct {
18 _ structs.HostLayout
19
20 ParentClass gobject.ObjectClass
21
22 Padding [8]uintptr
23}
24
25func (x *TreeStoreClass) GoPointer() uintptr {
26 return uintptr(unsafe.Pointer(x))
27}
28
29type TreeStorePrivate struct {
30 _ structs.HostLayout
31}
32
33func (x *TreeStorePrivate) GoPointer() uintptr {
34 return uintptr(unsafe.Pointer(x))
35}
36
37// A tree-like data structure that can be used with the [class@Gtk.TreeView].
38//
39// The `GtkTreeStore` object is a list model for use with a `GtkTreeView`
40// widget. It implements the [iface@Gtk.TreeModel] interface, and consequently,
41// can use all of the methods available there. It also implements the
42// [iface@Gtk.TreeSortable] interface so it can be sorted by the view.
43// Finally, it also implements the tree [drag][iface@Gtk.TreeDragSource]
44// and [drop][iface@Gtk.TreeDragDest] interfaces.
45//
46// `GtkTreeStore` is deprecated since GTK 4.10, and should not be used in newly
47// written code. You should use [class@Gtk.TreeListModel] for a tree-like model
48// object.
49//
50// ## GtkTreeStore as GtkBuildable
51//
52// The GtkTreeStore implementation of the `GtkBuildable` interface allows
53// to specify the model columns with a `<columns>` element that may contain
54// multiple `<column>` elements, each specifying one model column. The “type”
55// attribute specifies the data type for the column.
56//
57// An example of a UI Definition fragment for a tree store:
58//
59// ```xml
60// <object class="GtkTreeStore">
61//
62// <columns>
63// <column type="gchararray"/>
64// <column type="gchararray"/>
65// <column type="gint"/>
66// </columns>
67//
68// </object>
69// ```
70type TreeStore struct {
71 gobject.Object
72}
73
74var xTreeStoreGLibType func() types.GType
75
76func TreeStoreGLibType() types.GType {
77 return xTreeStoreGLibType()
78}
79
80func TreeStoreNewFromInternalPtr(ptr uintptr) *TreeStore {
81 cls := &TreeStore{}
82 cls.Ptr = ptr
83 return cls
84}
85
86var xNewTreeStore func(int, ...interface{}) uintptr
87
88// Creates a new tree store.
89//
90// The tree store will have @n_columns, with each column using the
91// corresponding type passed to this function.
92//
93// Note that only types derived from standard GObject fundamental types
94// are supported.
95//
96// As an example:
97//
98// ```c
99// gtk_tree_store_new (3, G_TYPE_INT, G_TYPE_STRING, GDK_TYPE_TEXTURE);
100// ```
101//
102// will create a new `GtkTreeStore` with three columns of type
103// `int`, `gchararray`, and `GdkTexture` respectively.
104func NewTreeStore(NColumnsVar int, varArgs ...interface{}) *TreeStore {
105 var cls *TreeStore
106
107 cret := xNewTreeStore(NColumnsVar, varArgs...)
108
109 if cret == 0 {
110 return nil
111 }
112 cls = &TreeStore{}
113 cls.Ptr = cret
114 return cls
115}
116
117var xNewTreeStorev func(int, []types.GType) uintptr
118
119// Creates a new tree store.
120//
121// This constructor is meant for language bindings.
122func NewTreeStorev(NColumnsVar int, TypesVar []types.GType) *TreeStore {
123 var cls *TreeStore
124
125 cret := xNewTreeStorev(NColumnsVar, TypesVar)
126
127 if cret == 0 {
128 return nil
129 }
130 cls = &TreeStore{}
131 cls.Ptr = cret
132 return cls
133}
134
135var xTreeStoreAppend func(uintptr, *TreeIter, *TreeIter)
136
137// Appends a new row to @tree_store.
138//
139// If @parent is non-%NULL, then it will append the new row after the last
140// child of @parent, otherwise it will append a row to the top level.
141//
142// The @iter parameter will be changed to point to this new row. The row will
143// be empty after this function is called. To fill in values, you need to call
144// gtk_tree_store_set() or gtk_tree_store_set_value().
145func (x *TreeStore) Append(IterVar *TreeIter, ParentVar *TreeIter) {
146
147 xTreeStoreAppend(x.GoPointer(), IterVar, ParentVar)
148
149}
150
151var xTreeStoreClear func(uintptr)
152
153// Removes all rows from @tree_store
154func (x *TreeStore) Clear() {
155
156 xTreeStoreClear(x.GoPointer())
157
158}
159
160var xTreeStoreInsert func(uintptr, *TreeIter, *TreeIter, int)
161
162// Creates a new row at @position.
163//
164// If parent is non-%NULL, then the row will be made a child of @parent.
165// Otherwise, the row will be created at the toplevel.
166//
167// If @position is `-1` or is larger than the number of rows at that level,
168// then the new row will be inserted to the end of the list.
169//
170// The @iter parameter will be changed to point to this new row. The row
171// will be empty after this function is called. To fill in values, you
172// need to call gtk_tree_store_set() or gtk_tree_store_set_value().
173func (x *TreeStore) Insert(IterVar *TreeIter, ParentVar *TreeIter, PositionVar int) {
174
175 xTreeStoreInsert(x.GoPointer(), IterVar, ParentVar, PositionVar)
176
177}
178
179var xTreeStoreInsertAfter func(uintptr, *TreeIter, *TreeIter, *TreeIter)
180
181// Inserts a new row after @sibling.
182//
183// If @sibling is %NULL, then the row will be prepended to @parent’s children.
184//
185// If @parent and @sibling are %NULL, then the row will be prepended to the
186// toplevel.
187//
188// If both @sibling and @parent are set, then @parent must be the parent
189// of @sibling. When @sibling is set, @parent is optional.
190//
191// The @iter parameter will be changed to point to this new row. The row will
192// be empty after this function is called. To fill in values, you need to call
193// gtk_tree_store_set() or gtk_tree_store_set_value().
194func (x *TreeStore) InsertAfter(IterVar *TreeIter, ParentVar *TreeIter, SiblingVar *TreeIter) {
195
196 xTreeStoreInsertAfter(x.GoPointer(), IterVar, ParentVar, SiblingVar)
197
198}
199
200var xTreeStoreInsertBefore func(uintptr, *TreeIter, *TreeIter, *TreeIter)
201
202// Inserts a new row before @sibling.
203//
204// If @sibling is %NULL, then the row will be appended to @parent’s children.
205//
206// If @parent and @sibling are %NULL, then the row will be appended to the
207// toplevel.
208//
209// If both @sibling and @parent are set, then @parent must be the parent
210// of @sibling. When @sibling is set, @parent is optional.
211//
212// The @iter parameter will be changed to point to this new row. The row will
213// be empty after this function is called. To fill in values, you need to call
214// gtk_tree_store_set() or gtk_tree_store_set_value().
215func (x *TreeStore) InsertBefore(IterVar *TreeIter, ParentVar *TreeIter, SiblingVar *TreeIter) {
216
217 xTreeStoreInsertBefore(x.GoPointer(), IterVar, ParentVar, SiblingVar)
218
219}
220
221var xTreeStoreInsertWithValues func(uintptr, *TreeIter, *TreeIter, int, ...interface{})
222
223// Creates a new row at the given @position.
224//
225// The @iter parameter will be changed to point to this new row.
226//
227// If @position is -1, or larger than the number of rows on the list, then
228// the new row will be appended to the list. The row will be filled with
229// the values given to this function.
230//
231// Calling
232//
233// gtk_tree_store_insert_with_values (tree_store, iter, position, ...)
234//
235// has the same effect as calling
236//
237// ```c
238// gtk_tree_store_insert (tree_store, iter, position);
239// gtk_tree_store_set (tree_store, iter, ...);
240// ```
241//
242// with the different that the former will only emit a row_inserted signal,
243// while the latter will emit row_inserted, row_changed and if the tree store
244// is sorted, rows_reordered.
245//
246// Since emitting the rows_reordered signal repeatedly can affect the
247// performance of the program, gtk_tree_store_insert_with_values() should
248// generally be preferred when inserting rows in a sorted tree store.
249func (x *TreeStore) InsertWithValues(IterVar *TreeIter, ParentVar *TreeIter, PositionVar int, varArgs ...interface{}) {
250
251 xTreeStoreInsertWithValues(x.GoPointer(), IterVar, ParentVar, PositionVar, varArgs...)
252
253}
254
255var xTreeStoreInsertWithValuesv func(uintptr, *TreeIter, *TreeIter, int, []int, []gobject.Value, int)
256
257// A variant of gtk_tree_store_insert_with_values() which takes
258// the columns and values as two arrays, instead of varargs.
259//
260// This function is mainly intended for language bindings.
261func (x *TreeStore) InsertWithValuesv(IterVar *TreeIter, ParentVar *TreeIter, PositionVar int, ColumnsVar []int, ValuesVar []gobject.Value, NValuesVar int) {
262
263 xTreeStoreInsertWithValuesv(x.GoPointer(), IterVar, ParentVar, PositionVar, ColumnsVar, ValuesVar, NValuesVar)
264
265}
266
267var xTreeStoreIsAncestor func(uintptr, *TreeIter, *TreeIter) bool
268
269// Checks if @iter is an ancestor of @descendant.
270func (x *TreeStore) IsAncestor(IterVar *TreeIter, DescendantVar *TreeIter) bool {
271
272 cret := xTreeStoreIsAncestor(x.GoPointer(), IterVar, DescendantVar)
273 return cret
274}
275
276var xTreeStoreIterDepth func(uintptr, *TreeIter) int
277
278// Returns the depth of the position pointed by the iterator
279//
280// The depth will be 0 for anything on the root level, 1 for anything down
281// a level, etc.
282func (x *TreeStore) IterDepth(IterVar *TreeIter) int {
283
284 cret := xTreeStoreIterDepth(x.GoPointer(), IterVar)
285 return cret
286}
287
288var xTreeStoreIterIsValid func(uintptr, *TreeIter) bool
289
290// Checks if the given iter is a valid iter for this `GtkTreeStore`.
291//
292// This function is slow. Only use it for debugging and/or testing
293// purposes.
294func (x *TreeStore) IterIsValid(IterVar *TreeIter) bool {
295
296 cret := xTreeStoreIterIsValid(x.GoPointer(), IterVar)
297 return cret
298}
299
300var xTreeStoreMoveAfter func(uintptr, *TreeIter, *TreeIter)
301
302// Moves @iter in @tree_store to the position after @position.
303//
304// @iter and @position should be in the same level.
305//
306// Note that this function only works with unsorted stores.
307//
308// If @position is %NULL, @iter will be moved to the start of the level.
309func (x *TreeStore) MoveAfter(IterVar *TreeIter, PositionVar *TreeIter) {
310
311 xTreeStoreMoveAfter(x.GoPointer(), IterVar, PositionVar)
312
313}
314
315var xTreeStoreMoveBefore func(uintptr, *TreeIter, *TreeIter)
316
317// Moves @iter in @tree_store to the position before @position.
318//
319// @iter and @position should be in the same level.
320//
321// Note that this function only works with unsorted stores.
322//
323// If @position is %NULL, @iter will be moved to the end of the level.
324func (x *TreeStore) MoveBefore(IterVar *TreeIter, PositionVar *TreeIter) {
325
326 xTreeStoreMoveBefore(x.GoPointer(), IterVar, PositionVar)
327
328}
329
330var xTreeStorePrepend func(uintptr, *TreeIter, *TreeIter)
331
332// Prepends a new row to @tree_store.
333//
334// If @parent is non-%NULL, then it will prepend the new row before the first
335// child of @parent, otherwise it will prepend a row to the top level. The
336// `iter` parameter will be changed to point to this new row. The row will
337// be empty after this function is called. To fill in values, you need to
338// call gtk_tree_store_set() or gtk_tree_store_set_value().
339func (x *TreeStore) Prepend(IterVar *TreeIter, ParentVar *TreeIter) {
340
341 xTreeStorePrepend(x.GoPointer(), IterVar, ParentVar)
342
343}
344
345var xTreeStoreRemove func(uintptr, *TreeIter) bool
346
347// Removes @iter from @tree_store.
348//
349// After being removed, @iter is set to the next valid row at that level, or
350// invalidated if it previously pointed to the last one.
351func (x *TreeStore) Remove(IterVar *TreeIter) bool {
352
353 cret := xTreeStoreRemove(x.GoPointer(), IterVar)
354 return cret
355}
356
357var xTreeStoreReorder func(uintptr, *TreeIter, []int)
358
359// Reorders the children of @parent in @tree_store to follow the order
360// indicated by @new_order.
361//
362// Note that this function only works with unsorted stores.
363func (x *TreeStore) Reorder(ParentVar *TreeIter, NewOrderVar []int) {
364
365 xTreeStoreReorder(x.GoPointer(), ParentVar, NewOrderVar)
366
367}
368
369var xTreeStoreSet func(uintptr, *TreeIter, ...interface{})
370
371// Sets the value of one or more cells in the row referenced by @iter.
372//
373// The variable argument list should contain integer column numbers,
374// each column number followed by the value to be set.
375//
376// The list is terminated by a value of `-1`.
377//
378// For example, to set column 0 with type `G_TYPE_STRING` to “Foo”, you would
379// write
380//
381// ```c
382// gtk_tree_store_set (store, iter, 0, "Foo", -1);
383// ```
384//
385// The value will be referenced by the store if it is a `G_TYPE_OBJECT`, and it
386// will be copied if it is a `G_TYPE_STRING` or `G_TYPE_BOXED`.
387func (x *TreeStore) Set(IterVar *TreeIter, varArgs ...interface{}) {
388
389 xTreeStoreSet(x.GoPointer(), IterVar, varArgs...)
390
391}
392
393var xTreeStoreSetColumnTypes func(uintptr, int, []types.GType)
394
395// Sets the type of the columns in a tree store.
396//
397// This function is meant primarily for types that inherit from
398// `GtkTreeStore`, and should only be used when constructing a new
399// `GtkTreeStore`.
400//
401// This functions cannot be called after a row has been added,
402// or a method on the `GtkTreeModel` interface is called on the
403// tree store.
404func (x *TreeStore) SetColumnTypes(NColumnsVar int, TypesVar []types.GType) {
405
406 xTreeStoreSetColumnTypes(x.GoPointer(), NColumnsVar, TypesVar)
407
408}
409
410var xTreeStoreSetValist func(uintptr, *TreeIter, []interface{})
411
412// A version of gtk_tree_store_set() using `va_list`.
413func (x *TreeStore) SetValist(IterVar *TreeIter, VarArgsVar []interface{}) {
414
415 xTreeStoreSetValist(x.GoPointer(), IterVar, VarArgsVar)
416
417}
418
419var xTreeStoreSetValue func(uintptr, *TreeIter, int, *gobject.Value)
420
421// Sets the data in the cell specified by @iter and @column.
422//
423// The type of @value must be convertible to the type of the
424// column.
425func (x *TreeStore) SetValue(IterVar *TreeIter, ColumnVar int, ValueVar *gobject.Value) {
426
427 xTreeStoreSetValue(x.GoPointer(), IterVar, ColumnVar, ValueVar)
428
429}
430
431var xTreeStoreSetValuesv func(uintptr, *TreeIter, []int, []gobject.Value, int)
432
433// A variant of gtk_tree_store_set_valist() which takes
434// the columns and values as two arrays, instead of using variadic
435// arguments.
436//
437// This function is mainly intended for language bindings or in case
438// the number of columns to change is not known until run-time.
439func (x *TreeStore) SetValuesv(IterVar *TreeIter, ColumnsVar []int, ValuesVar []gobject.Value, NValuesVar int) {
440
441 xTreeStoreSetValuesv(x.GoPointer(), IterVar, ColumnsVar, ValuesVar, NValuesVar)
442
443}
444
445var xTreeStoreSwap func(uintptr, *TreeIter, *TreeIter)
446
447// Swaps @a and @b in the same level of @tree_store.
448//
449// Note that this function only works with unsorted stores.
450func (x *TreeStore) Swap(AVar *TreeIter, BVar *TreeIter) {
451
452 xTreeStoreSwap(x.GoPointer(), AVar, BVar)
453
454}
455
456func (c *TreeStore) GoPointer() uintptr {
457 if c == nil {
458 return 0
459 }
460 return c.Ptr
461}
462
463func (c *TreeStore) SetGoPointer(ptr uintptr) {
464 c.Ptr = ptr
465}
466
467// Gets the ID of the @buildable object.
468//
469// `GtkBuilder` sets the name based on the ID attribute
470// of the `<object>` tag used to construct the @buildable.
471func (x *TreeStore) GetBuildableId() string {
472
473 cret := XGtkBuildableGetBuildableId(x.GoPointer())
474 return cret
475}
476
477// Asks the `GtkTreeDragDest` to insert a row before the path @dest,
478// deriving the contents of the row from @value. If @dest is
479// outside the tree so that inserting before it is impossible, %FALSE
480// will be returned. Also, %FALSE may be returned if the new row is
481// not created for some model-specific reason. Should robustly handle
482// a @dest no longer found in the model!
483func (x *TreeStore) DragDataReceived(DestVar *TreePath, ValueVar *gobject.Value) bool {
484
485 cret := XGtkTreeDragDestDragDataReceived(x.GoPointer(), DestVar, ValueVar)
486 return cret
487}
488
489// Determines whether a drop is possible before the given @dest_path,
490// at the same depth as @dest_path. i.e., can we drop the data in
491// @value at that location. @dest_path does not have to
492// exist; the return value will almost certainly be %FALSE if the
493// parent of @dest_path doesn’t exist, though.
494func (x *TreeStore) RowDropPossible(DestPathVar *TreePath, ValueVar *gobject.Value) bool {
495
496 cret := XGtkTreeDragDestRowDropPossible(x.GoPointer(), DestPathVar, ValueVar)
497 return cret
498}
499
500// Asks the `GtkTreeDragSource` to delete the row at @path, because
501// it was moved somewhere else via drag-and-drop. Returns %FALSE
502// if the deletion fails because @path no longer exists, or for
503// some model-specific reason. Should robustly handle a @path no
504// longer found in the model!
505func (x *TreeStore) DragDataDelete(PathVar *TreePath) bool {
506
507 cret := XGtkTreeDragSourceDragDataDelete(x.GoPointer(), PathVar)
508 return cret
509}
510
511// Asks the `GtkTreeDragSource` to return a `GdkContentProvider` representing
512// the row at @path. Should robustly handle a @path no
513// longer found in the model!
514func (x *TreeStore) DragDataGet(PathVar *TreePath) *gdk.ContentProvider {
515 var cls *gdk.ContentProvider
516
517 cret := XGtkTreeDragSourceDragDataGet(x.GoPointer(), PathVar)
518
519 if cret == 0 {
520 return nil
521 }
522 cls = &gdk.ContentProvider{}
523 cls.Ptr = cret
524 return cls
525}
526
527// Asks the `GtkTreeDragSource` whether a particular row can be used as
528// the source of a DND operation. If the source doesn’t implement
529// this interface, the row is assumed draggable.
530func (x *TreeStore) RowDraggable(PathVar *TreePath) bool {
531
532 cret := XGtkTreeDragSourceRowDraggable(x.GoPointer(), PathVar)
533 return cret
534}
535
536// Creates a new `GtkTreeModel`, with @child_model as the child_model
537// and @root as the virtual root.
538func (x *TreeStore) FilterNew(RootVar *TreePath) *TreeModelBase {
539 var cls *TreeModelBase
540
541 cret := XGtkTreeModelFilterNew(x.GoPointer(), RootVar)
542
543 if cret == 0 {
544 return nil
545 }
546 cls = &TreeModelBase{}
547 cls.Ptr = cret
548 return cls
549}
550
551// Calls @func on each node in model in a depth-first fashion.
552//
553// If @func returns %TRUE, then the tree ceases to be walked,
554// and gtk_tree_model_foreach() returns.
555func (x *TreeStore) Foreach(FuncVar *TreeModelForeachFunc, UserDataVar uintptr) {
556
557 XGtkTreeModelForeach(x.GoPointer(), glib.NewCallback(FuncVar), UserDataVar)
558
559}
560
561// Gets the value of one or more cells in the row referenced by @iter.
562//
563// The variable argument list should contain integer column numbers,
564// each column number followed by a place to store the value being
565// retrieved. The list is terminated by a -1. For example, to get a
566// value from column 0 with type %G_TYPE_STRING, you would
567// write: `gtk_tree_model_get (model, iter, 0, &place_string_here, -1)`,
568// where `place_string_here` is a #gchararray
569// to be filled with the string.
570//
571// Returned values with type %G_TYPE_OBJECT have to be unreferenced,
572// values with type %G_TYPE_STRING or %G_TYPE_BOXED have to be freed.
573// Other values are passed by value.
574func (x *TreeStore) Get(IterVar *TreeIter, varArgs ...interface{}) {
575
576 XGtkTreeModelGet(x.GoPointer(), IterVar, varArgs...)
577
578}
579
580// Returns the type of the column.
581func (x *TreeStore) GetColumnType(IndexVar int) types.GType {
582
583 cret := XGtkTreeModelGetColumnType(x.GoPointer(), IndexVar)
584 return cret
585}
586
587// Returns a set of flags supported by this interface.
588//
589// The flags are a bitwise combination of `GtkTreeModel`Flags.
590// The flags supported should not change during the lifetime
591// of the @tree_model.
592func (x *TreeStore) GetFlags() TreeModelFlags {
593
594 cret := XGtkTreeModelGetFlags(x.GoPointer())
595 return cret
596}
597
598// Sets @iter to a valid iterator pointing to @path.
599//
600// If @path does not exist, @iter is set to an invalid
601// iterator and %FALSE is returned.
602func (x *TreeStore) GetIter(IterVar *TreeIter, PathVar *TreePath) bool {
603
604 cret := XGtkTreeModelGetIter(x.GoPointer(), IterVar, PathVar)
605 return cret
606}
607
608// Initializes @iter with the first iterator in the tree
609// (the one at the path "0").
610//
611// Returns %FALSE if the tree is empty, %TRUE otherwise.
612func (x *TreeStore) GetIterFirst(IterVar *TreeIter) bool {
613
614 cret := XGtkTreeModelGetIterFirst(x.GoPointer(), IterVar)
615 return cret
616}
617
618// Sets @iter to a valid iterator pointing to @path_string, if it
619// exists.
620//
621// Otherwise, @iter is left invalid and %FALSE is returned.
622func (x *TreeStore) GetIterFromString(IterVar *TreeIter, PathStringVar string) bool {
623
624 cret := XGtkTreeModelGetIterFromString(x.GoPointer(), IterVar, PathStringVar)
625 return cret
626}
627
628// Returns the number of columns supported by @tree_model.
629func (x *TreeStore) GetNColumns() int {
630
631 cret := XGtkTreeModelGetNColumns(x.GoPointer())
632 return cret
633}
634
635// Returns a newly-created `GtkTreePath` referenced by @iter.
636//
637// This path should be freed with gtk_tree_path_free().
638func (x *TreeStore) GetPath(IterVar *TreeIter) *TreePath {
639
640 cret := XGtkTreeModelGetPath(x.GoPointer(), IterVar)
641 return cret
642}
643
644// Generates a string representation of the iter.
645//
646// This string is a “:” separated list of numbers.
647// For example, “4:10:0:3” would be an acceptable
648// return value for this string.
649func (x *TreeStore) GetStringFromIter(IterVar *TreeIter) string {
650
651 cret := XGtkTreeModelGetStringFromIter(x.GoPointer(), IterVar)
652 return cret
653}
654
655// Gets the value of one or more cells in the row referenced by @iter.
656//
657// See [method@Gtk.TreeModel.get], this version takes a va_list
658// for language bindings to use.
659func (x *TreeStore) GetValist(IterVar *TreeIter, VarArgsVar []interface{}) {
660
661 XGtkTreeModelGetValist(x.GoPointer(), IterVar, VarArgsVar)
662
663}
664
665// Initializes and sets @value to that at @column.
666//
667// When done with @value, g_value_unset() needs to be called
668// to free any allocated memory.
669func (x *TreeStore) GetValue(IterVar *TreeIter, ColumnVar int, ValueVar *gobject.Value) {
670
671 XGtkTreeModelGetValue(x.GoPointer(), IterVar, ColumnVar, ValueVar)
672
673}
674
675// Sets @iter to point to the first child of @parent.
676//
677// If @parent has no children, %FALSE is returned and @iter is
678// set to be invalid. @parent will remain a valid node after this
679// function has been called.
680//
681// If @parent is %NULL returns the first node, equivalent to
682// `gtk_tree_model_get_iter_first (tree_model, iter);`
683func (x *TreeStore) IterChildren(IterVar *TreeIter, ParentVar *TreeIter) bool {
684
685 cret := XGtkTreeModelIterChildren(x.GoPointer(), IterVar, ParentVar)
686 return cret
687}
688
689// Returns %TRUE if @iter has children, %FALSE otherwise.
690func (x *TreeStore) IterHasChild(IterVar *TreeIter) bool {
691
692 cret := XGtkTreeModelIterHasChild(x.GoPointer(), IterVar)
693 return cret
694}
695
696// Returns the number of children that @iter has.
697//
698// As a special case, if @iter is %NULL, then the number
699// of toplevel nodes is returned.
700func (x *TreeStore) IterNChildren(IterVar *TreeIter) int {
701
702 cret := XGtkTreeModelIterNChildren(x.GoPointer(), IterVar)
703 return cret
704}
705
706// Sets @iter to point to the node following it at the current level.
707//
708// If there is no next @iter, %FALSE is returned and @iter is set
709// to be invalid.
710func (x *TreeStore) IterNext(IterVar *TreeIter) bool {
711
712 cret := XGtkTreeModelIterNext(x.GoPointer(), IterVar)
713 return cret
714}
715
716// Sets @iter to be the child of @parent, using the given index.
717//
718// The first index is 0. If @n is too big, or @parent has no children,
719// @iter is set to an invalid iterator and %FALSE is returned. @parent
720// will remain a valid node after this function has been called. As a
721// special case, if @parent is %NULL, then the @n-th root node
722// is set.
723func (x *TreeStore) IterNthChild(IterVar *TreeIter, ParentVar *TreeIter, NVar int) bool {
724
725 cret := XGtkTreeModelIterNthChild(x.GoPointer(), IterVar, ParentVar, NVar)
726 return cret
727}
728
729// Sets @iter to be the parent of @child.
730//
731// If @child is at the toplevel, and doesn’t have a parent, then
732// @iter is set to an invalid iterator and %FALSE is returned.
733// @child will remain a valid node after this function has been
734// called.
735//
736// @iter will be initialized before the lookup is performed, so @child
737// and @iter cannot point to the same memory location.
738func (x *TreeStore) IterParent(IterVar *TreeIter, ChildVar *TreeIter) bool {
739
740 cret := XGtkTreeModelIterParent(x.GoPointer(), IterVar, ChildVar)
741 return cret
742}
743
744// Sets @iter to point to the previous node at the current level.
745//
746// If there is no previous @iter, %FALSE is returned and @iter is
747// set to be invalid.
748func (x *TreeStore) IterPrevious(IterVar *TreeIter) bool {
749
750 cret := XGtkTreeModelIterPrevious(x.GoPointer(), IterVar)
751 return cret
752}
753
754// Lets the tree ref the node.
755//
756// This is an optional method for models to implement.
757// To be more specific, models may ignore this call as it exists
758// primarily for performance reasons.
759//
760// This function is primarily meant as a way for views to let
761// caching models know when nodes are being displayed (and hence,
762// whether or not to cache that node). Being displayed means a node
763// is in an expanded branch, regardless of whether the node is currently
764// visible in the viewport. For example, a file-system based model
765// would not want to keep the entire file-hierarchy in memory,
766// just the sections that are currently being displayed by
767// every current view.
768//
769// A model should be expected to be able to get an iter independent
770// of its reffed state.
771func (x *TreeStore) RefNode(IterVar *TreeIter) {
772
773 XGtkTreeModelRefNode(x.GoPointer(), IterVar)
774
775}
776
777// Emits the ::row-changed signal on @tree_model.
778//
779// See [signal@Gtk.TreeModel::row-changed].
780func (x *TreeStore) RowChanged(PathVar *TreePath, IterVar *TreeIter) {
781
782 XGtkTreeModelRowChanged(x.GoPointer(), PathVar, IterVar)
783
784}
785
786// Emits the ::row-deleted signal on @tree_model.
787//
788// See [signal@Gtk.TreeModel::row-deleted].
789//
790// This should be called by models after a row has been removed.
791// The location pointed to by @path should be the location that
792// the row previously was at. It may not be a valid location anymore.
793//
794// Nodes that are deleted are not unreffed, this means that any
795// outstanding references on the deleted node should not be released.
796func (x *TreeStore) RowDeleted(PathVar *TreePath) {
797
798 XGtkTreeModelRowDeleted(x.GoPointer(), PathVar)
799
800}
801
802// Emits the ::row-has-child-toggled signal on @tree_model.
803//
804// See [signal@Gtk.TreeModel::row-has-child-toggled].
805//
806// This should be called by models after the child
807// state of a node changes.
808func (x *TreeStore) RowHasChildToggled(PathVar *TreePath, IterVar *TreeIter) {
809
810 XGtkTreeModelRowHasChildToggled(x.GoPointer(), PathVar, IterVar)
811
812}
813
814// Emits the ::row-inserted signal on @tree_model.
815//
816// See [signal@Gtk.TreeModel::row-inserted].
817func (x *TreeStore) RowInserted(PathVar *TreePath, IterVar *TreeIter) {
818
819 XGtkTreeModelRowInserted(x.GoPointer(), PathVar, IterVar)
820
821}
822
823// Emits the ::rows-reordered signal on @tree_model.
824//
825// See [signal@Gtk.TreeModel::rows-reordered].
826//
827// This should be called by models when their rows have been
828// reordered.
829func (x *TreeStore) RowsReordered(PathVar *TreePath, IterVar *TreeIter, NewOrderVar int) {
830
831 XGtkTreeModelRowsReordered(x.GoPointer(), PathVar, IterVar, NewOrderVar)
832
833}
834
835// Emits the ::rows-reordered signal on @tree_model.
836//
837// See [signal@Gtk.TreeModel::rows-reordered].
838//
839// This should be called by models when their rows have been
840// reordered.
841func (x *TreeStore) RowsReorderedWithLength(PathVar *TreePath, IterVar *TreeIter, NewOrderVar []int, LengthVar int) {
842
843 XGtkTreeModelRowsReorderedWithLength(x.GoPointer(), PathVar, IterVar, NewOrderVar, LengthVar)
844
845}
846
847// Lets the tree unref the node.
848//
849// This is an optional method for models to implement.
850// To be more specific, models may ignore this call as it exists
851// primarily for performance reasons. For more information on what
852// this means, see gtk_tree_model_ref_node().
853//
854// Please note that nodes that are deleted are not unreffed.
855func (x *TreeStore) UnrefNode(IterVar *TreeIter) {
856
857 XGtkTreeModelUnrefNode(x.GoPointer(), IterVar)
858
859}
860
861// Fills in @sort_column_id and @order with the current sort column and the
862// order. It returns %TRUE unless the @sort_column_id is
863// %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID or
864// %GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID.
865func (x *TreeStore) GetSortColumnId(SortColumnIdVar *int, OrderVar *SortType) bool {
866
867 cret := XGtkTreeSortableGetSortColumnId(x.GoPointer(), SortColumnIdVar, OrderVar)
868 return cret
869}
870
871// Returns %TRUE if the model has a default sort function. This is used
872// primarily by GtkTreeViewColumns in order to determine if a model can
873// go back to the default state, or not.
874func (x *TreeStore) HasDefaultSortFunc() bool {
875
876 cret := XGtkTreeSortableHasDefaultSortFunc(x.GoPointer())
877 return cret
878}
879
880// Sets the default comparison function used when sorting to be @sort_func.
881// If the current sort column id of @sortable is
882// %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, then the model will sort using
883// this function.
884//
885// If @sort_func is %NULL, then there will be no default comparison function.
886// This means that once the model has been sorted, it can’t go back to the
887// default state. In this case, when the current sort column id of @sortable
888// is %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted.
889func (x *TreeStore) SetDefaultSortFunc(SortFuncVar *TreeIterCompareFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) {
890
891 XGtkTreeSortableSetDefaultSortFunc(x.GoPointer(), glib.NewCallback(SortFuncVar), UserDataVar, glib.NewCallbackNullable(DestroyVar))
892
893}
894
895// Sets the current sort column to be @sort_column_id. The @sortable will
896// resort itself to reflect this change, after emitting a
897// `GtkTreeSortable::sort-column-changed` signal. @sort_column_id may either be
898// a regular column id, or one of the following special values:
899//
900// - %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID: the default sort function
901// will be used, if it is set
902//
903// - %GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID: no sorting will occur
904func (x *TreeStore) SetSortColumnId(SortColumnIdVar int, OrderVar SortType) {
905
906 XGtkTreeSortableSetSortColumnId(x.GoPointer(), SortColumnIdVar, OrderVar)
907
908}
909
910// Sets the comparison function used when sorting to be @sort_func. If the
911// current sort column id of @sortable is the same as @sort_column_id, then
912// the model will sort using this function.
913func (x *TreeStore) SetSortFunc(SortColumnIdVar int, SortFuncVar *TreeIterCompareFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) {
914
915 XGtkTreeSortableSetSortFunc(x.GoPointer(), SortColumnIdVar, glib.NewCallback(SortFuncVar), UserDataVar, glib.NewCallbackNullable(DestroyVar))
916
917}
918
919// Emits a `GtkTreeSortable::sort-column-changed` signal on @sortable.
920func (x *TreeStore) SortColumnChanged() {
921
922 XGtkTreeSortableSortColumnChanged(x.GoPointer())
923
924}
925
926func init() {
927 core.SetPackageName("GTK", "gtk4")
928 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
929 var libs []uintptr
930 for _, libPath := range core.GetPaths("GTK") {
931 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
932 if err != nil {
933 panic(err)
934 }
935 libs = append(libs, lib)
936 }
937
938 core.PuregoSafeRegister(&xTreeStoreGLibType, libs, "gtk_tree_store_get_type")
939
940 core.PuregoSafeRegister(&xNewTreeStore, libs, "gtk_tree_store_new")
941 core.PuregoSafeRegister(&xNewTreeStorev, libs, "gtk_tree_store_newv")
942
943 core.PuregoSafeRegister(&xTreeStoreAppend, libs, "gtk_tree_store_append")
944 core.PuregoSafeRegister(&xTreeStoreClear, libs, "gtk_tree_store_clear")
945 core.PuregoSafeRegister(&xTreeStoreInsert, libs, "gtk_tree_store_insert")
946 core.PuregoSafeRegister(&xTreeStoreInsertAfter, libs, "gtk_tree_store_insert_after")
947 core.PuregoSafeRegister(&xTreeStoreInsertBefore, libs, "gtk_tree_store_insert_before")
948 core.PuregoSafeRegister(&xTreeStoreInsertWithValues, libs, "gtk_tree_store_insert_with_values")
949 core.PuregoSafeRegister(&xTreeStoreInsertWithValuesv, libs, "gtk_tree_store_insert_with_valuesv")
950 core.PuregoSafeRegister(&xTreeStoreIsAncestor, libs, "gtk_tree_store_is_ancestor")
951 core.PuregoSafeRegister(&xTreeStoreIterDepth, libs, "gtk_tree_store_iter_depth")
952 core.PuregoSafeRegister(&xTreeStoreIterIsValid, libs, "gtk_tree_store_iter_is_valid")
953 core.PuregoSafeRegister(&xTreeStoreMoveAfter, libs, "gtk_tree_store_move_after")
954 core.PuregoSafeRegister(&xTreeStoreMoveBefore, libs, "gtk_tree_store_move_before")
955 core.PuregoSafeRegister(&xTreeStorePrepend, libs, "gtk_tree_store_prepend")
956 core.PuregoSafeRegister(&xTreeStoreRemove, libs, "gtk_tree_store_remove")
957 core.PuregoSafeRegister(&xTreeStoreReorder, libs, "gtk_tree_store_reorder")
958 core.PuregoSafeRegister(&xTreeStoreSet, libs, "gtk_tree_store_set")
959 core.PuregoSafeRegister(&xTreeStoreSetColumnTypes, libs, "gtk_tree_store_set_column_types")
960 core.PuregoSafeRegister(&xTreeStoreSetValist, libs, "gtk_tree_store_set_valist")
961 core.PuregoSafeRegister(&xTreeStoreSetValue, libs, "gtk_tree_store_set_value")
962 core.PuregoSafeRegister(&xTreeStoreSetValuesv, libs, "gtk_tree_store_set_valuesv")
963 core.PuregoSafeRegister(&xTreeStoreSwap, libs, "gtk_tree_store_swap")
964
965}