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