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 BoxLayoutClass struct {
16 _ structs.HostLayout
17
18 ParentClass LayoutManagerClass
19}
20
21func (x *BoxLayoutClass) GoPointer() uintptr {
22 return uintptr(unsafe.Pointer(x))
23}
24
25// Arranges children in a single row or column.
26//
27// Whether it is a row or column depends on the value of its
28// [property@Gtk.Orientable:orientation] property. Within the other dimension
29// all children all allocated the same size. The `GtkBoxLayout` will respect
30// the [property@Gtk.Widget:halign] and [property@Gtk.Widget:valign]
31// properties of each child widget.
32//
33// If you want all children to be assigned the same size, you can use
34// the [property@Gtk.BoxLayout:homogeneous] property.
35//
36// If you want to specify the amount of space placed between each child,
37// you can use the [property@Gtk.BoxLayout:spacing] property.
38type BoxLayout struct {
39 LayoutManager
40}
41
42var xBoxLayoutGLibType func() types.GType
43
44func BoxLayoutGLibType() types.GType {
45 return xBoxLayoutGLibType()
46}
47
48func BoxLayoutNewFromInternalPtr(ptr uintptr) *BoxLayout {
49 cls := &BoxLayout{}
50 cls.Ptr = ptr
51 return cls
52}
53
54var xNewBoxLayout func(Orientation) uintptr
55
56// Creates a new `GtkBoxLayout`.
57func NewBoxLayout(OrientationVar Orientation) *BoxLayout {
58 var cls *BoxLayout
59
60 cret := xNewBoxLayout(OrientationVar)
61
62 if cret == 0 {
63 return nil
64 }
65 cls = &BoxLayout{}
66 cls.Ptr = cret
67 return cls
68}
69
70var xBoxLayoutGetBaselineChild func(uintptr) int
71
72// Gets the value set by gtk_box_layout_set_baseline_child().
73func (x *BoxLayout) GetBaselineChild() int {
74
75 cret := xBoxLayoutGetBaselineChild(x.GoPointer())
76 return cret
77}
78
79var xBoxLayoutGetBaselinePosition func(uintptr) BaselinePosition
80
81// Gets the value set by gtk_box_layout_set_baseline_position().
82func (x *BoxLayout) GetBaselinePosition() BaselinePosition {
83
84 cret := xBoxLayoutGetBaselinePosition(x.GoPointer())
85 return cret
86}
87
88var xBoxLayoutGetHomogeneous func(uintptr) bool
89
90// Returns whether the layout is set to be homogeneous.
91func (x *BoxLayout) GetHomogeneous() bool {
92
93 cret := xBoxLayoutGetHomogeneous(x.GoPointer())
94 return cret
95}
96
97var xBoxLayoutGetSpacing func(uintptr) uint
98
99// Returns the space that @box_layout puts between children.
100func (x *BoxLayout) GetSpacing() uint {
101
102 cret := xBoxLayoutGetSpacing(x.GoPointer())
103 return cret
104}
105
106var xBoxLayoutSetBaselineChild func(uintptr, int)
107
108// Sets the index of the child that determines the baseline
109// in vertical layout.
110func (x *BoxLayout) SetBaselineChild(ChildVar int) {
111
112 xBoxLayoutSetBaselineChild(x.GoPointer(), ChildVar)
113
114}
115
116var xBoxLayoutSetBaselinePosition func(uintptr, BaselinePosition)
117
118// Sets the baseline position of a box layout.
119//
120// The baseline position affects only horizontal boxes with at least one
121// baseline aligned child. If there is more vertical space available than
122// requested, and the baseline is not allocated by the parent then the
123// given @position is used to allocate the baseline within the extra
124// space available.
125func (x *BoxLayout) SetBaselinePosition(PositionVar BaselinePosition) {
126
127 xBoxLayoutSetBaselinePosition(x.GoPointer(), PositionVar)
128
129}
130
131var xBoxLayoutSetHomogeneous func(uintptr, bool)
132
133// Sets whether the box layout will allocate the same
134// size to all children.
135func (x *BoxLayout) SetHomogeneous(HomogeneousVar bool) {
136
137 xBoxLayoutSetHomogeneous(x.GoPointer(), HomogeneousVar)
138
139}
140
141var xBoxLayoutSetSpacing func(uintptr, uint)
142
143// Sets how much spacing to put between children.
144func (x *BoxLayout) SetSpacing(SpacingVar uint) {
145
146 xBoxLayoutSetSpacing(x.GoPointer(), SpacingVar)
147
148}
149
150func (c *BoxLayout) GoPointer() uintptr {
151 if c == nil {
152 return 0
153 }
154 return c.Ptr
155}
156
157func (c *BoxLayout) SetGoPointer(ptr uintptr) {
158 c.Ptr = ptr
159}
160
161// SetPropertyBaselineChild sets the "baseline-child" property.
162// The child that determines the baseline of the box
163// in vertical layout.
164//
165// If the child does baseline positioning, then its baseline
166// is lined up with the baseline of the box. If it doesn't, then
167// the bottom edge of the child is used.
168func (x *BoxLayout) SetPropertyBaselineChild(value int) {
169 var v gobject.Value
170 v.Init(gobject.TypeIntVal)
171 v.SetInt(value)
172 x.SetProperty("baseline-child", &v)
173}
174
175// GetPropertyBaselineChild gets the "baseline-child" property.
176// The child that determines the baseline of the box
177// in vertical layout.
178//
179// If the child does baseline positioning, then its baseline
180// is lined up with the baseline of the box. If it doesn't, then
181// the bottom edge of the child is used.
182func (x *BoxLayout) GetPropertyBaselineChild() int {
183 var v gobject.Value
184 x.GetProperty("baseline-child", &v)
185 return v.GetInt()
186}
187
188// SetPropertyHomogeneous sets the "homogeneous" property.
189// Whether the box layout should distribute the available space
190// equally among the children.
191func (x *BoxLayout) SetPropertyHomogeneous(value bool) {
192 var v gobject.Value
193 v.Init(gobject.TypeBooleanVal)
194 v.SetBoolean(value)
195 x.SetProperty("homogeneous", &v)
196}
197
198// GetPropertyHomogeneous gets the "homogeneous" property.
199// Whether the box layout should distribute the available space
200// equally among the children.
201func (x *BoxLayout) GetPropertyHomogeneous() bool {
202 var v gobject.Value
203 x.GetProperty("homogeneous", &v)
204 return v.GetBoolean()
205}
206
207// SetPropertySpacing sets the "spacing" property.
208// The space to put between the children.
209func (x *BoxLayout) SetPropertySpacing(value int) {
210 var v gobject.Value
211 v.Init(gobject.TypeIntVal)
212 v.SetInt(value)
213 x.SetProperty("spacing", &v)
214}
215
216// GetPropertySpacing gets the "spacing" property.
217// The space to put between the children.
218func (x *BoxLayout) GetPropertySpacing() int {
219 var v gobject.Value
220 x.GetProperty("spacing", &v)
221 return v.GetInt()
222}
223
224// Retrieves the orientation of the @orientable.
225func (x *BoxLayout) GetOrientation() Orientation {
226
227 cret := XGtkOrientableGetOrientation(x.GoPointer())
228 return cret
229}
230
231// Sets the orientation of the @orientable.
232func (x *BoxLayout) SetOrientation(OrientationVar Orientation) {
233
234 XGtkOrientableSetOrientation(x.GoPointer(), OrientationVar)
235
236}
237
238func init() {
239 core.SetPackageName("GTK", "gtk4")
240 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
241 var libs []uintptr
242 for _, libPath := range core.GetPaths("GTK") {
243 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
244 if err != nil {
245 panic(err)
246 }
247 libs = append(libs, lib)
248 }
249
250 core.PuregoSafeRegister(&xBoxLayoutGLibType, libs, "gtk_box_layout_get_type")
251
252 core.PuregoSafeRegister(&xNewBoxLayout, libs, "gtk_box_layout_new")
253
254 core.PuregoSafeRegister(&xBoxLayoutGetBaselineChild, libs, "gtk_box_layout_get_baseline_child")
255 core.PuregoSafeRegister(&xBoxLayoutGetBaselinePosition, libs, "gtk_box_layout_get_baseline_position")
256 core.PuregoSafeRegister(&xBoxLayoutGetHomogeneous, libs, "gtk_box_layout_get_homogeneous")
257 core.PuregoSafeRegister(&xBoxLayoutGetSpacing, libs, "gtk_box_layout_get_spacing")
258 core.PuregoSafeRegister(&xBoxLayoutSetBaselineChild, libs, "gtk_box_layout_set_baseline_child")
259 core.PuregoSafeRegister(&xBoxLayoutSetBaselinePosition, libs, "gtk_box_layout_set_baseline_position")
260 core.PuregoSafeRegister(&xBoxLayoutSetHomogeneous, libs, "gtk_box_layout_set_homogeneous")
261 core.PuregoSafeRegister(&xBoxLayoutSetSpacing, libs, "gtk_box_layout_set_spacing")
262
263}