v0.2.1 c0399be

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

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