1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/ebitengine/purego"
9
10 "github.com/bnema/puregotk/pkg/core"
11 "github.com/bnema/puregotk/v4/gio"
12 "github.com/bnema/puregotk/v4/gobject"
13 "github.com/bnema/puregotk/v4/gobject/types"
14)
15
16type ColumnViewColumnClass struct {
17 _ structs.HostLayout
18}
19
20func (x *ColumnViewColumnClass) GoPointer() uintptr {
21 return uintptr(unsafe.Pointer(x))
22}
23
24// Represents the columns in a `GtkColumnView`.
25//
26// The main ingredient for a `GtkColumnViewColumn` is the `GtkListItemFactory`
27// that tells the columnview how to create cells for this column from items in
28// the model.
29//
30// Columns have a title, and can optionally have a header menu set
31// with [method@Gtk.ColumnViewColumn.set_header_menu].
32//
33// A sorter can be associated with a column using
34// [method@Gtk.ColumnViewColumn.set_sorter], to let users influence sorting
35// by clicking on the column header.
36type ColumnViewColumn struct {
37 gobject.Object
38}
39
40var xColumnViewColumnGLibType func() types.GType
41
42func ColumnViewColumnGLibType() types.GType {
43 return xColumnViewColumnGLibType()
44}
45
46func ColumnViewColumnNewFromInternalPtr(ptr uintptr) *ColumnViewColumn {
47 cls := &ColumnViewColumn{}
48 cls.Ptr = ptr
49 return cls
50}
51
52var xNewColumnViewColumn func(uintptr, uintptr) uintptr
53
54// Creates a new `GtkColumnViewColumn` that uses the given @factory for
55// mapping items to widgets.
56//
57// You most likely want to call [method@Gtk.ColumnView.append_column] next.
58//
59// The function takes ownership of the argument, so you can write code like:
60//
61// ```c
62// column = gtk_column_view_column_new (_("Name"),
63//
64// gtk_builder_list_item_factory_new_from_resource ("/name.ui"));
65//
66// ```
67func NewColumnViewColumn(TitleVar *string, FactoryVar *ListItemFactory) *ColumnViewColumn {
68 var cls *ColumnViewColumn
69
70 TitleVarPtr := core.GStrdupNullable(TitleVar)
71 defer core.GFreeNullable(TitleVarPtr)
72
73 cret := xNewColumnViewColumn(TitleVarPtr, FactoryVar.GoPointer())
74
75 if cret == 0 {
76 return nil
77 }
78 cls = &ColumnViewColumn{}
79 cls.Ptr = cret
80 return cls
81}
82
83var xColumnViewColumnGetColumnView func(uintptr) uintptr
84
85// Gets the column view that's currently displaying this column.
86//
87// If @self has not been added to a column view yet, `NULL` is returned.
88func (x *ColumnViewColumn) GetColumnView() *ColumnView {
89 var cls *ColumnView
90
91 cret := xColumnViewColumnGetColumnView(x.GoPointer())
92
93 if cret == 0 {
94 return nil
95 }
96 gobject.IncreaseRef(cret)
97 cls = &ColumnView{}
98 cls.Ptr = cret
99 return cls
100}
101
102var xColumnViewColumnGetExpand func(uintptr) bool
103
104// Returns whether this column should expand.
105func (x *ColumnViewColumn) GetExpand() bool {
106
107 cret := xColumnViewColumnGetExpand(x.GoPointer())
108 return cret
109}
110
111var xColumnViewColumnGetFactory func(uintptr) uintptr
112
113// Gets the factory that's currently used to populate list items
114// for this column.
115func (x *ColumnViewColumn) GetFactory() *ListItemFactory {
116 var cls *ListItemFactory
117
118 cret := xColumnViewColumnGetFactory(x.GoPointer())
119
120 if cret == 0 {
121 return nil
122 }
123 gobject.IncreaseRef(cret)
124 cls = &ListItemFactory{}
125 cls.Ptr = cret
126 return cls
127}
128
129var xColumnViewColumnGetFixedWidth func(uintptr) int
130
131// Gets the fixed width of the column.
132func (x *ColumnViewColumn) GetFixedWidth() int {
133
134 cret := xColumnViewColumnGetFixedWidth(x.GoPointer())
135 return cret
136}
137
138var xColumnViewColumnGetHeaderMenu func(uintptr) uintptr
139
140// Gets the menu model that is used to create the context menu
141// for the column header.
142func (x *ColumnViewColumn) GetHeaderMenu() *gio.MenuModel {
143 var cls *gio.MenuModel
144
145 cret := xColumnViewColumnGetHeaderMenu(x.GoPointer())
146
147 if cret == 0 {
148 return nil
149 }
150 gobject.IncreaseRef(cret)
151 cls = &gio.MenuModel{}
152 cls.Ptr = cret
153 return cls
154}
155
156var xColumnViewColumnGetId func(uintptr) string
157
158// Returns the ID set with [method@Gtk.ColumnViewColumn.set_id].
159func (x *ColumnViewColumn) GetId() string {
160
161 cret := xColumnViewColumnGetId(x.GoPointer())
162 return cret
163}
164
165var xColumnViewColumnGetResizable func(uintptr) bool
166
167// Returns whether this column is resizable.
168func (x *ColumnViewColumn) GetResizable() bool {
169
170 cret := xColumnViewColumnGetResizable(x.GoPointer())
171 return cret
172}
173
174var xColumnViewColumnGetSorter func(uintptr) uintptr
175
176// Returns the sorter that is associated with the column.
177func (x *ColumnViewColumn) GetSorter() *Sorter {
178 var cls *Sorter
179
180 cret := xColumnViewColumnGetSorter(x.GoPointer())
181
182 if cret == 0 {
183 return nil
184 }
185 gobject.IncreaseRef(cret)
186 cls = &Sorter{}
187 cls.Ptr = cret
188 return cls
189}
190
191var xColumnViewColumnGetTitle func(uintptr) string
192
193// Returns the title set with [method@Gtk.ColumnViewColumn.set_title].
194func (x *ColumnViewColumn) GetTitle() string {
195
196 cret := xColumnViewColumnGetTitle(x.GoPointer())
197 return cret
198}
199
200var xColumnViewColumnGetVisible func(uintptr) bool
201
202// Returns whether this column is visible.
203func (x *ColumnViewColumn) GetVisible() bool {
204
205 cret := xColumnViewColumnGetVisible(x.GoPointer())
206 return cret
207}
208
209var xColumnViewColumnSetExpand func(uintptr, bool)
210
211// Sets the column to take available extra space.
212//
213// The extra space is shared equally amongst all columns that
214// have are set to expand.
215func (x *ColumnViewColumn) SetExpand(ExpandVar bool) {
216
217 xColumnViewColumnSetExpand(x.GoPointer(), ExpandVar)
218
219}
220
221var xColumnViewColumnSetFactory func(uintptr, uintptr)
222
223// Sets the `GtkListItemFactory` to use for populating list items
224// for this column.
225func (x *ColumnViewColumn) SetFactory(FactoryVar *ListItemFactory) {
226
227 xColumnViewColumnSetFactory(x.GoPointer(), FactoryVar.GoPointer())
228
229}
230
231var xColumnViewColumnSetFixedWidth func(uintptr, int)
232
233// Sets the fixed width of the column.
234//
235// If @fixed_width is -1, the fixed width of the column is unset.
236//
237// Setting a fixed width overrides the automatically calculated
238// width. Interactive resizing also sets the “fixed-width” property.
239func (x *ColumnViewColumn) SetFixedWidth(FixedWidthVar int) {
240
241 xColumnViewColumnSetFixedWidth(x.GoPointer(), FixedWidthVar)
242
243}
244
245var xColumnViewColumnSetHeaderMenu func(uintptr, uintptr)
246
247// Sets the menu model that is used to create the context menu
248// for the column header.
249func (x *ColumnViewColumn) SetHeaderMenu(MenuVar *gio.MenuModel) {
250
251 xColumnViewColumnSetHeaderMenu(x.GoPointer(), MenuVar.GoPointer())
252
253}
254
255var xColumnViewColumnSetId func(uintptr, uintptr)
256
257// Sets the id of this column.
258//
259// GTK makes no use of this, but applications can use it when
260// storing column view configuration.
261//
262// It is up to callers to ensure uniqueness of IDs.
263func (x *ColumnViewColumn) SetId(IdVar *string) {
264
265 IdVarPtr := core.GStrdupNullable(IdVar)
266 defer core.GFreeNullable(IdVarPtr)
267
268 xColumnViewColumnSetId(x.GoPointer(), IdVarPtr)
269
270}
271
272var xColumnViewColumnSetResizable func(uintptr, bool)
273
274// Sets whether this column should be resizable by dragging.
275func (x *ColumnViewColumn) SetResizable(ResizableVar bool) {
276
277 xColumnViewColumnSetResizable(x.GoPointer(), ResizableVar)
278
279}
280
281var xColumnViewColumnSetSorter func(uintptr, uintptr)
282
283// Associates a sorter with the column.
284//
285// If @sorter is unset, the column will not let users change
286// the sorting by clicking on its header.
287//
288// This sorter can be made active by clicking on the column
289// header, or by calling [method@Gtk.ColumnView.sort_by_column].
290//
291// See [method@Gtk.ColumnView.get_sorter] for the necessary steps
292// for setting up customizable sorting for [class@Gtk.ColumnView].
293func (x *ColumnViewColumn) SetSorter(SorterVar *Sorter) {
294
295 xColumnViewColumnSetSorter(x.GoPointer(), SorterVar.GoPointer())
296
297}
298
299var xColumnViewColumnSetTitle func(uintptr, uintptr)
300
301// Sets the title of this column.
302//
303// The title is displayed in the header of a `GtkColumnView`
304// for this column and is therefore user-facing text that should
305// be translated.
306func (x *ColumnViewColumn) SetTitle(TitleVar *string) {
307
308 TitleVarPtr := core.GStrdupNullable(TitleVar)
309 defer core.GFreeNullable(TitleVarPtr)
310
311 xColumnViewColumnSetTitle(x.GoPointer(), TitleVarPtr)
312
313}
314
315var xColumnViewColumnSetVisible func(uintptr, bool)
316
317// Sets whether this column should be visible in views.
318func (x *ColumnViewColumn) SetVisible(VisibleVar bool) {
319
320 xColumnViewColumnSetVisible(x.GoPointer(), VisibleVar)
321
322}
323
324func (c *ColumnViewColumn) GoPointer() uintptr {
325 if c == nil {
326 return 0
327 }
328 return c.Ptr
329}
330
331func (c *ColumnViewColumn) SetGoPointer(ptr uintptr) {
332 c.Ptr = ptr
333}
334
335// SetPropertyExpand sets the "expand" property.
336// Column gets share of extra width allocated to the view.
337func (x *ColumnViewColumn) SetPropertyExpand(value bool) {
338 var v gobject.Value
339 v.Init(gobject.TypeBooleanVal)
340 v.SetBoolean(value)
341 x.SetProperty("expand", &v)
342}
343
344// GetPropertyExpand gets the "expand" property.
345// Column gets share of extra width allocated to the view.
346func (x *ColumnViewColumn) GetPropertyExpand() bool {
347 var v gobject.Value
348 x.GetProperty("expand", &v)
349 return v.GetBoolean()
350}
351
352// SetPropertyFixedWidth sets the "fixed-width" property.
353// If not -1, this is the width that the column is allocated,
354// regardless of the size of its content.
355func (x *ColumnViewColumn) SetPropertyFixedWidth(value int) {
356 var v gobject.Value
357 v.Init(gobject.TypeIntVal)
358 v.SetInt(value)
359 x.SetProperty("fixed-width", &v)
360}
361
362// GetPropertyFixedWidth gets the "fixed-width" property.
363// If not -1, this is the width that the column is allocated,
364// regardless of the size of its content.
365func (x *ColumnViewColumn) GetPropertyFixedWidth() int {
366 var v gobject.Value
367 x.GetProperty("fixed-width", &v)
368 return v.GetInt()
369}
370
371// SetPropertyId sets the "id" property.
372// An ID for the column.
373//
374// GTK is not currently using the ID for anything, but
375// it can be used by applications when saving column view
376// configurations.
377//
378// It is up to applications to ensure uniqueness of IDs.
379func (x *ColumnViewColumn) SetPropertyId(value string) {
380 var v gobject.Value
381 v.Init(gobject.TypeStringVal)
382 v.SetString(&value)
383 x.SetProperty("id", &v)
384}
385
386// GetPropertyId gets the "id" property.
387// An ID for the column.
388//
389// GTK is not currently using the ID for anything, but
390// it can be used by applications when saving column view
391// configurations.
392//
393// It is up to applications to ensure uniqueness of IDs.
394func (x *ColumnViewColumn) GetPropertyId() string {
395 var v gobject.Value
396 x.GetProperty("id", &v)
397 return v.GetString()
398}
399
400// SetPropertyResizable sets the "resizable" property.
401// Whether this column is resizable.
402func (x *ColumnViewColumn) SetPropertyResizable(value bool) {
403 var v gobject.Value
404 v.Init(gobject.TypeBooleanVal)
405 v.SetBoolean(value)
406 x.SetProperty("resizable", &v)
407}
408
409// GetPropertyResizable gets the "resizable" property.
410// Whether this column is resizable.
411func (x *ColumnViewColumn) GetPropertyResizable() bool {
412 var v gobject.Value
413 x.GetProperty("resizable", &v)
414 return v.GetBoolean()
415}
416
417// SetPropertyTitle sets the "title" property.
418// Title displayed in the header.
419func (x *ColumnViewColumn) SetPropertyTitle(value string) {
420 var v gobject.Value
421 v.Init(gobject.TypeStringVal)
422 v.SetString(&value)
423 x.SetProperty("title", &v)
424}
425
426// GetPropertyTitle gets the "title" property.
427// Title displayed in the header.
428func (x *ColumnViewColumn) GetPropertyTitle() string {
429 var v gobject.Value
430 x.GetProperty("title", &v)
431 return v.GetString()
432}
433
434// SetPropertyVisible sets the "visible" property.
435// Whether this column is visible.
436func (x *ColumnViewColumn) SetPropertyVisible(value bool) {
437 var v gobject.Value
438 v.Init(gobject.TypeBooleanVal)
439 v.SetBoolean(value)
440 x.SetProperty("visible", &v)
441}
442
443// GetPropertyVisible gets the "visible" property.
444// Whether this column is visible.
445func (x *ColumnViewColumn) GetPropertyVisible() bool {
446 var v gobject.Value
447 x.GetProperty("visible", &v)
448 return v.GetBoolean()
449}
450
451func init() {
452 core.SetPackageName("GTK", "gtk4")
453 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
454 var libs []uintptr
455 for _, libPath := range core.GetPaths("GTK") {
456 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
457 if err != nil {
458 panic(err)
459 }
460 libs = append(libs, lib)
461 }
462
463 core.PuregoSafeRegister(&xColumnViewColumnGLibType, libs, "gtk_column_view_column_get_type")
464
465 core.PuregoSafeRegister(&xNewColumnViewColumn, libs, "gtk_column_view_column_new")
466
467 core.PuregoSafeRegister(&xColumnViewColumnGetColumnView, libs, "gtk_column_view_column_get_column_view")
468 core.PuregoSafeRegister(&xColumnViewColumnGetExpand, libs, "gtk_column_view_column_get_expand")
469 core.PuregoSafeRegister(&xColumnViewColumnGetFactory, libs, "gtk_column_view_column_get_factory")
470 core.PuregoSafeRegister(&xColumnViewColumnGetFixedWidth, libs, "gtk_column_view_column_get_fixed_width")
471 core.PuregoSafeRegister(&xColumnViewColumnGetHeaderMenu, libs, "gtk_column_view_column_get_header_menu")
472 core.PuregoSafeRegister(&xColumnViewColumnGetId, libs, "gtk_column_view_column_get_id")
473 core.PuregoSafeRegister(&xColumnViewColumnGetResizable, libs, "gtk_column_view_column_get_resizable")
474 core.PuregoSafeRegister(&xColumnViewColumnGetSorter, libs, "gtk_column_view_column_get_sorter")
475 core.PuregoSafeRegister(&xColumnViewColumnGetTitle, libs, "gtk_column_view_column_get_title")
476 core.PuregoSafeRegister(&xColumnViewColumnGetVisible, libs, "gtk_column_view_column_get_visible")
477 core.PuregoSafeRegister(&xColumnViewColumnSetExpand, libs, "gtk_column_view_column_set_expand")
478 core.PuregoSafeRegister(&xColumnViewColumnSetFactory, libs, "gtk_column_view_column_set_factory")
479 core.PuregoSafeRegister(&xColumnViewColumnSetFixedWidth, libs, "gtk_column_view_column_set_fixed_width")
480 core.PuregoSafeRegister(&xColumnViewColumnSetHeaderMenu, libs, "gtk_column_view_column_set_header_menu")
481 core.PuregoSafeRegister(&xColumnViewColumnSetId, libs, "gtk_column_view_column_set_id")
482 core.PuregoSafeRegister(&xColumnViewColumnSetResizable, libs, "gtk_column_view_column_set_resizable")
483 core.PuregoSafeRegister(&xColumnViewColumnSetSorter, libs, "gtk_column_view_column_set_sorter")
484 core.PuregoSafeRegister(&xColumnViewColumnSetTitle, libs, "gtk_column_view_column_set_title")
485 core.PuregoSafeRegister(&xColumnViewColumnSetVisible, libs, "gtk_column_view_column_set_visible")
486
487}