v0.2.1 c0399be

gtktreemodelsort.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 TreeModelSortClass struct {
18	_ structs.HostLayout
19
20	ParentClass gobject.ObjectClass
21
22	Padding [8]uintptr
23}
24
25func (x *TreeModelSortClass) GoPointer() uintptr {
26	return uintptr(unsafe.Pointer(x))
27}
28
29type TreeModelSortPrivate struct {
30	_ structs.HostLayout
31}
32
33func (x *TreeModelSortPrivate) GoPointer() uintptr {
34	return uintptr(unsafe.Pointer(x))
35}
36
37// A GtkTreeModel which makes an underlying tree model sortable
38//
39// The `GtkTreeModelSort` is a model which implements the `GtkTreeSortable`
40// interface.  It does not hold any data itself, but rather is created with
41// a child model and proxies its data.  It has identical column types to
42// this child model, and the changes in the child are propagated.  The
43// primary purpose of this model is to provide a way to sort a different
44// model without modifying it. Note that the sort function used by
45// `GtkTreeModelSort` is not guaranteed to be stable.
46//
47// The use of this is best demonstrated through an example.  In the
48// following sample code we create two `GtkTreeView` widgets each with a
49// view of the same data.  As the model is wrapped here by a
50// `GtkTreeModelSort`, the two `GtkTreeView`s can each sort their
51// view of the data without affecting the other.  By contrast, if we
52// simply put the same model in each widget, then sorting the first would
53// sort the second.
54//
55// ## Using a `GtkTreeModelSort`
56//
57// ```c
58//
59//	{
60//	  GtkTreeView *tree_view1;
61//	  GtkTreeView *tree_view2;
62//	  GtkTreeModel *sort_model1;
63//	  GtkTreeModel *sort_model2;
64//	  GtkTreeModel *child_model;
65//
66//	  // get the child model
67//	  child_model = get_my_model ();
68//
69//	  // Create the first tree
70//	  sort_model1 = gtk_tree_model_sort_new_with_model (child_model);
71//	  tree_view1 = gtk_tree_view_new_with_model (sort_model1);
72//
73//	  // Create the second tree
74//	  sort_model2 = gtk_tree_model_sort_new_with_model (child_model);
75//	  tree_view2 = gtk_tree_view_new_with_model (sort_model2);
76//
77//	  // Now we can sort the two models independently
78//	  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sort_model1),
79//	                                        COLUMN_1, GTK_SORT_ASCENDING);
80//	  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sort_model2),
81//	                                        COLUMN_1, GTK_SORT_DESCENDING);
82//	}
83//
84// ```
85//
86// To demonstrate how to access the underlying child model from the sort
87// model, the next example will be a callback for the `GtkTreeSelection`
88// `GtkTreeSelection::changed` signal.  In this callback, we get a string
89// from COLUMN_1 of the model.  We then modify the string, find the same
90// selected row on the child model, and change the row there.
91//
92// ## Accessing the child model of in a selection changed callback
93//
94// ```c
95// void
96// selection_changed (GtkTreeSelection *selection, gpointer data)
97//
98//	{
99//	  GtkTreeModel *sort_model = NULL;
100//	  GtkTreeModel *child_model;
101//	  GtkTreeIter sort_iter;
102//	  GtkTreeIter child_iter;
103//	  char *some_data = NULL;
104//	  char *modified_data;
105//
106//	  // Get the current selected row and the model.
107//	  if (! gtk_tree_selection_get_selected (selection,
108//	                                         &sort_model,
109//	                                         &sort_iter))
110//	    return;
111//
112//	  // Look up the current value on the selected row and get
113//	  // a new value to change it to.
114//	  gtk_tree_model_get (GTK_TREE_MODEL (sort_model), &sort_iter,
115//	                      COLUMN_1, &some_data,
116//	                      -1);
117//
118//	  modified_data = change_the_data (some_data);
119//	  g_free (some_data);
120//
121//	  // Get an iterator on the child model, instead of the sort model.
122//	  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (sort_model),
123//	                                                  &child_iter,
124//	                                                  &sort_iter);
125//
126//	  // Get the child model and change the value of the row. In this
127//	  // example, the child model is a GtkListStore. It could be any other
128//	  // type of model, though.
129//	  child_model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (sort_model));
130//	  gtk_list_store_set (GTK_LIST_STORE (child_model), &child_iter,
131//	                      COLUMN_1, &modified_data,
132//	                      -1);
133//	  g_free (modified_data);
134//	}
135//
136// ```
137type TreeModelSort struct {
138	gobject.Object
139}
140
141var xTreeModelSortGLibType func() types.GType
142
143func TreeModelSortGLibType() types.GType {
144	return xTreeModelSortGLibType()
145}
146
147func TreeModelSortNewFromInternalPtr(ptr uintptr) *TreeModelSort {
148	cls := &TreeModelSort{}
149	cls.Ptr = ptr
150	return cls
151}
152
153var xNewTreeModelSortWithModel func(uintptr) uintptr
154
155// Creates a new `GtkTreeModelSort`, with @child_model as the child model.
156func NewTreeModelSortWithModel(ChildModelVar TreeModel) *TreeModelSort {
157	var cls *TreeModelSort
158
159	cret := xNewTreeModelSortWithModel(ChildModelVar.GoPointer())
160
161	if cret == 0 {
162		return nil
163	}
164	cls = &TreeModelSort{}
165	cls.Ptr = cret
166	return cls
167}
168
169var xTreeModelSortClearCache func(uintptr)
170
171// This function should almost never be called.  It clears the @tree_model_sort
172// of any cached iterators that haven’t been reffed with
173// gtk_tree_model_ref_node().  This might be useful if the child model being
174// sorted is static (and doesn’t change often) and there has been a lot of
175// unreffed access to nodes.  As a side effect of this function, all unreffed
176// iters will be invalid.
177func (x *TreeModelSort) ClearCache() {
178
179	xTreeModelSortClearCache(x.GoPointer())
180
181}
182
183var xTreeModelSortConvertChildIterToIter func(uintptr, *TreeIter, *TreeIter) bool
184
185// Sets @sort_iter to point to the row in @tree_model_sort that corresponds to
186// the row pointed at by @child_iter.  If @sort_iter was not set, %FALSE
187// is returned.  Note: a boolean is only returned since 2.14.
188func (x *TreeModelSort) ConvertChildIterToIter(SortIterVar *TreeIter, ChildIterVar *TreeIter) bool {
189
190	cret := xTreeModelSortConvertChildIterToIter(x.GoPointer(), SortIterVar, ChildIterVar)
191	return cret
192}
193
194var xTreeModelSortConvertChildPathToPath func(uintptr, *TreePath) *TreePath
195
196// Converts @child_path to a path relative to @tree_model_sort.  That is,
197// @child_path points to a path in the child model.  The returned path will
198// point to the same row in the sorted model.  If @child_path isn’t a valid
199// path on the child model, then %NULL is returned.
200func (x *TreeModelSort) ConvertChildPathToPath(ChildPathVar *TreePath) *TreePath {
201
202	cret := xTreeModelSortConvertChildPathToPath(x.GoPointer(), ChildPathVar)
203	return cret
204}
205
206var xTreeModelSortConvertIterToChildIter func(uintptr, *TreeIter, *TreeIter)
207
208// Sets @child_iter to point to the row pointed to by @sorted_iter.
209func (x *TreeModelSort) ConvertIterToChildIter(ChildIterVar *TreeIter, SortedIterVar *TreeIter) {
210
211	xTreeModelSortConvertIterToChildIter(x.GoPointer(), ChildIterVar, SortedIterVar)
212
213}
214
215var xTreeModelSortConvertPathToChildPath func(uintptr, *TreePath) *TreePath
216
217// Converts @sorted_path to a path on the child model of @tree_model_sort.
218// That is, @sorted_path points to a location in @tree_model_sort.  The
219// returned path will point to the same location in the model not being
220// sorted.  If @sorted_path does not point to a location in the child model,
221// %NULL is returned.
222func (x *TreeModelSort) ConvertPathToChildPath(SortedPathVar *TreePath) *TreePath {
223
224	cret := xTreeModelSortConvertPathToChildPath(x.GoPointer(), SortedPathVar)
225	return cret
226}
227
228var xTreeModelSortGetModel func(uintptr) uintptr
229
230// Returns the model the `GtkTreeModelSort` is sorting.
231func (x *TreeModelSort) GetModel() *TreeModelBase {
232	var cls *TreeModelBase
233
234	cret := xTreeModelSortGetModel(x.GoPointer())
235
236	if cret == 0 {
237		return nil
238	}
239	gobject.IncreaseRef(cret)
240	cls = &TreeModelBase{}
241	cls.Ptr = cret
242	return cls
243}
244
245var xTreeModelSortIterIsValid func(uintptr, *TreeIter) bool
246
247// > This function is slow. Only use it for debugging and/or testing
248// > purposes.
249//
250// Checks if the given iter is a valid iter for this `GtkTreeModelSort`.
251func (x *TreeModelSort) IterIsValid(IterVar *TreeIter) bool {
252
253	cret := xTreeModelSortIterIsValid(x.GoPointer(), IterVar)
254	return cret
255}
256
257var xTreeModelSortResetDefaultSortFunc func(uintptr)
258
259// This resets the default sort function to be in the “unsorted” state.  That
260// is, it is in the same order as the child model. It will re-sort the model
261// to be in the same order as the child model only if the `GtkTreeModelSort`
262// is in “unsorted” state.
263func (x *TreeModelSort) ResetDefaultSortFunc() {
264
265	xTreeModelSortResetDefaultSortFunc(x.GoPointer())
266
267}
268
269func (c *TreeModelSort) GoPointer() uintptr {
270	if c == nil {
271		return 0
272	}
273	return c.Ptr
274}
275
276func (c *TreeModelSort) SetGoPointer(ptr uintptr) {
277	c.Ptr = ptr
278}
279
280// Asks the `GtkTreeDragSource` to delete the row at @path, because
281// it was moved somewhere else via drag-and-drop. Returns %FALSE
282// if the deletion fails because @path no longer exists, or for
283// some model-specific reason. Should robustly handle a @path no
284// longer found in the model!
285func (x *TreeModelSort) DragDataDelete(PathVar *TreePath) bool {
286
287	cret := XGtkTreeDragSourceDragDataDelete(x.GoPointer(), PathVar)
288	return cret
289}
290
291// Asks the `GtkTreeDragSource` to return a `GdkContentProvider` representing
292// the row at @path. Should robustly handle a @path no
293// longer found in the model!
294func (x *TreeModelSort) DragDataGet(PathVar *TreePath) *gdk.ContentProvider {
295	var cls *gdk.ContentProvider
296
297	cret := XGtkTreeDragSourceDragDataGet(x.GoPointer(), PathVar)
298
299	if cret == 0 {
300		return nil
301	}
302	cls = &gdk.ContentProvider{}
303	cls.Ptr = cret
304	return cls
305}
306
307// Asks the `GtkTreeDragSource` whether a particular row can be used as
308// the source of a DND operation. If the source doesn’t implement
309// this interface, the row is assumed draggable.
310func (x *TreeModelSort) RowDraggable(PathVar *TreePath) bool {
311
312	cret := XGtkTreeDragSourceRowDraggable(x.GoPointer(), PathVar)
313	return cret
314}
315
316// Creates a new `GtkTreeModel`, with @child_model as the child_model
317// and @root as the virtual root.
318func (x *TreeModelSort) FilterNew(RootVar *TreePath) *TreeModelBase {
319	var cls *TreeModelBase
320
321	cret := XGtkTreeModelFilterNew(x.GoPointer(), RootVar)
322
323	if cret == 0 {
324		return nil
325	}
326	cls = &TreeModelBase{}
327	cls.Ptr = cret
328	return cls
329}
330
331// Calls @func on each node in model in a depth-first fashion.
332//
333// If @func returns %TRUE, then the tree ceases to be walked,
334// and gtk_tree_model_foreach() returns.
335func (x *TreeModelSort) Foreach(FuncVar *TreeModelForeachFunc, UserDataVar uintptr) {
336
337	XGtkTreeModelForeach(x.GoPointer(), glib.NewCallback(FuncVar), UserDataVar)
338
339}
340
341// Gets the value of one or more cells in the row referenced by @iter.
342//
343// The variable argument list should contain integer column numbers,
344// each column number followed by a place to store the value being
345// retrieved.  The list is terminated by a -1. For example, to get a
346// value from column 0 with type %G_TYPE_STRING, you would
347// write: `gtk_tree_model_get (model, iter, 0, &place_string_here, -1)`,
348// where `place_string_here` is a #gchararray
349// to be filled with the string.
350//
351// Returned values with type %G_TYPE_OBJECT have to be unreferenced,
352// values with type %G_TYPE_STRING or %G_TYPE_BOXED have to be freed.
353// Other values are passed by value.
354func (x *TreeModelSort) Get(IterVar *TreeIter, varArgs ...interface{}) {
355
356	XGtkTreeModelGet(x.GoPointer(), IterVar, varArgs...)
357
358}
359
360// Returns the type of the column.
361func (x *TreeModelSort) GetColumnType(IndexVar int) types.GType {
362
363	cret := XGtkTreeModelGetColumnType(x.GoPointer(), IndexVar)
364	return cret
365}
366
367// Returns a set of flags supported by this interface.
368//
369// The flags are a bitwise combination of `GtkTreeModel`Flags.
370// The flags supported should not change during the lifetime
371// of the @tree_model.
372func (x *TreeModelSort) GetFlags() TreeModelFlags {
373
374	cret := XGtkTreeModelGetFlags(x.GoPointer())
375	return cret
376}
377
378// Sets @iter to a valid iterator pointing to @path.
379//
380// If @path does not exist, @iter is set to an invalid
381// iterator and %FALSE is returned.
382func (x *TreeModelSort) GetIter(IterVar *TreeIter, PathVar *TreePath) bool {
383
384	cret := XGtkTreeModelGetIter(x.GoPointer(), IterVar, PathVar)
385	return cret
386}
387
388// Initializes @iter with the first iterator in the tree
389// (the one at the path "0").
390//
391// Returns %FALSE if the tree is empty, %TRUE otherwise.
392func (x *TreeModelSort) GetIterFirst(IterVar *TreeIter) bool {
393
394	cret := XGtkTreeModelGetIterFirst(x.GoPointer(), IterVar)
395	return cret
396}
397
398// Sets @iter to a valid iterator pointing to @path_string, if it
399// exists.
400//
401// Otherwise, @iter is left invalid and %FALSE is returned.
402func (x *TreeModelSort) GetIterFromString(IterVar *TreeIter, PathStringVar string) bool {
403
404	cret := XGtkTreeModelGetIterFromString(x.GoPointer(), IterVar, PathStringVar)
405	return cret
406}
407
408// Returns the number of columns supported by @tree_model.
409func (x *TreeModelSort) GetNColumns() int {
410
411	cret := XGtkTreeModelGetNColumns(x.GoPointer())
412	return cret
413}
414
415// Returns a newly-created `GtkTreePath` referenced by @iter.
416//
417// This path should be freed with gtk_tree_path_free().
418func (x *TreeModelSort) GetPath(IterVar *TreeIter) *TreePath {
419
420	cret := XGtkTreeModelGetPath(x.GoPointer(), IterVar)
421	return cret
422}
423
424// Generates a string representation of the iter.
425//
426// This string is a “:” separated list of numbers.
427// For example, “4:10:0:3” would be an acceptable
428// return value for this string.
429func (x *TreeModelSort) GetStringFromIter(IterVar *TreeIter) string {
430
431	cret := XGtkTreeModelGetStringFromIter(x.GoPointer(), IterVar)
432	return cret
433}
434
435// Gets the value of one or more cells in the row referenced by @iter.
436//
437// See [method@Gtk.TreeModel.get], this version takes a va_list
438// for language bindings to use.
439func (x *TreeModelSort) GetValist(IterVar *TreeIter, VarArgsVar []interface{}) {
440
441	XGtkTreeModelGetValist(x.GoPointer(), IterVar, VarArgsVar)
442
443}
444
445// Initializes and sets @value to that at @column.
446//
447// When done with @value, g_value_unset() needs to be called
448// to free any allocated memory.
449func (x *TreeModelSort) GetValue(IterVar *TreeIter, ColumnVar int, ValueVar *gobject.Value) {
450
451	XGtkTreeModelGetValue(x.GoPointer(), IterVar, ColumnVar, ValueVar)
452
453}
454
455// Sets @iter to point to the first child of @parent.
456//
457// If @parent has no children, %FALSE is returned and @iter is
458// set to be invalid. @parent will remain a valid node after this
459// function has been called.
460//
461// If @parent is %NULL returns the first node, equivalent to
462// `gtk_tree_model_get_iter_first (tree_model, iter);`
463func (x *TreeModelSort) IterChildren(IterVar *TreeIter, ParentVar *TreeIter) bool {
464
465	cret := XGtkTreeModelIterChildren(x.GoPointer(), IterVar, ParentVar)
466	return cret
467}
468
469// Returns %TRUE if @iter has children, %FALSE otherwise.
470func (x *TreeModelSort) IterHasChild(IterVar *TreeIter) bool {
471
472	cret := XGtkTreeModelIterHasChild(x.GoPointer(), IterVar)
473	return cret
474}
475
476// Returns the number of children that @iter has.
477//
478// As a special case, if @iter is %NULL, then the number
479// of toplevel nodes is returned.
480func (x *TreeModelSort) IterNChildren(IterVar *TreeIter) int {
481
482	cret := XGtkTreeModelIterNChildren(x.GoPointer(), IterVar)
483	return cret
484}
485
486// Sets @iter to point to the node following it at the current level.
487//
488// If there is no next @iter, %FALSE is returned and @iter is set
489// to be invalid.
490func (x *TreeModelSort) IterNext(IterVar *TreeIter) bool {
491
492	cret := XGtkTreeModelIterNext(x.GoPointer(), IterVar)
493	return cret
494}
495
496// Sets @iter to be the child of @parent, using the given index.
497//
498// The first index is 0. If @n is too big, or @parent has no children,
499// @iter is set to an invalid iterator and %FALSE is returned. @parent
500// will remain a valid node after this function has been called. As a
501// special case, if @parent is %NULL, then the @n-th root node
502// is set.
503func (x *TreeModelSort) IterNthChild(IterVar *TreeIter, ParentVar *TreeIter, NVar int) bool {
504
505	cret := XGtkTreeModelIterNthChild(x.GoPointer(), IterVar, ParentVar, NVar)
506	return cret
507}
508
509// Sets @iter to be the parent of @child.
510//
511// If @child is at the toplevel, and doesn’t have a parent, then
512// @iter is set to an invalid iterator and %FALSE is returned.
513// @child will remain a valid node after this function has been
514// called.
515//
516// @iter will be initialized before the lookup is performed, so @child
517// and @iter cannot point to the same memory location.
518func (x *TreeModelSort) IterParent(IterVar *TreeIter, ChildVar *TreeIter) bool {
519
520	cret := XGtkTreeModelIterParent(x.GoPointer(), IterVar, ChildVar)
521	return cret
522}
523
524// Sets @iter to point to the previous node at the current level.
525//
526// If there is no previous @iter, %FALSE is returned and @iter is
527// set to be invalid.
528func (x *TreeModelSort) IterPrevious(IterVar *TreeIter) bool {
529
530	cret := XGtkTreeModelIterPrevious(x.GoPointer(), IterVar)
531	return cret
532}
533
534// Lets the tree ref the node.
535//
536// This is an optional method for models to implement.
537// To be more specific, models may ignore this call as it exists
538// primarily for performance reasons.
539//
540// This function is primarily meant as a way for views to let
541// caching models know when nodes are being displayed (and hence,
542// whether or not to cache that node). Being displayed means a node
543// is in an expanded branch, regardless of whether the node is currently
544// visible in the viewport. For example, a file-system based model
545// would not want to keep the entire file-hierarchy in memory,
546// just the sections that are currently being displayed by
547// every current view.
548//
549// A model should be expected to be able to get an iter independent
550// of its reffed state.
551func (x *TreeModelSort) RefNode(IterVar *TreeIter) {
552
553	XGtkTreeModelRefNode(x.GoPointer(), IterVar)
554
555}
556
557// Emits the ::row-changed signal on @tree_model.
558//
559// See [signal@Gtk.TreeModel::row-changed].
560func (x *TreeModelSort) RowChanged(PathVar *TreePath, IterVar *TreeIter) {
561
562	XGtkTreeModelRowChanged(x.GoPointer(), PathVar, IterVar)
563
564}
565
566// Emits the ::row-deleted signal on @tree_model.
567//
568// See [signal@Gtk.TreeModel::row-deleted].
569//
570// This should be called by models after a row has been removed.
571// The location pointed to by @path should be the location that
572// the row previously was at. It may not be a valid location anymore.
573//
574// Nodes that are deleted are not unreffed, this means that any
575// outstanding references on the deleted node should not be released.
576func (x *TreeModelSort) RowDeleted(PathVar *TreePath) {
577
578	XGtkTreeModelRowDeleted(x.GoPointer(), PathVar)
579
580}
581
582// Emits the ::row-has-child-toggled signal on @tree_model.
583//
584// See [signal@Gtk.TreeModel::row-has-child-toggled].
585//
586// This should be called by models after the child
587// state of a node changes.
588func (x *TreeModelSort) RowHasChildToggled(PathVar *TreePath, IterVar *TreeIter) {
589
590	XGtkTreeModelRowHasChildToggled(x.GoPointer(), PathVar, IterVar)
591
592}
593
594// Emits the ::row-inserted signal on @tree_model.
595//
596// See [signal@Gtk.TreeModel::row-inserted].
597func (x *TreeModelSort) RowInserted(PathVar *TreePath, IterVar *TreeIter) {
598
599	XGtkTreeModelRowInserted(x.GoPointer(), PathVar, IterVar)
600
601}
602
603// Emits the ::rows-reordered signal on @tree_model.
604//
605// See [signal@Gtk.TreeModel::rows-reordered].
606//
607// This should be called by models when their rows have been
608// reordered.
609func (x *TreeModelSort) RowsReordered(PathVar *TreePath, IterVar *TreeIter, NewOrderVar int) {
610
611	XGtkTreeModelRowsReordered(x.GoPointer(), PathVar, IterVar, NewOrderVar)
612
613}
614
615// Emits the ::rows-reordered signal on @tree_model.
616//
617// See [signal@Gtk.TreeModel::rows-reordered].
618//
619// This should be called by models when their rows have been
620// reordered.
621func (x *TreeModelSort) RowsReorderedWithLength(PathVar *TreePath, IterVar *TreeIter, NewOrderVar []int, LengthVar int) {
622
623	XGtkTreeModelRowsReorderedWithLength(x.GoPointer(), PathVar, IterVar, NewOrderVar, LengthVar)
624
625}
626
627// Lets the tree unref the node.
628//
629// This is an optional method for models to implement.
630// To be more specific, models may ignore this call as it exists
631// primarily for performance reasons. For more information on what
632// this means, see gtk_tree_model_ref_node().
633//
634// Please note that nodes that are deleted are not unreffed.
635func (x *TreeModelSort) UnrefNode(IterVar *TreeIter) {
636
637	XGtkTreeModelUnrefNode(x.GoPointer(), IterVar)
638
639}
640
641// Fills in @sort_column_id and @order with the current sort column and the
642// order. It returns %TRUE unless the @sort_column_id is
643// %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID or
644// %GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID.
645func (x *TreeModelSort) GetSortColumnId(SortColumnIdVar *int, OrderVar *SortType) bool {
646
647	cret := XGtkTreeSortableGetSortColumnId(x.GoPointer(), SortColumnIdVar, OrderVar)
648	return cret
649}
650
651// Returns %TRUE if the model has a default sort function. This is used
652// primarily by GtkTreeViewColumns in order to determine if a model can
653// go back to the default state, or not.
654func (x *TreeModelSort) HasDefaultSortFunc() bool {
655
656	cret := XGtkTreeSortableHasDefaultSortFunc(x.GoPointer())
657	return cret
658}
659
660// Sets the default comparison function used when sorting to be @sort_func.
661// If the current sort column id of @sortable is
662// %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, then the model will sort using
663// this function.
664//
665// If @sort_func is %NULL, then there will be no default comparison function.
666// This means that once the model  has been sorted, it can’t go back to the
667// default state. In this case, when the current sort column id of @sortable
668// is %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted.
669func (x *TreeModelSort) SetDefaultSortFunc(SortFuncVar *TreeIterCompareFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) {
670
671	XGtkTreeSortableSetDefaultSortFunc(x.GoPointer(), glib.NewCallback(SortFuncVar), UserDataVar, glib.NewCallbackNullable(DestroyVar))
672
673}
674
675// Sets the current sort column to be @sort_column_id. The @sortable will
676// resort itself to reflect this change, after emitting a
677// `GtkTreeSortable::sort-column-changed` signal. @sort_column_id may either be
678// a regular column id, or one of the following special values:
679//
680//   - %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID: the default sort function
681//     will be used, if it is set
682//
683// - %GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID: no sorting will occur
684func (x *TreeModelSort) SetSortColumnId(SortColumnIdVar int, OrderVar SortType) {
685
686	XGtkTreeSortableSetSortColumnId(x.GoPointer(), SortColumnIdVar, OrderVar)
687
688}
689
690// Sets the comparison function used when sorting to be @sort_func. If the
691// current sort column id of @sortable is the same as @sort_column_id, then
692// the model will sort using this function.
693func (x *TreeModelSort) SetSortFunc(SortColumnIdVar int, SortFuncVar *TreeIterCompareFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) {
694
695	XGtkTreeSortableSetSortFunc(x.GoPointer(), SortColumnIdVar, glib.NewCallback(SortFuncVar), UserDataVar, glib.NewCallbackNullable(DestroyVar))
696
697}
698
699// Emits a `GtkTreeSortable::sort-column-changed` signal on @sortable.
700func (x *TreeModelSort) SortColumnChanged() {
701
702	XGtkTreeSortableSortColumnChanged(x.GoPointer())
703
704}
705
706func init() {
707	core.SetPackageName("GTK", "gtk4")
708	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
709	var libs []uintptr
710	for _, libPath := range core.GetPaths("GTK") {
711		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
712		if err != nil {
713			panic(err)
714		}
715		libs = append(libs, lib)
716	}
717
718	core.PuregoSafeRegister(&xTreeModelSortGLibType, libs, "gtk_tree_model_sort_get_type")
719
720	core.PuregoSafeRegister(&xNewTreeModelSortWithModel, libs, "gtk_tree_model_sort_new_with_model")
721
722	core.PuregoSafeRegister(&xTreeModelSortClearCache, libs, "gtk_tree_model_sort_clear_cache")
723	core.PuregoSafeRegister(&xTreeModelSortConvertChildIterToIter, libs, "gtk_tree_model_sort_convert_child_iter_to_iter")
724	core.PuregoSafeRegister(&xTreeModelSortConvertChildPathToPath, libs, "gtk_tree_model_sort_convert_child_path_to_path")
725	core.PuregoSafeRegister(&xTreeModelSortConvertIterToChildIter, libs, "gtk_tree_model_sort_convert_iter_to_child_iter")
726	core.PuregoSafeRegister(&xTreeModelSortConvertPathToChildPath, libs, "gtk_tree_model_sort_convert_path_to_child_path")
727	core.PuregoSafeRegister(&xTreeModelSortGetModel, libs, "gtk_tree_model_sort_get_model")
728	core.PuregoSafeRegister(&xTreeModelSortIterIsValid, libs, "gtk_tree_model_sort_iter_is_valid")
729	core.PuregoSafeRegister(&xTreeModelSortResetDefaultSortFunc, libs, "gtk_tree_model_sort_reset_default_sort_func")
730
731}

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