1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "unsafe"
6
7 "github.com/ebitengine/purego"
8
9 "github.com/bnema/puregotk/pkg/core"
10 "github.com/bnema/puregotk/v4/glib"
11 "github.com/bnema/puregotk/v4/gobject"
12 "github.com/bnema/puregotk/v4/gobject/types"
13)
14
15// A function to set the properties of a cell instead of just using the
16// straight mapping between the cell and the model.
17//
18// This function is useful for customizing the cell renderer. For example,
19// a function might get an* integer from the @tree_model, and render it to
20// the “text” attribute of “cell” by converting it to its written equivalent.
21//
22// See also: gtk_tree_view_column_set_cell_data_func()
23type TreeCellDataFunc func(uintptr, uintptr, uintptr, *TreeIter, uintptr)
24
25// The sizing method the column uses to determine its width. Please note
26// that %GTK_TREE_VIEW_COLUMN_AUTOSIZE are inefficient for large views, and
27// can make columns appear choppy.
28type TreeViewColumnSizing int
29
30var xTreeViewColumnSizingGLibType func() types.GType
31
32func TreeViewColumnSizingGLibType() types.GType {
33 return xTreeViewColumnSizingGLibType()
34}
35
36const (
37
38 // Columns only get bigger in reaction to changes in the model
39 TreeViewColumnGrowOnlyValue TreeViewColumnSizing = 0
40 // Columns resize to be the optimal size every time the model changes.
41 TreeViewColumnAutosizeValue TreeViewColumnSizing = 1
42 // Columns are a fixed numbers of pixels wide.
43 TreeViewColumnFixedValue TreeViewColumnSizing = 2
44)
45
46// A visible column in a [class@Gtk.TreeView] widget
47//
48// The `GtkTreeViewColumn` object represents a visible column in a `GtkTreeView` widget.
49// It allows to set properties of the column header, and functions as a holding pen
50// for the cell renderers which determine how the data in the column is displayed.
51//
52// Please refer to the [tree widget conceptual overview](section-tree-widget.html)
53// for an overview of all the objects and data types related to the tree widget and
54// how they work together, and to the [class@Gtk.TreeView] documentation for specifics
55// about the CSS node structure for treeviews and their headers.
56type TreeViewColumn struct {
57 gobject.InitiallyUnowned
58}
59
60var xTreeViewColumnGLibType func() types.GType
61
62func TreeViewColumnGLibType() types.GType {
63 return xTreeViewColumnGLibType()
64}
65
66func TreeViewColumnNewFromInternalPtr(ptr uintptr) *TreeViewColumn {
67 cls := &TreeViewColumn{}
68 cls.Ptr = ptr
69 return cls
70}
71
72var xNewTreeViewColumn func() uintptr
73
74// Creates a new `GtkTreeViewColumn`.
75func NewTreeViewColumn() *TreeViewColumn {
76 var cls *TreeViewColumn
77
78 cret := xNewTreeViewColumn()
79
80 if cret == 0 {
81 return nil
82 }
83 gobject.IncreaseRef(cret)
84 cls = &TreeViewColumn{}
85 cls.Ptr = cret
86 return cls
87}
88
89var xNewTreeViewColumnWithArea func(uintptr) uintptr
90
91// Creates a new `GtkTreeViewColumn` using @area to render its cells.
92func NewTreeViewColumnWithArea(AreaVar *CellArea) *TreeViewColumn {
93 var cls *TreeViewColumn
94
95 cret := xNewTreeViewColumnWithArea(AreaVar.GoPointer())
96
97 if cret == 0 {
98 return nil
99 }
100 gobject.IncreaseRef(cret)
101 cls = &TreeViewColumn{}
102 cls.Ptr = cret
103 return cls
104}
105
106var xNewTreeViewColumnWithAttributes func(string, uintptr, ...interface{}) uintptr
107
108// Creates a new `GtkTreeViewColumn` with a number of default values.
109// This is equivalent to calling gtk_tree_view_column_set_title(),
110// gtk_tree_view_column_pack_start(), and
111// gtk_tree_view_column_set_attributes() on the newly created `GtkTreeViewColumn`.
112//
113// Here’s a simple example:
114//
115// ```c
116//
117// enum { TEXT_COLUMN, COLOR_COLUMN, N_COLUMNS };
118// // ...
119// {
120// GtkTreeViewColumn *column;
121// GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
122//
123// column = gtk_tree_view_column_new_with_attributes ("Title",
124// renderer,
125// "text", TEXT_COLUMN,
126// "foreground", COLOR_COLUMN,
127// NULL);
128// }
129//
130// ```
131func NewTreeViewColumnWithAttributes(TitleVar string, CellVar *CellRenderer, varArgs ...interface{}) *TreeViewColumn {
132 var cls *TreeViewColumn
133
134 cret := xNewTreeViewColumnWithAttributes(TitleVar, CellVar.GoPointer(), varArgs...)
135
136 if cret == 0 {
137 return nil
138 }
139 gobject.IncreaseRef(cret)
140 cls = &TreeViewColumn{}
141 cls.Ptr = cret
142 return cls
143}
144
145var xTreeViewColumnAddAttribute func(uintptr, uintptr, string, int)
146
147// Adds an attribute mapping to the list in @tree_column.
148//
149// The @column is the
150// column of the model to get a value from, and the @attribute is the
151// parameter on @cell_renderer to be set from the value. So for example
152// if column 2 of the model contains strings, you could have the
153// “text” attribute of a `GtkCellRendererText` get its values from
154// column 2.
155func (x *TreeViewColumn) AddAttribute(CellRendererVar *CellRenderer, AttributeVar string, ColumnVar int) {
156
157 xTreeViewColumnAddAttribute(x.GoPointer(), CellRendererVar.GoPointer(), AttributeVar, ColumnVar)
158
159}
160
161var xTreeViewColumnCellGetPosition func(uintptr, uintptr, *int, *int) bool
162
163// Obtains the horizontal position and size of a cell in a column.
164//
165// If the cell is not found in the column, @start_pos and @width
166// are not changed and %FALSE is returned.
167func (x *TreeViewColumn) CellGetPosition(CellRendererVar *CellRenderer, XOffsetVar *int, WidthVar *int) bool {
168
169 cret := xTreeViewColumnCellGetPosition(x.GoPointer(), CellRendererVar.GoPointer(), XOffsetVar, WidthVar)
170 return cret
171}
172
173var xTreeViewColumnCellGetSize func(uintptr, *int, *int, *int, *int)
174
175// Obtains the width and height needed to render the column. This is used
176// primarily by the `GtkTreeView`.
177func (x *TreeViewColumn) CellGetSize(XOffsetVar *int, YOffsetVar *int, WidthVar *int, HeightVar *int) {
178
179 xTreeViewColumnCellGetSize(x.GoPointer(), XOffsetVar, YOffsetVar, WidthVar, HeightVar)
180
181}
182
183var xTreeViewColumnCellIsVisible func(uintptr) bool
184
185// Returns %TRUE if any of the cells packed into the @tree_column are visible.
186// For this to be meaningful, you must first initialize the cells with
187// gtk_tree_view_column_cell_set_cell_data()
188func (x *TreeViewColumn) CellIsVisible() bool {
189
190 cret := xTreeViewColumnCellIsVisible(x.GoPointer())
191 return cret
192}
193
194var xTreeViewColumnCellSetCellData func(uintptr, uintptr, *TreeIter, bool, bool)
195
196// Sets the cell renderer based on the @tree_model and @iter. That is, for
197// every attribute mapping in @tree_column, it will get a value from the set
198// column on the @iter, and use that value to set the attribute on the cell
199// renderer. This is used primarily by the `GtkTreeView`.
200func (x *TreeViewColumn) CellSetCellData(TreeModelVar TreeModel, IterVar *TreeIter, IsExpanderVar bool, IsExpandedVar bool) {
201
202 xTreeViewColumnCellSetCellData(x.GoPointer(), TreeModelVar.GoPointer(), IterVar, IsExpanderVar, IsExpandedVar)
203
204}
205
206var xTreeViewColumnClear func(uintptr)
207
208// Unsets all the mappings on all renderers on the @tree_column.
209func (x *TreeViewColumn) Clear() {
210
211 xTreeViewColumnClear(x.GoPointer())
212
213}
214
215var xTreeViewColumnClearAttributes func(uintptr, uintptr)
216
217// Clears all existing attributes previously set with
218// gtk_tree_view_column_set_attributes().
219func (x *TreeViewColumn) ClearAttributes(CellRendererVar *CellRenderer) {
220
221 xTreeViewColumnClearAttributes(x.GoPointer(), CellRendererVar.GoPointer())
222
223}
224
225var xTreeViewColumnClicked func(uintptr)
226
227// Emits the “clicked” signal on the column. This function will only work if
228// @tree_column is clickable.
229func (x *TreeViewColumn) Clicked() {
230
231 xTreeViewColumnClicked(x.GoPointer())
232
233}
234
235var xTreeViewColumnFocusCell func(uintptr, uintptr)
236
237// Sets the current keyboard focus to be at @cell, if the column contains
238// 2 or more editable and activatable cells.
239func (x *TreeViewColumn) FocusCell(CellVar *CellRenderer) {
240
241 xTreeViewColumnFocusCell(x.GoPointer(), CellVar.GoPointer())
242
243}
244
245var xTreeViewColumnGetAlignment func(uintptr) float32
246
247// Returns the current x alignment of @tree_column. This value can range
248// between 0.0 and 1.0.
249func (x *TreeViewColumn) GetAlignment() float32 {
250
251 cret := xTreeViewColumnGetAlignment(x.GoPointer())
252 return cret
253}
254
255var xTreeViewColumnGetButton func(uintptr) uintptr
256
257// Returns the button used in the treeview column header
258func (x *TreeViewColumn) GetButton() *Widget {
259 var cls *Widget
260
261 cret := xTreeViewColumnGetButton(x.GoPointer())
262
263 if cret == 0 {
264 return nil
265 }
266 gobject.IncreaseRef(cret)
267 cls = &Widget{}
268 cls.Ptr = cret
269 return cls
270}
271
272var xTreeViewColumnGetClickable func(uintptr) bool
273
274// Returns %TRUE if the user can click on the header for the column.
275func (x *TreeViewColumn) GetClickable() bool {
276
277 cret := xTreeViewColumnGetClickable(x.GoPointer())
278 return cret
279}
280
281var xTreeViewColumnGetExpand func(uintptr) bool
282
283// Returns %TRUE if the column expands to fill available space.
284func (x *TreeViewColumn) GetExpand() bool {
285
286 cret := xTreeViewColumnGetExpand(x.GoPointer())
287 return cret
288}
289
290var xTreeViewColumnGetFixedWidth func(uintptr) int
291
292// Gets the fixed width of the column. This may not be the actual displayed
293// width of the column; for that, use gtk_tree_view_column_get_width().
294func (x *TreeViewColumn) GetFixedWidth() int {
295
296 cret := xTreeViewColumnGetFixedWidth(x.GoPointer())
297 return cret
298}
299
300var xTreeViewColumnGetMaxWidth func(uintptr) int
301
302// Returns the maximum width in pixels of the @tree_column, or -1 if no maximum
303// width is set.
304func (x *TreeViewColumn) GetMaxWidth() int {
305
306 cret := xTreeViewColumnGetMaxWidth(x.GoPointer())
307 return cret
308}
309
310var xTreeViewColumnGetMinWidth func(uintptr) int
311
312// Returns the minimum width in pixels of the @tree_column, or -1 if no minimum
313// width is set.
314func (x *TreeViewColumn) GetMinWidth() int {
315
316 cret := xTreeViewColumnGetMinWidth(x.GoPointer())
317 return cret
318}
319
320var xTreeViewColumnGetReorderable func(uintptr) bool
321
322// Returns %TRUE if the @tree_column can be reordered by the user.
323func (x *TreeViewColumn) GetReorderable() bool {
324
325 cret := xTreeViewColumnGetReorderable(x.GoPointer())
326 return cret
327}
328
329var xTreeViewColumnGetResizable func(uintptr) bool
330
331// Returns %TRUE if the @tree_column can be resized by the end user.
332func (x *TreeViewColumn) GetResizable() bool {
333
334 cret := xTreeViewColumnGetResizable(x.GoPointer())
335 return cret
336}
337
338var xTreeViewColumnGetSizing func(uintptr) TreeViewColumnSizing
339
340// Returns the current type of @tree_column.
341func (x *TreeViewColumn) GetSizing() TreeViewColumnSizing {
342
343 cret := xTreeViewColumnGetSizing(x.GoPointer())
344 return cret
345}
346
347var xTreeViewColumnGetSortColumnId func(uintptr) int
348
349// Gets the logical @sort_column_id that the model sorts on
350// when this column is selected for sorting.
351//
352// See [method@Gtk.TreeViewColumn.set_sort_column_id].
353func (x *TreeViewColumn) GetSortColumnId() int {
354
355 cret := xTreeViewColumnGetSortColumnId(x.GoPointer())
356 return cret
357}
358
359var xTreeViewColumnGetSortIndicator func(uintptr) bool
360
361// Gets the value set by gtk_tree_view_column_set_sort_indicator().
362func (x *TreeViewColumn) GetSortIndicator() bool {
363
364 cret := xTreeViewColumnGetSortIndicator(x.GoPointer())
365 return cret
366}
367
368var xTreeViewColumnGetSortOrder func(uintptr) SortType
369
370// Gets the value set by gtk_tree_view_column_set_sort_order().
371func (x *TreeViewColumn) GetSortOrder() SortType {
372
373 cret := xTreeViewColumnGetSortOrder(x.GoPointer())
374 return cret
375}
376
377var xTreeViewColumnGetSpacing func(uintptr) int
378
379// Returns the spacing of @tree_column.
380func (x *TreeViewColumn) GetSpacing() int {
381
382 cret := xTreeViewColumnGetSpacing(x.GoPointer())
383 return cret
384}
385
386var xTreeViewColumnGetTitle func(uintptr) string
387
388// Returns the title of the widget.
389func (x *TreeViewColumn) GetTitle() string {
390
391 cret := xTreeViewColumnGetTitle(x.GoPointer())
392 return cret
393}
394
395var xTreeViewColumnGetTreeView func(uintptr) uintptr
396
397// Returns the `GtkTreeView` wherein @tree_column has been inserted.
398// If @column is currently not inserted in any tree view, %NULL is
399// returned.
400func (x *TreeViewColumn) GetTreeView() *Widget {
401 var cls *Widget
402
403 cret := xTreeViewColumnGetTreeView(x.GoPointer())
404
405 if cret == 0 {
406 return nil
407 }
408 gobject.IncreaseRef(cret)
409 cls = &Widget{}
410 cls.Ptr = cret
411 return cls
412}
413
414var xTreeViewColumnGetVisible func(uintptr) bool
415
416// Returns %TRUE if @tree_column is visible.
417func (x *TreeViewColumn) GetVisible() bool {
418
419 cret := xTreeViewColumnGetVisible(x.GoPointer())
420 return cret
421}
422
423var xTreeViewColumnGetWidget func(uintptr) uintptr
424
425// Returns the `GtkWidget` in the button on the column header.
426//
427// If a custom widget has not been set then %NULL is returned.
428func (x *TreeViewColumn) GetWidget() *Widget {
429 var cls *Widget
430
431 cret := xTreeViewColumnGetWidget(x.GoPointer())
432
433 if cret == 0 {
434 return nil
435 }
436 gobject.IncreaseRef(cret)
437 cls = &Widget{}
438 cls.Ptr = cret
439 return cls
440}
441
442var xTreeViewColumnGetWidth func(uintptr) int
443
444// Returns the current size of @tree_column in pixels.
445func (x *TreeViewColumn) GetWidth() int {
446
447 cret := xTreeViewColumnGetWidth(x.GoPointer())
448 return cret
449}
450
451var xTreeViewColumnGetXOffset func(uintptr) int
452
453// Returns the current X offset of @tree_column in pixels.
454func (x *TreeViewColumn) GetXOffset() int {
455
456 cret := xTreeViewColumnGetXOffset(x.GoPointer())
457 return cret
458}
459
460var xTreeViewColumnPackEnd func(uintptr, uintptr, bool)
461
462// Adds the @cell to end of the column. If @expand is %FALSE, then the @cell
463// is allocated no more space than it needs. Any unused space is divided
464// evenly between cells for which @expand is %TRUE.
465func (x *TreeViewColumn) PackEnd(CellVar *CellRenderer, ExpandVar bool) {
466
467 xTreeViewColumnPackEnd(x.GoPointer(), CellVar.GoPointer(), ExpandVar)
468
469}
470
471var xTreeViewColumnPackStart func(uintptr, uintptr, bool)
472
473// Packs the @cell into the beginning of the column. If @expand is %FALSE, then
474// the @cell is allocated no more space than it needs. Any unused space is divided
475// evenly between cells for which @expand is %TRUE.
476func (x *TreeViewColumn) PackStart(CellVar *CellRenderer, ExpandVar bool) {
477
478 xTreeViewColumnPackStart(x.GoPointer(), CellVar.GoPointer(), ExpandVar)
479
480}
481
482var xTreeViewColumnQueueResize func(uintptr)
483
484// Flags the column, and the cell renderers added to this column, to have
485// their sizes renegotiated.
486func (x *TreeViewColumn) QueueResize() {
487
488 xTreeViewColumnQueueResize(x.GoPointer())
489
490}
491
492var xTreeViewColumnSetAlignment func(uintptr, float32)
493
494// Sets the alignment of the title or custom widget inside the column header.
495// The alignment determines its location inside the button -- 0.0 for left, 0.5
496// for center, 1.0 for right.
497func (x *TreeViewColumn) SetAlignment(XalignVar float32) {
498
499 xTreeViewColumnSetAlignment(x.GoPointer(), XalignVar)
500
501}
502
503var xTreeViewColumnSetAttributes func(uintptr, uintptr, ...interface{})
504
505// Sets the attributes in the list as the attributes of @tree_column.
506//
507// The attributes should be in attribute/column order, as in
508// gtk_tree_view_column_add_attribute(). All existing attributes
509// are removed, and replaced with the new attributes.
510func (x *TreeViewColumn) SetAttributes(CellRendererVar *CellRenderer, varArgs ...interface{}) {
511
512 xTreeViewColumnSetAttributes(x.GoPointer(), CellRendererVar.GoPointer(), varArgs...)
513
514}
515
516var xTreeViewColumnSetCellDataFunc func(uintptr, uintptr, uintptr, uintptr, uintptr)
517
518// Sets the `GtkTreeCellDataFunc` to use for the column.
519//
520// This
521// function is used instead of the standard attributes mapping for
522// setting the column value, and should set the value of @tree_column's
523// cell renderer as appropriate. @func may be %NULL to remove an
524// older one.
525func (x *TreeViewColumn) SetCellDataFunc(CellRendererVar *CellRenderer, FuncVar *TreeCellDataFunc, FuncDataVar uintptr, DestroyVar *glib.DestroyNotify) {
526
527 var FuncVarRef uintptr
528 if FuncVar != nil {
529 FuncVarPtr := uintptr(unsafe.Pointer(FuncVar))
530 if cbRefPtr, ok := glib.GetCallback(FuncVarPtr); ok {
531 FuncVarRef = cbRefPtr
532 } else {
533 fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr, arg3 *TreeIter, arg4 uintptr) {
534 cbFn := *FuncVar
535 cbFn(arg0, arg1, arg2, arg3, arg4)
536 }
537 FuncVarRef = purego.NewCallback(fcb)
538 glib.SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar)
539 }
540 }
541
542 var DestroyVarRef uintptr
543 if DestroyVar != nil {
544 DestroyVarPtr := uintptr(unsafe.Pointer(DestroyVar))
545 if cbRefPtr, ok := glib.GetCallback(DestroyVarPtr); ok {
546 DestroyVarRef = cbRefPtr
547 } else {
548 fcb := func(arg0 uintptr) {
549 cbFn := *DestroyVar
550 cbFn(arg0)
551 }
552 DestroyVarRef = purego.NewCallback(fcb)
553 glib.SaveCallbackWithClosure(DestroyVarPtr, DestroyVarRef, DestroyVar)
554 }
555 }
556
557 xTreeViewColumnSetCellDataFunc(x.GoPointer(), CellRendererVar.GoPointer(), FuncVarRef, FuncDataVar, DestroyVarRef)
558
559}
560
561var xTreeViewColumnSetClickable func(uintptr, bool)
562
563// Sets the header to be active if @clickable is %TRUE. When the header is
564// active, then it can take keyboard focus, and can be clicked.
565func (x *TreeViewColumn) SetClickable(ClickableVar bool) {
566
567 xTreeViewColumnSetClickable(x.GoPointer(), ClickableVar)
568
569}
570
571var xTreeViewColumnSetExpand func(uintptr, bool)
572
573// Sets the column to take available extra space. This space is shared equally
574// amongst all columns that have the expand set to %TRUE. If no column has this
575// option set, then the last column gets all extra space. By default, every
576// column is created with this %FALSE.
577//
578// Along with “fixed-width”, the “expand” property changes when the column is
579// resized by the user.
580func (x *TreeViewColumn) SetExpand(ExpandVar bool) {
581
582 xTreeViewColumnSetExpand(x.GoPointer(), ExpandVar)
583
584}
585
586var xTreeViewColumnSetFixedWidth func(uintptr, int)
587
588// If @fixed_width is not -1, sets the fixed width of @tree_column; otherwise
589// unsets it. The effective value of @fixed_width is clamped between the
590// minimum and maximum width of the column; however, the value stored in the
591// “fixed-width” property is not clamped. If the column sizing is
592// %GTK_TREE_VIEW_COLUMN_GROW_ONLY or %GTK_TREE_VIEW_COLUMN_AUTOSIZE, setting
593// a fixed width overrides the automatically calculated width. Note that
594// @fixed_width is only a hint to GTK; the width actually allocated to the
595// column may be greater or less than requested.
596//
597// Along with “expand”, the “fixed-width” property changes when the column is
598// resized by the user.
599func (x *TreeViewColumn) SetFixedWidth(FixedWidthVar int) {
600
601 xTreeViewColumnSetFixedWidth(x.GoPointer(), FixedWidthVar)
602
603}
604
605var xTreeViewColumnSetMaxWidth func(uintptr, int)
606
607// Sets the maximum width of the @tree_column. If @max_width is -1, then the
608// maximum width is unset. Note, the column can actually be wider than max
609// width if it’s the last column in a view. In this case, the column expands to
610// fill any extra space.
611func (x *TreeViewColumn) SetMaxWidth(MaxWidthVar int) {
612
613 xTreeViewColumnSetMaxWidth(x.GoPointer(), MaxWidthVar)
614
615}
616
617var xTreeViewColumnSetMinWidth func(uintptr, int)
618
619// Sets the minimum width of the @tree_column. If @min_width is -1, then the
620// minimum width is unset.
621func (x *TreeViewColumn) SetMinWidth(MinWidthVar int) {
622
623 xTreeViewColumnSetMinWidth(x.GoPointer(), MinWidthVar)
624
625}
626
627var xTreeViewColumnSetReorderable func(uintptr, bool)
628
629// If @reorderable is %TRUE, then the column can be reordered by the end user
630// dragging the header.
631func (x *TreeViewColumn) SetReorderable(ReorderableVar bool) {
632
633 xTreeViewColumnSetReorderable(x.GoPointer(), ReorderableVar)
634
635}
636
637var xTreeViewColumnSetResizable func(uintptr, bool)
638
639// If @resizable is %TRUE, then the user can explicitly resize the column by
640// grabbing the outer edge of the column button.
641//
642// If resizable is %TRUE and
643// sizing mode of the column is %GTK_TREE_VIEW_COLUMN_AUTOSIZE, then the sizing
644// mode is changed to %GTK_TREE_VIEW_COLUMN_GROW_ONLY.
645func (x *TreeViewColumn) SetResizable(ResizableVar bool) {
646
647 xTreeViewColumnSetResizable(x.GoPointer(), ResizableVar)
648
649}
650
651var xTreeViewColumnSetSizing func(uintptr, TreeViewColumnSizing)
652
653// Sets the growth behavior of @tree_column to @type.
654func (x *TreeViewColumn) SetSizing(TypeVar TreeViewColumnSizing) {
655
656 xTreeViewColumnSetSizing(x.GoPointer(), TypeVar)
657
658}
659
660var xTreeViewColumnSetSortColumnId func(uintptr, int)
661
662// Sets the logical @sort_column_id that this column sorts on when this column
663// is selected for sorting. Doing so makes the column header clickable.
664func (x *TreeViewColumn) SetSortColumnId(SortColumnIdVar int) {
665
666 xTreeViewColumnSetSortColumnId(x.GoPointer(), SortColumnIdVar)
667
668}
669
670var xTreeViewColumnSetSortIndicator func(uintptr, bool)
671
672// Call this function with a @setting of %TRUE to display an arrow in
673// the header button indicating the column is sorted. Call
674// gtk_tree_view_column_set_sort_order() to change the direction of
675// the arrow.
676func (x *TreeViewColumn) SetSortIndicator(SettingVar bool) {
677
678 xTreeViewColumnSetSortIndicator(x.GoPointer(), SettingVar)
679
680}
681
682var xTreeViewColumnSetSortOrder func(uintptr, SortType)
683
684// Changes the appearance of the sort indicator.
685//
686// This does not actually sort the model. Use
687// gtk_tree_view_column_set_sort_column_id() if you want automatic sorting
688// support. This function is primarily for custom sorting behavior, and should
689// be used in conjunction with gtk_tree_sortable_set_sort_column_id() to do
690// that. For custom models, the mechanism will vary.
691//
692// The sort indicator changes direction to indicate normal sort or reverse sort.
693// Note that you must have the sort indicator enabled to see anything when
694// calling this function; see gtk_tree_view_column_set_sort_indicator().
695func (x *TreeViewColumn) SetSortOrder(OrderVar SortType) {
696
697 xTreeViewColumnSetSortOrder(x.GoPointer(), OrderVar)
698
699}
700
701var xTreeViewColumnSetSpacing func(uintptr, int)
702
703// Sets the spacing field of @tree_column, which is the number of pixels to
704// place between cell renderers packed into it.
705func (x *TreeViewColumn) SetSpacing(SpacingVar int) {
706
707 xTreeViewColumnSetSpacing(x.GoPointer(), SpacingVar)
708
709}
710
711var xTreeViewColumnSetTitle func(uintptr, string)
712
713// Sets the title of the @tree_column. If a custom widget has been set, then
714// this value is ignored.
715func (x *TreeViewColumn) SetTitle(TitleVar string) {
716
717 xTreeViewColumnSetTitle(x.GoPointer(), TitleVar)
718
719}
720
721var xTreeViewColumnSetVisible func(uintptr, bool)
722
723// Sets the visibility of @tree_column.
724func (x *TreeViewColumn) SetVisible(VisibleVar bool) {
725
726 xTreeViewColumnSetVisible(x.GoPointer(), VisibleVar)
727
728}
729
730var xTreeViewColumnSetWidget func(uintptr, uintptr)
731
732// Sets the widget in the header to be @widget. If widget is %NULL, then the
733// header button is set with a `GtkLabel` set to the title of @tree_column.
734func (x *TreeViewColumn) SetWidget(WidgetVar *Widget) {
735
736 xTreeViewColumnSetWidget(x.GoPointer(), WidgetVar.GoPointer())
737
738}
739
740func (c *TreeViewColumn) GoPointer() uintptr {
741 if c == nil {
742 return 0
743 }
744 return c.Ptr
745}
746
747func (c *TreeViewColumn) SetGoPointer(ptr uintptr) {
748 c.Ptr = ptr
749}
750
751// SetPropertyAlignment sets the "alignment" property.
752func (x *TreeViewColumn) SetPropertyAlignment(value float32) {
753 var v gobject.Value
754 v.Init(gobject.TypeFloatVal)
755 v.SetFloat(value)
756 x.SetProperty("alignment", &v)
757}
758
759// GetPropertyAlignment gets the "alignment" property.
760func (x *TreeViewColumn) GetPropertyAlignment() float32 {
761 var v gobject.Value
762 x.GetProperty("alignment", &v)
763 return v.GetFloat()
764}
765
766// SetPropertyClickable sets the "clickable" property.
767func (x *TreeViewColumn) SetPropertyClickable(value bool) {
768 var v gobject.Value
769 v.Init(gobject.TypeBooleanVal)
770 v.SetBoolean(value)
771 x.SetProperty("clickable", &v)
772}
773
774// GetPropertyClickable gets the "clickable" property.
775func (x *TreeViewColumn) GetPropertyClickable() bool {
776 var v gobject.Value
777 x.GetProperty("clickable", &v)
778 return v.GetBoolean()
779}
780
781// SetPropertyExpand sets the "expand" property.
782func (x *TreeViewColumn) SetPropertyExpand(value bool) {
783 var v gobject.Value
784 v.Init(gobject.TypeBooleanVal)
785 v.SetBoolean(value)
786 x.SetProperty("expand", &v)
787}
788
789// GetPropertyExpand gets the "expand" property.
790func (x *TreeViewColumn) GetPropertyExpand() bool {
791 var v gobject.Value
792 x.GetProperty("expand", &v)
793 return v.GetBoolean()
794}
795
796// SetPropertyFixedWidth sets the "fixed-width" property.
797func (x *TreeViewColumn) SetPropertyFixedWidth(value int) {
798 var v gobject.Value
799 v.Init(gobject.TypeIntVal)
800 v.SetInt(value)
801 x.SetProperty("fixed-width", &v)
802}
803
804// GetPropertyFixedWidth gets the "fixed-width" property.
805func (x *TreeViewColumn) GetPropertyFixedWidth() int {
806 var v gobject.Value
807 x.GetProperty("fixed-width", &v)
808 return v.GetInt()
809}
810
811// SetPropertyMaxWidth sets the "max-width" property.
812func (x *TreeViewColumn) SetPropertyMaxWidth(value int) {
813 var v gobject.Value
814 v.Init(gobject.TypeIntVal)
815 v.SetInt(value)
816 x.SetProperty("max-width", &v)
817}
818
819// GetPropertyMaxWidth gets the "max-width" property.
820func (x *TreeViewColumn) GetPropertyMaxWidth() int {
821 var v gobject.Value
822 x.GetProperty("max-width", &v)
823 return v.GetInt()
824}
825
826// SetPropertyMinWidth sets the "min-width" property.
827func (x *TreeViewColumn) SetPropertyMinWidth(value int) {
828 var v gobject.Value
829 v.Init(gobject.TypeIntVal)
830 v.SetInt(value)
831 x.SetProperty("min-width", &v)
832}
833
834// GetPropertyMinWidth gets the "min-width" property.
835func (x *TreeViewColumn) GetPropertyMinWidth() int {
836 var v gobject.Value
837 x.GetProperty("min-width", &v)
838 return v.GetInt()
839}
840
841// SetPropertyReorderable sets the "reorderable" property.
842func (x *TreeViewColumn) SetPropertyReorderable(value bool) {
843 var v gobject.Value
844 v.Init(gobject.TypeBooleanVal)
845 v.SetBoolean(value)
846 x.SetProperty("reorderable", &v)
847}
848
849// GetPropertyReorderable gets the "reorderable" property.
850func (x *TreeViewColumn) GetPropertyReorderable() bool {
851 var v gobject.Value
852 x.GetProperty("reorderable", &v)
853 return v.GetBoolean()
854}
855
856// SetPropertyResizable sets the "resizable" property.
857func (x *TreeViewColumn) SetPropertyResizable(value bool) {
858 var v gobject.Value
859 v.Init(gobject.TypeBooleanVal)
860 v.SetBoolean(value)
861 x.SetProperty("resizable", &v)
862}
863
864// GetPropertyResizable gets the "resizable" property.
865func (x *TreeViewColumn) GetPropertyResizable() bool {
866 var v gobject.Value
867 x.GetProperty("resizable", &v)
868 return v.GetBoolean()
869}
870
871// SetPropertySortColumnId sets the "sort-column-id" property.
872// Logical sort column ID this column sorts on when selected for sorting. Setting the sort column ID makes the column header
873// clickable. Set to -1 to make the column unsortable.
874func (x *TreeViewColumn) SetPropertySortColumnId(value int) {
875 var v gobject.Value
876 v.Init(gobject.TypeIntVal)
877 v.SetInt(value)
878 x.SetProperty("sort-column-id", &v)
879}
880
881// GetPropertySortColumnId gets the "sort-column-id" property.
882// Logical sort column ID this column sorts on when selected for sorting. Setting the sort column ID makes the column header
883// clickable. Set to -1 to make the column unsortable.
884func (x *TreeViewColumn) GetPropertySortColumnId() int {
885 var v gobject.Value
886 x.GetProperty("sort-column-id", &v)
887 return v.GetInt()
888}
889
890// SetPropertySortIndicator sets the "sort-indicator" property.
891func (x *TreeViewColumn) SetPropertySortIndicator(value bool) {
892 var v gobject.Value
893 v.Init(gobject.TypeBooleanVal)
894 v.SetBoolean(value)
895 x.SetProperty("sort-indicator", &v)
896}
897
898// GetPropertySortIndicator gets the "sort-indicator" property.
899func (x *TreeViewColumn) GetPropertySortIndicator() bool {
900 var v gobject.Value
901 x.GetProperty("sort-indicator", &v)
902 return v.GetBoolean()
903}
904
905// SetPropertySpacing sets the "spacing" property.
906func (x *TreeViewColumn) SetPropertySpacing(value int) {
907 var v gobject.Value
908 v.Init(gobject.TypeIntVal)
909 v.SetInt(value)
910 x.SetProperty("spacing", &v)
911}
912
913// GetPropertySpacing gets the "spacing" property.
914func (x *TreeViewColumn) GetPropertySpacing() int {
915 var v gobject.Value
916 x.GetProperty("spacing", &v)
917 return v.GetInt()
918}
919
920// SetPropertyTitle sets the "title" property.
921func (x *TreeViewColumn) SetPropertyTitle(value string) {
922 var v gobject.Value
923 v.Init(gobject.TypeStringVal)
924 v.SetString(&value)
925 x.SetProperty("title", &v)
926}
927
928// GetPropertyTitle gets the "title" property.
929func (x *TreeViewColumn) GetPropertyTitle() string {
930 var v gobject.Value
931 x.GetProperty("title", &v)
932 return v.GetString()
933}
934
935// SetPropertyVisible sets the "visible" property.
936func (x *TreeViewColumn) SetPropertyVisible(value bool) {
937 var v gobject.Value
938 v.Init(gobject.TypeBooleanVal)
939 v.SetBoolean(value)
940 x.SetProperty("visible", &v)
941}
942
943// GetPropertyVisible gets the "visible" property.
944func (x *TreeViewColumn) GetPropertyVisible() bool {
945 var v gobject.Value
946 x.GetProperty("visible", &v)
947 return v.GetBoolean()
948}
949
950// GetPropertyWidth gets the "width" property.
951func (x *TreeViewColumn) GetPropertyWidth() int {
952 var v gobject.Value
953 x.GetProperty("width", &v)
954 return v.GetInt()
955}
956
957// GetPropertyXOffset gets the "x-offset" property.
958func (x *TreeViewColumn) GetPropertyXOffset() int {
959 var v gobject.Value
960 x.GetProperty("x-offset", &v)
961 return v.GetInt()
962}
963
964// Emitted when the column's header has been clicked.
965func (x *TreeViewColumn) ConnectClicked(cb *func(TreeViewColumn)) uint {
966 cbPtr := uintptr(unsafe.Pointer(cb))
967 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
968 handlerID := gobject.SignalConnect(x.GoPointer(), "clicked", cbRefPtr)
969 glib.SaveHandlerMapping(handlerID, cbPtr)
970 return handlerID
971 }
972
973 fcb := func(clsPtr uintptr) {
974 fa := TreeViewColumn{}
975 fa.Ptr = clsPtr
976 cbFn := *cb
977
978 cbFn(fa)
979
980 }
981 cbRefPtr := purego.NewCallback(fcb)
982 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
983 handlerID := gobject.SignalConnect(x.GoPointer(), "clicked", cbRefPtr)
984 glib.SaveHandlerMapping(handlerID, cbPtr)
985 return handlerID
986}
987
988// Gets the ID of the @buildable object.
989//
990// `GtkBuilder` sets the name based on the ID attribute
991// of the `<object>` tag used to construct the @buildable.
992func (x *TreeViewColumn) GetBuildableId() string {
993
994 cret := XGtkBuildableGetBuildableId(x.GoPointer())
995 return cret
996}
997
998// Returns the underlying `GtkCellArea` which might be @cell_layout
999// if called on a `GtkCellArea` or might be %NULL if no `GtkCellArea`
1000// is used by @cell_layout.
1001func (x *TreeViewColumn) GetArea() *CellArea {
1002 var cls *CellArea
1003
1004 cret := XGtkCellLayoutGetArea(x.GoPointer())
1005
1006 if cret == 0 {
1007 return nil
1008 }
1009 gobject.IncreaseRef(cret)
1010 cls = &CellArea{}
1011 cls.Ptr = cret
1012 return cls
1013}
1014
1015// Returns the cell renderers which have been added to @cell_layout.
1016func (x *TreeViewColumn) GetCells() *glib.List {
1017
1018 cret := XGtkCellLayoutGetCells(x.GoPointer())
1019 return cret
1020}
1021
1022// Re-inserts @cell at @position.
1023//
1024// Note that @cell has already to be packed into @cell_layout
1025// for this to function properly.
1026func (x *TreeViewColumn) Reorder(CellVar *CellRenderer, PositionVar int) {
1027
1028 XGtkCellLayoutReorder(x.GoPointer(), CellVar.GoPointer(), PositionVar)
1029
1030}
1031
1032func init() {
1033 core.SetPackageName("GTK", "gtk4")
1034 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
1035 var libs []uintptr
1036 for _, libPath := range core.GetPaths("GTK") {
1037 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
1038 if err != nil {
1039 panic(err)
1040 }
1041 libs = append(libs, lib)
1042 }
1043
1044 core.PuregoSafeRegister(&xTreeViewColumnSizingGLibType, libs, "gtk_tree_view_column_sizing_get_type")
1045
1046 core.PuregoSafeRegister(&xTreeViewColumnGLibType, libs, "gtk_tree_view_column_get_type")
1047
1048 core.PuregoSafeRegister(&xNewTreeViewColumn, libs, "gtk_tree_view_column_new")
1049 core.PuregoSafeRegister(&xNewTreeViewColumnWithArea, libs, "gtk_tree_view_column_new_with_area")
1050 core.PuregoSafeRegister(&xNewTreeViewColumnWithAttributes, libs, "gtk_tree_view_column_new_with_attributes")
1051
1052 core.PuregoSafeRegister(&xTreeViewColumnAddAttribute, libs, "gtk_tree_view_column_add_attribute")
1053 core.PuregoSafeRegister(&xTreeViewColumnCellGetPosition, libs, "gtk_tree_view_column_cell_get_position")
1054 core.PuregoSafeRegister(&xTreeViewColumnCellGetSize, libs, "gtk_tree_view_column_cell_get_size")
1055 core.PuregoSafeRegister(&xTreeViewColumnCellIsVisible, libs, "gtk_tree_view_column_cell_is_visible")
1056 core.PuregoSafeRegister(&xTreeViewColumnCellSetCellData, libs, "gtk_tree_view_column_cell_set_cell_data")
1057 core.PuregoSafeRegister(&xTreeViewColumnClear, libs, "gtk_tree_view_column_clear")
1058 core.PuregoSafeRegister(&xTreeViewColumnClearAttributes, libs, "gtk_tree_view_column_clear_attributes")
1059 core.PuregoSafeRegister(&xTreeViewColumnClicked, libs, "gtk_tree_view_column_clicked")
1060 core.PuregoSafeRegister(&xTreeViewColumnFocusCell, libs, "gtk_tree_view_column_focus_cell")
1061 core.PuregoSafeRegister(&xTreeViewColumnGetAlignment, libs, "gtk_tree_view_column_get_alignment")
1062 core.PuregoSafeRegister(&xTreeViewColumnGetButton, libs, "gtk_tree_view_column_get_button")
1063 core.PuregoSafeRegister(&xTreeViewColumnGetClickable, libs, "gtk_tree_view_column_get_clickable")
1064 core.PuregoSafeRegister(&xTreeViewColumnGetExpand, libs, "gtk_tree_view_column_get_expand")
1065 core.PuregoSafeRegister(&xTreeViewColumnGetFixedWidth, libs, "gtk_tree_view_column_get_fixed_width")
1066 core.PuregoSafeRegister(&xTreeViewColumnGetMaxWidth, libs, "gtk_tree_view_column_get_max_width")
1067 core.PuregoSafeRegister(&xTreeViewColumnGetMinWidth, libs, "gtk_tree_view_column_get_min_width")
1068 core.PuregoSafeRegister(&xTreeViewColumnGetReorderable, libs, "gtk_tree_view_column_get_reorderable")
1069 core.PuregoSafeRegister(&xTreeViewColumnGetResizable, libs, "gtk_tree_view_column_get_resizable")
1070 core.PuregoSafeRegister(&xTreeViewColumnGetSizing, libs, "gtk_tree_view_column_get_sizing")
1071 core.PuregoSafeRegister(&xTreeViewColumnGetSortColumnId, libs, "gtk_tree_view_column_get_sort_column_id")
1072 core.PuregoSafeRegister(&xTreeViewColumnGetSortIndicator, libs, "gtk_tree_view_column_get_sort_indicator")
1073 core.PuregoSafeRegister(&xTreeViewColumnGetSortOrder, libs, "gtk_tree_view_column_get_sort_order")
1074 core.PuregoSafeRegister(&xTreeViewColumnGetSpacing, libs, "gtk_tree_view_column_get_spacing")
1075 core.PuregoSafeRegister(&xTreeViewColumnGetTitle, libs, "gtk_tree_view_column_get_title")
1076 core.PuregoSafeRegister(&xTreeViewColumnGetTreeView, libs, "gtk_tree_view_column_get_tree_view")
1077 core.PuregoSafeRegister(&xTreeViewColumnGetVisible, libs, "gtk_tree_view_column_get_visible")
1078 core.PuregoSafeRegister(&xTreeViewColumnGetWidget, libs, "gtk_tree_view_column_get_widget")
1079 core.PuregoSafeRegister(&xTreeViewColumnGetWidth, libs, "gtk_tree_view_column_get_width")
1080 core.PuregoSafeRegister(&xTreeViewColumnGetXOffset, libs, "gtk_tree_view_column_get_x_offset")
1081 core.PuregoSafeRegister(&xTreeViewColumnPackEnd, libs, "gtk_tree_view_column_pack_end")
1082 core.PuregoSafeRegister(&xTreeViewColumnPackStart, libs, "gtk_tree_view_column_pack_start")
1083 core.PuregoSafeRegister(&xTreeViewColumnQueueResize, libs, "gtk_tree_view_column_queue_resize")
1084 core.PuregoSafeRegister(&xTreeViewColumnSetAlignment, libs, "gtk_tree_view_column_set_alignment")
1085 core.PuregoSafeRegister(&xTreeViewColumnSetAttributes, libs, "gtk_tree_view_column_set_attributes")
1086 core.PuregoSafeRegister(&xTreeViewColumnSetCellDataFunc, libs, "gtk_tree_view_column_set_cell_data_func")
1087 core.PuregoSafeRegister(&xTreeViewColumnSetClickable, libs, "gtk_tree_view_column_set_clickable")
1088 core.PuregoSafeRegister(&xTreeViewColumnSetExpand, libs, "gtk_tree_view_column_set_expand")
1089 core.PuregoSafeRegister(&xTreeViewColumnSetFixedWidth, libs, "gtk_tree_view_column_set_fixed_width")
1090 core.PuregoSafeRegister(&xTreeViewColumnSetMaxWidth, libs, "gtk_tree_view_column_set_max_width")
1091 core.PuregoSafeRegister(&xTreeViewColumnSetMinWidth, libs, "gtk_tree_view_column_set_min_width")
1092 core.PuregoSafeRegister(&xTreeViewColumnSetReorderable, libs, "gtk_tree_view_column_set_reorderable")
1093 core.PuregoSafeRegister(&xTreeViewColumnSetResizable, libs, "gtk_tree_view_column_set_resizable")
1094 core.PuregoSafeRegister(&xTreeViewColumnSetSizing, libs, "gtk_tree_view_column_set_sizing")
1095 core.PuregoSafeRegister(&xTreeViewColumnSetSortColumnId, libs, "gtk_tree_view_column_set_sort_column_id")
1096 core.PuregoSafeRegister(&xTreeViewColumnSetSortIndicator, libs, "gtk_tree_view_column_set_sort_indicator")
1097 core.PuregoSafeRegister(&xTreeViewColumnSetSortOrder, libs, "gtk_tree_view_column_set_sort_order")
1098 core.PuregoSafeRegister(&xTreeViewColumnSetSpacing, libs, "gtk_tree_view_column_set_spacing")
1099 core.PuregoSafeRegister(&xTreeViewColumnSetTitle, libs, "gtk_tree_view_column_set_title")
1100 core.PuregoSafeRegister(&xTreeViewColumnSetVisible, libs, "gtk_tree_view_column_set_visible")
1101 core.PuregoSafeRegister(&xTreeViewColumnSetWidget, libs, "gtk_tree_view_column_set_widget")
1102
1103}