1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "github.com/ebitengine/purego"
6
7 "github.com/bnema/puregotk/pkg/core"
8 "github.com/bnema/puregotk/v4/glib"
9 "github.com/bnema/puregotk/v4/gobject"
10 "github.com/bnema/puregotk/v4/gobject/types"
11)
12
13// A cell area that renders GtkCellRenderers into a row or a column
14//
15// The `GtkCellAreaBox` renders cell renderers into a row or a column
16// depending on its `GtkOrientation`.
17//
18// GtkCellAreaBox uses a notion of packing. Packing
19// refers to adding cell renderers with reference to a particular position
20// in a `GtkCellAreaBox`. There are two reference positions: the
21// start and the end of the box.
22// When the `GtkCellAreaBox` is oriented in the %GTK_ORIENTATION_VERTICAL
23// orientation, the start is defined as the top of the box and the end is
24// defined as the bottom. In the %GTK_ORIENTATION_HORIZONTAL orientation
25// start is defined as the left side and the end is defined as the right
26// side.
27//
28// Alignments of `GtkCellRenderer`s rendered in adjacent rows can be
29// configured by configuring the `GtkCellAreaBox` align child cell property
30// with gtk_cell_area_cell_set_property() or by specifying the "align"
31// argument to gtk_cell_area_box_pack_start() and gtk_cell_area_box_pack_end().
32type CellAreaBox struct {
33 CellArea
34}
35
36var xCellAreaBoxGLibType func() types.GType
37
38func CellAreaBoxGLibType() types.GType {
39 return xCellAreaBoxGLibType()
40}
41
42func CellAreaBoxNewFromInternalPtr(ptr uintptr) *CellAreaBox {
43 cls := &CellAreaBox{}
44 cls.Ptr = ptr
45 return cls
46}
47
48var xNewCellAreaBox func() uintptr
49
50// Creates a new `GtkCellAreaBox`.
51func NewCellAreaBox() *CellAreaBox {
52 var cls *CellAreaBox
53
54 cret := xNewCellAreaBox()
55
56 if cret == 0 {
57 return nil
58 }
59 gobject.IncreaseRef(cret)
60 cls = &CellAreaBox{}
61 cls.Ptr = cret
62 return cls
63}
64
65var xCellAreaBoxGetSpacing func(uintptr) int
66
67// Gets the spacing added between cell renderers.
68func (x *CellAreaBox) GetSpacing() int {
69
70 cret := xCellAreaBoxGetSpacing(x.GoPointer())
71 return cret
72}
73
74var xCellAreaBoxPackEnd func(uintptr, uintptr, bool, bool, bool)
75
76// Adds @renderer to @box, packed with reference to the end of @box.
77//
78// The @renderer is packed after (away from end of) any other
79// `GtkCellRenderer` packed with reference to the end of @box.
80func (x *CellAreaBox) PackEnd(RendererVar *CellRenderer, ExpandVar bool, AlignVar bool, FixedVar bool) {
81
82 xCellAreaBoxPackEnd(x.GoPointer(), RendererVar.GoPointer(), ExpandVar, AlignVar, FixedVar)
83
84}
85
86var xCellAreaBoxPackStart func(uintptr, uintptr, bool, bool, bool)
87
88// Adds @renderer to @box, packed with reference to the start of @box.
89//
90// The @renderer is packed after any other `GtkCellRenderer` packed
91// with reference to the start of @box.
92func (x *CellAreaBox) PackStart(RendererVar *CellRenderer, ExpandVar bool, AlignVar bool, FixedVar bool) {
93
94 xCellAreaBoxPackStart(x.GoPointer(), RendererVar.GoPointer(), ExpandVar, AlignVar, FixedVar)
95
96}
97
98var xCellAreaBoxSetSpacing func(uintptr, int)
99
100// Sets the spacing to add between cell renderers in @box.
101func (x *CellAreaBox) SetSpacing(SpacingVar int) {
102
103 xCellAreaBoxSetSpacing(x.GoPointer(), SpacingVar)
104
105}
106
107func (c *CellAreaBox) GoPointer() uintptr {
108 if c == nil {
109 return 0
110 }
111 return c.Ptr
112}
113
114func (c *CellAreaBox) SetGoPointer(ptr uintptr) {
115 c.Ptr = ptr
116}
117
118// SetPropertySpacing sets the "spacing" property.
119// The amount of space to reserve between cells.
120func (x *CellAreaBox) SetPropertySpacing(value int) {
121 var v gobject.Value
122 v.Init(gobject.TypeIntVal)
123 v.SetInt(value)
124 x.SetProperty("spacing", &v)
125}
126
127// GetPropertySpacing gets the "spacing" property.
128// The amount of space to reserve between cells.
129func (x *CellAreaBox) GetPropertySpacing() int {
130 var v gobject.Value
131 x.GetProperty("spacing", &v)
132 return v.GetInt()
133}
134
135// Gets the ID of the @buildable object.
136//
137// `GtkBuilder` sets the name based on the ID attribute
138// of the `<object>` tag used to construct the @buildable.
139func (x *CellAreaBox) GetBuildableId() string {
140
141 cret := XGtkBuildableGetBuildableId(x.GoPointer())
142 return cret
143}
144
145// Adds an attribute mapping to the list in @cell_layout.
146//
147// The @column is the column of the model to get a value from, and the
148// @attribute is the property on @cell to be set from that value. So for
149// example if column 2 of the model contains strings, you could have the
150// “text” attribute of a `GtkCellRendererText` get its values from column 2.
151// In this context "attribute" and "property" are used interchangeably.
152func (x *CellAreaBox) AddAttribute(CellVar *CellRenderer, AttributeVar string, ColumnVar int) {
153
154 XGtkCellLayoutAddAttribute(x.GoPointer(), CellVar.GoPointer(), AttributeVar, ColumnVar)
155
156}
157
158// Unsets all the mappings on all renderers on @cell_layout and
159// removes all renderers from @cell_layout.
160func (x *CellAreaBox) Clear() {
161
162 XGtkCellLayoutClear(x.GoPointer())
163
164}
165
166// Clears all existing attributes previously set with
167// gtk_cell_layout_set_attributes().
168func (x *CellAreaBox) ClearAttributes(CellVar *CellRenderer) {
169
170 XGtkCellLayoutClearAttributes(x.GoPointer(), CellVar.GoPointer())
171
172}
173
174// Returns the underlying `GtkCellArea` which might be @cell_layout
175// if called on a `GtkCellArea` or might be %NULL if no `GtkCellArea`
176// is used by @cell_layout.
177func (x *CellAreaBox) GetArea() *CellArea {
178 var cls *CellArea
179
180 cret := XGtkCellLayoutGetArea(x.GoPointer())
181
182 if cret == 0 {
183 return nil
184 }
185 gobject.IncreaseRef(cret)
186 cls = &CellArea{}
187 cls.Ptr = cret
188 return cls
189}
190
191// Returns the cell renderers which have been added to @cell_layout.
192func (x *CellAreaBox) GetCells() *glib.List {
193
194 cret := XGtkCellLayoutGetCells(x.GoPointer())
195 return cret
196}
197
198// Re-inserts @cell at @position.
199//
200// Note that @cell has already to be packed into @cell_layout
201// for this to function properly.
202func (x *CellAreaBox) Reorder(CellVar *CellRenderer, PositionVar int) {
203
204 XGtkCellLayoutReorder(x.GoPointer(), CellVar.GoPointer(), PositionVar)
205
206}
207
208// Sets the attributes in the parameter list as the attributes
209// of @cell_layout.
210//
211// See [method@Gtk.CellLayout.add_attribute] for more details.
212//
213// The attributes should be in attribute/column order, as in
214// gtk_cell_layout_add_attribute(). All existing attributes are
215// removed, and replaced with the new attributes.
216func (x *CellAreaBox) SetAttributes(CellVar *CellRenderer, varArgs ...interface{}) {
217
218 XGtkCellLayoutSetAttributes(x.GoPointer(), CellVar.GoPointer(), varArgs...)
219
220}
221
222// Sets the `GtkCellLayout`DataFunc to use for @cell_layout.
223//
224// This function is used instead of the standard attributes mapping
225// for setting the column value, and should set the value of @cell_layout’s
226// cell renderer(s) as appropriate.
227//
228// @func may be %NULL to remove a previously set function.
229func (x *CellAreaBox) SetCellDataFunc(CellVar *CellRenderer, FuncVar *CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar *glib.DestroyNotify) {
230
231 XGtkCellLayoutSetCellDataFunc(x.GoPointer(), CellVar.GoPointer(), glib.NewCallbackNullable(FuncVar), FuncDataVar, glib.NewCallback(DestroyVar))
232
233}
234
235// Retrieves the orientation of the @orientable.
236func (x *CellAreaBox) GetOrientation() Orientation {
237
238 cret := XGtkOrientableGetOrientation(x.GoPointer())
239 return cret
240}
241
242// Sets the orientation of the @orientable.
243func (x *CellAreaBox) SetOrientation(OrientationVar Orientation) {
244
245 XGtkOrientableSetOrientation(x.GoPointer(), OrientationVar)
246
247}
248
249func init() {
250 core.SetPackageName("GTK", "gtk4")
251 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
252 var libs []uintptr
253 for _, libPath := range core.GetPaths("GTK") {
254 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
255 if err != nil {
256 panic(err)
257 }
258 libs = append(libs, lib)
259 }
260
261 core.PuregoSafeRegister(&xCellAreaBoxGLibType, libs, "gtk_cell_area_box_get_type")
262
263 core.PuregoSafeRegister(&xNewCellAreaBox, libs, "gtk_cell_area_box_new")
264
265 core.PuregoSafeRegister(&xCellAreaBoxGetSpacing, libs, "gtk_cell_area_box_get_spacing")
266 core.PuregoSafeRegister(&xCellAreaBoxPackEnd, libs, "gtk_cell_area_box_pack_end")
267 core.PuregoSafeRegister(&xCellAreaBoxPackStart, libs, "gtk_cell_area_box_pack_start")
268 core.PuregoSafeRegister(&xCellAreaBoxSetSpacing, libs, "gtk_cell_area_box_set_spacing")
269
270}