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/gobject"
12 "github.com/bnema/puregotk/v4/gobject/types"
13)
14
15type ColumnViewSorterClass struct {
16 _ structs.HostLayout
17
18 ParentClass SorterClass
19}
20
21func (x *ColumnViewSorterClass) GoPointer() uintptr {
22 return uintptr(unsafe.Pointer(x))
23}
24
25// Sorts [class@Gtk.ColumnView] columns.
26//
27// The sorter returned by [method@Gtk.ColumnView.get_sorter] is
28// a `GtkColumnViewSorter`.
29//
30// In column views, sorting can be configured by associating
31// sorters with columns, and users can invert sort order by clicking
32// on column headers. The API of `GtkColumnViewSorter` is designed
33// to allow saving and restoring this configuration.
34//
35// If you are only interested in the primary sort column (i.e. the
36// column where a sort indicator is shown in the header), then
37// you can just look at [property@Gtk.ColumnViewSorter:primary-sort-column]
38// and [property@Gtk.ColumnViewSorter:primary-sort-order].
39//
40// If you want to store the full sort configuration, including
41// secondary sort columns that are used for tie breaking, then
42// you can use [method@Gtk.ColumnViewSorter.get_nth_sort_column].
43// To get notified about changes, use [signal@Gtk.Sorter::changed].
44//
45// To restore a saved sort configuration on a `GtkColumnView`,
46// use code like:
47//
48// ```
49// sorter = gtk_column_view_get_sorter (view);
50// for (i = gtk_column_view_sorter_get_n_sort_columns (sorter) - 1; i >= 0; i--)
51//
52// {
53// column = gtk_column_view_sorter_get_nth_sort_column (sorter, i, &order);
54// gtk_column_view_sort_by_column (view, column, order);
55// }
56//
57// ```
58type ColumnViewSorter struct {
59 Sorter
60}
61
62var xColumnViewSorterGLibType func() types.GType
63
64func ColumnViewSorterGLibType() types.GType {
65 return xColumnViewSorterGLibType()
66}
67
68func ColumnViewSorterNewFromInternalPtr(ptr uintptr) *ColumnViewSorter {
69 cls := &ColumnViewSorter{}
70 cls.Ptr = ptr
71 return cls
72}
73
74var xColumnViewSorterGetNSortColumns func(uintptr) uint
75
76// Returns the number of columns by which the sorter sorts.
77//
78// If the sorter of the primary sort column does not determine
79// a total order, then the secondary sorters are consulted to
80// break the ties.
81//
82// Use the [signal@Gtk.Sorter::changed] signal to get notified
83// when the number of sort columns changes.
84func (x *ColumnViewSorter) GetNSortColumns() uint {
85
86 cret := xColumnViewSorterGetNSortColumns(x.GoPointer())
87 return cret
88}
89
90var xColumnViewSorterGetNthSortColumn func(uintptr, uint, *SortType) uintptr
91
92// Gets the @position'th sort column and its associated sort order.
93//
94// Use the [signal@Gtk.Sorter::changed] signal to get notified
95// when sort columns change.
96func (x *ColumnViewSorter) GetNthSortColumn(PositionVar uint, SortOrderVar *SortType) *ColumnViewColumn {
97 var cls *ColumnViewColumn
98
99 cret := xColumnViewSorterGetNthSortColumn(x.GoPointer(), PositionVar, SortOrderVar)
100
101 if cret == 0 {
102 return nil
103 }
104 gobject.IncreaseRef(cret)
105 cls = &ColumnViewColumn{}
106 cls.Ptr = cret
107 return cls
108}
109
110var xColumnViewSorterGetPrimarySortColumn func(uintptr) uintptr
111
112// Returns the primary sort column.
113//
114// The primary sort column is the one that displays the triangle
115// in a column view header.
116func (x *ColumnViewSorter) GetPrimarySortColumn() *ColumnViewColumn {
117 var cls *ColumnViewColumn
118
119 cret := xColumnViewSorterGetPrimarySortColumn(x.GoPointer())
120
121 if cret == 0 {
122 return nil
123 }
124 gobject.IncreaseRef(cret)
125 cls = &ColumnViewColumn{}
126 cls.Ptr = cret
127 return cls
128}
129
130var xColumnViewSorterGetPrimarySortOrder func(uintptr) SortType
131
132// Returns the primary sort order.
133//
134// The primary sort order determines whether the triangle displayed
135// in the column view header of the primary sort column points upwards
136// or downwards.
137//
138// If there is no primary sort column, then this function returns
139// `GTK_SORT_ASCENDING`.
140func (x *ColumnViewSorter) GetPrimarySortOrder() SortType {
141
142 cret := xColumnViewSorterGetPrimarySortOrder(x.GoPointer())
143 return cret
144}
145
146func (c *ColumnViewSorter) GoPointer() uintptr {
147 if c == nil {
148 return 0
149 }
150 return c.Ptr
151}
152
153func (c *ColumnViewSorter) SetGoPointer(ptr uintptr) {
154 c.Ptr = ptr
155}
156
157func init() {
158 core.SetPackageName("GTK", "gtk4")
159 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
160 var libs []uintptr
161 for _, libPath := range core.GetPaths("GTK") {
162 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
163 if err != nil {
164 panic(err)
165 }
166 libs = append(libs, lib)
167 }
168
169 core.PuregoSafeRegister(&xColumnViewSorterGLibType, libs, "gtk_column_view_sorter_get_type")
170
171 core.PuregoSafeRegister(&xColumnViewSorterGetNSortColumns, libs, "gtk_column_view_sorter_get_n_sort_columns")
172 core.PuregoSafeRegister(&xColumnViewSorterGetNthSortColumn, libs, "gtk_column_view_sorter_get_nth_sort_column")
173 core.PuregoSafeRegister(&xColumnViewSorterGetPrimarySortColumn, libs, "gtk_column_view_sorter_get_primary_sort_column")
174 core.PuregoSafeRegister(&xColumnViewSorterGetPrimarySortOrder, libs, "gtk_column_view_sorter_get_primary_sort_order")
175
176}