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 BoxClass struct {
16 _ structs.HostLayout
17
18 ParentClass WidgetClass
19
20 Padding [8]uintptr
21}
22
23func (x *BoxClass) GoPointer() uintptr {
24 return uintptr(unsafe.Pointer(x))
25}
26
27// Arranges child widgets into a single row or column.
28//
29// <picture>
30//
31// <source srcset="box-dark.png" media="(prefers-color-scheme: dark)">
32// <img alt="An example GtkBox" src="box.png">
33//
34// </picture>
35//
36// Whether it is a row or column depends on the value of its
37// [property@Gtk.Orientable:orientation] property. Within the other
38// dimension, all children are allocated the same size. The
39// [property@Gtk.Widget:halign] and [property@Gtk.Widget:valign]
40// properties can be used on the children to influence their allocation.
41//
42// Use repeated calls to [method@Gtk.Box.append] to pack widgets into a
43// `GtkBox` from start to end. Use [method@Gtk.Box.remove] to remove widgets
44// from the `GtkBox`. [method@Gtk.Box.insert_child_after] can be used to add
45// a child at a particular position.
46//
47// Use [method@Gtk.Box.set_homogeneous] to specify whether or not all children
48// of the `GtkBox` are forced to get the same amount of space.
49//
50// Use [method@Gtk.Box.set_spacing] to determine how much space will be minimally
51// placed between all children in the `GtkBox`. Note that spacing is added
52// *between* the children.
53//
54// Use [method@Gtk.Box.reorder_child_after] to move a child to a different
55// place in the box.
56//
57// # CSS nodes
58//
59// `GtkBox` uses a single CSS node with name box.
60//
61// # Accessibility
62//
63// Until GTK 4.10, `GtkBox` used the [enum@Gtk.AccessibleRole.group] role.
64//
65// Starting from GTK 4.12, `GtkBox` uses the [enum@Gtk.AccessibleRole.generic] role.
66type Box struct {
67 Widget
68}
69
70var xBoxGLibType func() types.GType
71
72func BoxGLibType() types.GType {
73 return xBoxGLibType()
74}
75
76func BoxNewFromInternalPtr(ptr uintptr) *Box {
77 cls := &Box{}
78 cls.Ptr = ptr
79 return cls
80}
81
82var xNewBox func(Orientation, int) uintptr
83
84// Creates a new box.
85func NewBox(OrientationVar Orientation, SpacingVar int) *Box {
86 var cls *Box
87
88 cret := xNewBox(OrientationVar, SpacingVar)
89
90 if cret == 0 {
91 return nil
92 }
93 gobject.IncreaseRef(cret)
94 cls = &Box{}
95 cls.Ptr = cret
96 return cls
97}
98
99var xBoxAppend func(uintptr, uintptr)
100
101// Adds a child at the end.
102func (x *Box) Append(ChildVar *Widget) {
103
104 xBoxAppend(x.GoPointer(), ChildVar.GoPointer())
105
106}
107
108var xBoxGetBaselineChild func(uintptr) int
109
110// Gets the value set by [method@Gtk.Box.set_baseline_child].
111func (x *Box) GetBaselineChild() int {
112
113 cret := xBoxGetBaselineChild(x.GoPointer())
114 return cret
115}
116
117var xBoxGetBaselinePosition func(uintptr) BaselinePosition
118
119// Gets the value set by [method@Gtk.Box.set_baseline_position].
120func (x *Box) GetBaselinePosition() BaselinePosition {
121
122 cret := xBoxGetBaselinePosition(x.GoPointer())
123 return cret
124}
125
126var xBoxGetHomogeneous func(uintptr) bool
127
128// Returns whether the box is homogeneous.
129//
130// In a homogeneous box all children are the same size.
131func (x *Box) GetHomogeneous() bool {
132
133 cret := xBoxGetHomogeneous(x.GoPointer())
134 return cret
135}
136
137var xBoxGetSpacing func(uintptr) int
138
139// Gets the value set by [method@Gtk.Box.set_spacing].
140func (x *Box) GetSpacing() int {
141
142 cret := xBoxGetSpacing(x.GoPointer())
143 return cret
144}
145
146var xBoxInsertChildAfter func(uintptr, uintptr, uintptr)
147
148// Inserts a child at a specific position.
149//
150// The child is added after @sibling in the list of @box children.
151//
152// If @sibling is `NULL`, the @child is placed at the beginning.
153func (x *Box) InsertChildAfter(ChildVar *Widget, SiblingVar *Widget) {
154
155 xBoxInsertChildAfter(x.GoPointer(), ChildVar.GoPointer(), SiblingVar.GoPointer())
156
157}
158
159var xBoxPrepend func(uintptr, uintptr)
160
161// Adds a child at the beginning.
162func (x *Box) Prepend(ChildVar *Widget) {
163
164 xBoxPrepend(x.GoPointer(), ChildVar.GoPointer())
165
166}
167
168var xBoxRemove func(uintptr, uintptr)
169
170// Removes a child widget from the box.
171//
172// The child must have been added before with
173// [method@Gtk.Box.append], [method@Gtk.Box.prepend], or
174// [method@Gtk.Box.insert_child_after].
175func (x *Box) Remove(ChildVar *Widget) {
176
177 xBoxRemove(x.GoPointer(), ChildVar.GoPointer())
178
179}
180
181var xBoxReorderChildAfter func(uintptr, uintptr, uintptr)
182
183// Moves a child to a different position.
184//
185// The child is moved to the position after @sibling in the list
186// of @box children.
187//
188// If @sibling is `NULL`, the child is placed at the beginning.
189func (x *Box) ReorderChildAfter(ChildVar *Widget, SiblingVar *Widget) {
190
191 xBoxReorderChildAfter(x.GoPointer(), ChildVar.GoPointer(), SiblingVar.GoPointer())
192
193}
194
195var xBoxSetBaselineChild func(uintptr, int)
196
197// Sets the baseline child of a box.
198//
199// This affects only vertical boxes.
200func (x *Box) SetBaselineChild(ChildVar int) {
201
202 xBoxSetBaselineChild(x.GoPointer(), ChildVar)
203
204}
205
206var xBoxSetBaselinePosition func(uintptr, BaselinePosition)
207
208// Sets the baseline position of a box.
209//
210// This affects only horizontal boxes with at least one baseline
211// aligned child. If there is more vertical space available than
212// requested, and the baseline is not allocated by the parent then
213// @position is used to allocate the baseline with respect to the
214// extra space available.
215func (x *Box) SetBaselinePosition(PositionVar BaselinePosition) {
216
217 xBoxSetBaselinePosition(x.GoPointer(), PositionVar)
218
219}
220
221var xBoxSetHomogeneous func(uintptr, bool)
222
223// Sets whether or not all children are given equal space
224// in the box.
225func (x *Box) SetHomogeneous(HomogeneousVar bool) {
226
227 xBoxSetHomogeneous(x.GoPointer(), HomogeneousVar)
228
229}
230
231var xBoxSetSpacing func(uintptr, int)
232
233// Sets the number of pixels to place between children.
234func (x *Box) SetSpacing(SpacingVar int) {
235
236 xBoxSetSpacing(x.GoPointer(), SpacingVar)
237
238}
239
240func (c *Box) GoPointer() uintptr {
241 if c == nil {
242 return 0
243 }
244 return c.Ptr
245}
246
247func (c *Box) SetGoPointer(ptr uintptr) {
248 c.Ptr = ptr
249}
250
251// SetPropertyBaselineChild sets the "baseline-child" property.
252// The position of the child that determines the baseline.
253//
254// This is only relevant if the box is in vertical orientation.
255func (x *Box) SetPropertyBaselineChild(value int) {
256 var v gobject.Value
257 v.Init(gobject.TypeIntVal)
258 v.SetInt(value)
259 x.SetProperty("baseline-child", &v)
260}
261
262// GetPropertyBaselineChild gets the "baseline-child" property.
263// The position of the child that determines the baseline.
264//
265// This is only relevant if the box is in vertical orientation.
266func (x *Box) GetPropertyBaselineChild() int {
267 var v gobject.Value
268 x.GetProperty("baseline-child", &v)
269 return v.GetInt()
270}
271
272// SetPropertyHomogeneous sets the "homogeneous" property.
273// Whether the children should all be the same size.
274func (x *Box) SetPropertyHomogeneous(value bool) {
275 var v gobject.Value
276 v.Init(gobject.TypeBooleanVal)
277 v.SetBoolean(value)
278 x.SetProperty("homogeneous", &v)
279}
280
281// GetPropertyHomogeneous gets the "homogeneous" property.
282// Whether the children should all be the same size.
283func (x *Box) GetPropertyHomogeneous() bool {
284 var v gobject.Value
285 x.GetProperty("homogeneous", &v)
286 return v.GetBoolean()
287}
288
289// SetPropertySpacing sets the "spacing" property.
290// The amount of space between children.
291func (x *Box) SetPropertySpacing(value int) {
292 var v gobject.Value
293 v.Init(gobject.TypeIntVal)
294 v.SetInt(value)
295 x.SetProperty("spacing", &v)
296}
297
298// GetPropertySpacing gets the "spacing" property.
299// The amount of space between children.
300func (x *Box) GetPropertySpacing() int {
301 var v gobject.Value
302 x.GetProperty("spacing", &v)
303 return v.GetInt()
304}
305
306// Requests the user's screen reader to announce the given message.
307//
308// This kind of notification is useful for messages that
309// either have only a visual representation or that are not
310// exposed visually at all, e.g. a notification about a
311// successful operation.
312//
313// Also, by using this API, you can ensure that the message
314// does not interrupts the user's current screen reader output.
315func (x *Box) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
316
317 XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
318
319}
320
321// Retrieves the accessible parent for an accessible object.
322//
323// This function returns `NULL` for top level widgets.
324func (x *Box) GetAccessibleParent() *AccessibleBase {
325 var cls *AccessibleBase
326
327 cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
328
329 if cret == 0 {
330 return nil
331 }
332 cls = &AccessibleBase{}
333 cls.Ptr = cret
334 return cls
335}
336
337// Retrieves the accessible role of an accessible object.
338func (x *Box) GetAccessibleRole() AccessibleRole {
339
340 cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
341 return cret
342}
343
344// Retrieves the implementation for the given accessible object.
345func (x *Box) GetAtContext() *ATContext {
346 var cls *ATContext
347
348 cret := XGtkAccessibleGetAtContext(x.GoPointer())
349
350 if cret == 0 {
351 return nil
352 }
353 cls = &ATContext{}
354 cls.Ptr = cret
355 return cls
356}
357
358// Queries the coordinates and dimensions of this accessible
359//
360// This functionality can be overridden by `GtkAccessible`
361// implementations, e.g. to get the bounds from an ignored
362// child widget.
363func (x *Box) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
364
365 cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
366 return cret
367}
368
369// Retrieves the first accessible child of an accessible object.
370func (x *Box) GetFirstAccessibleChild() *AccessibleBase {
371 var cls *AccessibleBase
372
373 cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
374
375 if cret == 0 {
376 return nil
377 }
378 cls = &AccessibleBase{}
379 cls.Ptr = cret
380 return cls
381}
382
383// Retrieves the next accessible sibling of an accessible object
384func (x *Box) GetNextAccessibleSibling() *AccessibleBase {
385 var cls *AccessibleBase
386
387 cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
388
389 if cret == 0 {
390 return nil
391 }
392 cls = &AccessibleBase{}
393 cls.Ptr = cret
394 return cls
395}
396
397// Queries a platform state, such as focus.
398//
399// This functionality can be overridden by `GtkAccessible`
400// implementations, e.g. to get platform state from an ignored
401// child widget, as is the case for `GtkText` wrappers.
402func (x *Box) GetPlatformState(StateVar AccessiblePlatformState) bool {
403
404 cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
405 return cret
406}
407
408// Resets the accessible property to its default value.
409func (x *Box) ResetProperty(PropertyVar AccessibleProperty) {
410
411 XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
412
413}
414
415// Resets the accessible relation to its default value.
416func (x *Box) ResetRelation(RelationVar AccessibleRelation) {
417
418 XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
419
420}
421
422// Resets the accessible state to its default value.
423func (x *Box) ResetState(StateVar AccessibleState) {
424
425 XGtkAccessibleResetState(x.GoPointer(), StateVar)
426
427}
428
429// Sets the parent and sibling of an accessible object.
430//
431// This function is meant to be used by accessible implementations that are
432// not part of the widget hierarchy, and but act as a logical bridge between
433// widgets. For instance, if a widget creates an object that holds metadata
434// for each child, and you want that object to implement the `GtkAccessible`
435// interface, you will use this function to ensure that the parent of each
436// child widget is the metadata object, and the parent of each metadata
437// object is the container widget.
438func (x *Box) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
439
440 XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
441
442}
443
444// Updates the next accessible sibling.
445//
446// That might be useful when a new child of a custom accessible
447// is created, and it needs to be linked to a previous child.
448func (x *Box) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
449
450 XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
451
452}
453
454// Informs ATs that the platform state has changed.
455//
456// This function should be used by `GtkAccessible` implementations that
457// have a platform state but are not widgets. Widgets handle platform
458// states automatically.
459func (x *Box) UpdatePlatformState(StateVar AccessiblePlatformState) {
460
461 XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
462
463}
464
465// Updates a list of accessible properties.
466//
467// See the [enum@Gtk.AccessibleProperty] documentation for the
468// value types of accessible properties.
469//
470// This function should be called by `GtkWidget` types whenever
471// an accessible property change must be communicated to assistive
472// technologies.
473//
474// Example:
475// ```c
476// value = gtk_adjustment_get_value (adjustment);
477// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
478//
479// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
480// -1);
481//
482// ```
483func (x *Box) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
484
485 XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
486
487}
488
489// Updates an array of accessible properties.
490//
491// This function should be called by `GtkWidget` types whenever an accessible
492// property change must be communicated to assistive technologies.
493//
494// This function is meant to be used by language bindings.
495func (x *Box) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
496
497 XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
498
499}
500
501// Updates a list of accessible relations.
502//
503// This function should be called by `GtkWidget` types whenever an accessible
504// relation change must be communicated to assistive technologies.
505//
506// If the [enum@Gtk.AccessibleRelation] requires a list of references,
507// you should pass each reference individually, followed by `NULL`, e.g.
508//
509// ```c
510// gtk_accessible_update_relation (accessible,
511//
512// GTK_ACCESSIBLE_RELATION_CONTROLS,
513// ref1, NULL,
514// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
515// ref1, ref2, ref3, NULL,
516// -1);
517//
518// ```
519func (x *Box) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
520
521 XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
522
523}
524
525// Updates an array of accessible relations.
526//
527// This function should be called by `GtkWidget` types whenever an accessible
528// relation change must be communicated to assistive technologies.
529//
530// This function is meant to be used by language bindings.
531func (x *Box) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
532
533 XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
534
535}
536
537// Updates a list of accessible states.
538//
539// See the [enum@Gtk.AccessibleState] documentation for the
540// value types of accessible states.
541//
542// This function should be called by `GtkWidget` types whenever
543// an accessible state change must be communicated to assistive
544// technologies.
545//
546// Example:
547//
548// ```c
549// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
550// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
551//
552// GTK_ACCESSIBLE_STATE_CHECKED, value,
553// -1);
554//
555// ```
556func (x *Box) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
557
558 XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
559
560}
561
562// Updates an array of accessible states.
563//
564// This function should be called by `GtkWidget` types whenever an accessible
565// state change must be communicated to assistive technologies.
566//
567// This function is meant to be used by language bindings.
568func (x *Box) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
569
570 XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
571
572}
573
574// Gets the ID of the @buildable object.
575//
576// `GtkBuilder` sets the name based on the ID attribute
577// of the `<object>` tag used to construct the @buildable.
578func (x *Box) GetBuildableId() string {
579
580 cret := XGtkBuildableGetBuildableId(x.GoPointer())
581 return cret
582}
583
584// Retrieves the orientation of the @orientable.
585func (x *Box) GetOrientation() Orientation {
586
587 cret := XGtkOrientableGetOrientation(x.GoPointer())
588 return cret
589}
590
591// Sets the orientation of the @orientable.
592func (x *Box) SetOrientation(OrientationVar Orientation) {
593
594 XGtkOrientableSetOrientation(x.GoPointer(), OrientationVar)
595
596}
597
598func init() {
599 core.SetPackageName("GTK", "gtk4")
600 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
601 var libs []uintptr
602 for _, libPath := range core.GetPaths("GTK") {
603 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
604 if err != nil {
605 panic(err)
606 }
607 libs = append(libs, lib)
608 }
609
610 core.PuregoSafeRegister(&xBoxGLibType, libs, "gtk_box_get_type")
611
612 core.PuregoSafeRegister(&xNewBox, libs, "gtk_box_new")
613
614 core.PuregoSafeRegister(&xBoxAppend, libs, "gtk_box_append")
615 core.PuregoSafeRegister(&xBoxGetBaselineChild, libs, "gtk_box_get_baseline_child")
616 core.PuregoSafeRegister(&xBoxGetBaselinePosition, libs, "gtk_box_get_baseline_position")
617 core.PuregoSafeRegister(&xBoxGetHomogeneous, libs, "gtk_box_get_homogeneous")
618 core.PuregoSafeRegister(&xBoxGetSpacing, libs, "gtk_box_get_spacing")
619 core.PuregoSafeRegister(&xBoxInsertChildAfter, libs, "gtk_box_insert_child_after")
620 core.PuregoSafeRegister(&xBoxPrepend, libs, "gtk_box_prepend")
621 core.PuregoSafeRegister(&xBoxRemove, libs, "gtk_box_remove")
622 core.PuregoSafeRegister(&xBoxReorderChildAfter, libs, "gtk_box_reorder_child_after")
623 core.PuregoSafeRegister(&xBoxSetBaselineChild, libs, "gtk_box_set_baseline_child")
624 core.PuregoSafeRegister(&xBoxSetBaselinePosition, libs, "gtk_box_set_baseline_position")
625 core.PuregoSafeRegister(&xBoxSetHomogeneous, libs, "gtk_box_set_homogeneous")
626 core.PuregoSafeRegister(&xBoxSetSpacing, libs, "gtk_box_set_spacing")
627
628}