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/gobject"
9 "github.com/bnema/puregotk/v4/gobject/types"
10)
11
12// Shows a row of buttons to switch between `GtkStack` pages.
13//
14// <picture>
15//
16// <source srcset="stackswitcher-dark.png" media="(prefers-color-scheme: dark)">
17// <img alt="An example GtkStackSwitcher" src="stackswitcher.png">
18//
19// </picture>
20//
21// It acts as a controller for the associated `GtkStack`.
22//
23// All the content for the buttons comes from the properties of the stacks
24// [class@Gtk.StackPage] objects; the button visibility in a `GtkStackSwitcher`
25// widget is controlled by the visibility of the child in the `GtkStack`.
26//
27// It is possible to associate multiple `GtkStackSwitcher` widgets
28// with the same `GtkStack` widget.
29//
30// # CSS nodes
31//
32// `GtkStackSwitcher` has a single CSS node named stackswitcher and
33// style class .stack-switcher.
34//
35// When circumstances require it, `GtkStackSwitcher` adds the
36// .needs-attention style class to the widgets representing the
37// stack pages.
38//
39// # Accessibility
40//
41// `GtkStackSwitcher` uses the [enum@Gtk.AccessibleRole.tab_list] role
42// and uses the [enum@Gtk.AccessibleRole.tab] role for its buttons.
43//
44// # Orientable
45//
46// Since GTK 4.4, `GtkStackSwitcher` implements `GtkOrientable` allowing
47// the stack switcher to be made vertical with
48// `gtk_orientable_set_orientation()`.
49type StackSwitcher struct {
50 Widget
51}
52
53var xStackSwitcherGLibType func() types.GType
54
55func StackSwitcherGLibType() types.GType {
56 return xStackSwitcherGLibType()
57}
58
59func StackSwitcherNewFromInternalPtr(ptr uintptr) *StackSwitcher {
60 cls := &StackSwitcher{}
61 cls.Ptr = ptr
62 return cls
63}
64
65var xNewStackSwitcher func() uintptr
66
67// Create a new `GtkStackSwitcher`.
68func NewStackSwitcher() *StackSwitcher {
69 var cls *StackSwitcher
70
71 cret := xNewStackSwitcher()
72
73 if cret == 0 {
74 return nil
75 }
76 gobject.IncreaseRef(cret)
77 cls = &StackSwitcher{}
78 cls.Ptr = cret
79 return cls
80}
81
82var xStackSwitcherGetStack func(uintptr) uintptr
83
84// Retrieves the stack.
85func (x *StackSwitcher) GetStack() *Stack {
86 var cls *Stack
87
88 cret := xStackSwitcherGetStack(x.GoPointer())
89
90 if cret == 0 {
91 return nil
92 }
93 gobject.IncreaseRef(cret)
94 cls = &Stack{}
95 cls.Ptr = cret
96 return cls
97}
98
99var xStackSwitcherSetStack func(uintptr, uintptr)
100
101// Sets the stack to control.
102func (x *StackSwitcher) SetStack(StackVar *Stack) {
103
104 xStackSwitcherSetStack(x.GoPointer(), StackVar.GoPointer())
105
106}
107
108func (c *StackSwitcher) GoPointer() uintptr {
109 if c == nil {
110 return 0
111 }
112 return c.Ptr
113}
114
115func (c *StackSwitcher) SetGoPointer(ptr uintptr) {
116 c.Ptr = ptr
117}
118
119// Requests the user's screen reader to announce the given message.
120//
121// This kind of notification is useful for messages that
122// either have only a visual representation or that are not
123// exposed visually at all, e.g. a notification about a
124// successful operation.
125//
126// Also, by using this API, you can ensure that the message
127// does not interrupts the user's current screen reader output.
128func (x *StackSwitcher) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
129
130 XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
131
132}
133
134// Retrieves the accessible parent for an accessible object.
135//
136// This function returns `NULL` for top level widgets.
137func (x *StackSwitcher) GetAccessibleParent() *AccessibleBase {
138 var cls *AccessibleBase
139
140 cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
141
142 if cret == 0 {
143 return nil
144 }
145 cls = &AccessibleBase{}
146 cls.Ptr = cret
147 return cls
148}
149
150// Retrieves the accessible role of an accessible object.
151func (x *StackSwitcher) GetAccessibleRole() AccessibleRole {
152
153 cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
154 return cret
155}
156
157// Retrieves the implementation for the given accessible object.
158func (x *StackSwitcher) GetAtContext() *ATContext {
159 var cls *ATContext
160
161 cret := XGtkAccessibleGetAtContext(x.GoPointer())
162
163 if cret == 0 {
164 return nil
165 }
166 cls = &ATContext{}
167 cls.Ptr = cret
168 return cls
169}
170
171// Queries the coordinates and dimensions of this accessible
172//
173// This functionality can be overridden by `GtkAccessible`
174// implementations, e.g. to get the bounds from an ignored
175// child widget.
176func (x *StackSwitcher) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
177
178 cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
179 return cret
180}
181
182// Retrieves the first accessible child of an accessible object.
183func (x *StackSwitcher) GetFirstAccessibleChild() *AccessibleBase {
184 var cls *AccessibleBase
185
186 cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
187
188 if cret == 0 {
189 return nil
190 }
191 cls = &AccessibleBase{}
192 cls.Ptr = cret
193 return cls
194}
195
196// Retrieves the next accessible sibling of an accessible object
197func (x *StackSwitcher) GetNextAccessibleSibling() *AccessibleBase {
198 var cls *AccessibleBase
199
200 cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
201
202 if cret == 0 {
203 return nil
204 }
205 cls = &AccessibleBase{}
206 cls.Ptr = cret
207 return cls
208}
209
210// Queries a platform state, such as focus.
211//
212// This functionality can be overridden by `GtkAccessible`
213// implementations, e.g. to get platform state from an ignored
214// child widget, as is the case for `GtkText` wrappers.
215func (x *StackSwitcher) GetPlatformState(StateVar AccessiblePlatformState) bool {
216
217 cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
218 return cret
219}
220
221// Resets the accessible property to its default value.
222func (x *StackSwitcher) ResetProperty(PropertyVar AccessibleProperty) {
223
224 XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
225
226}
227
228// Resets the accessible relation to its default value.
229func (x *StackSwitcher) ResetRelation(RelationVar AccessibleRelation) {
230
231 XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
232
233}
234
235// Resets the accessible state to its default value.
236func (x *StackSwitcher) ResetState(StateVar AccessibleState) {
237
238 XGtkAccessibleResetState(x.GoPointer(), StateVar)
239
240}
241
242// Sets the parent and sibling of an accessible object.
243//
244// This function is meant to be used by accessible implementations that are
245// not part of the widget hierarchy, and but act as a logical bridge between
246// widgets. For instance, if a widget creates an object that holds metadata
247// for each child, and you want that object to implement the `GtkAccessible`
248// interface, you will use this function to ensure that the parent of each
249// child widget is the metadata object, and the parent of each metadata
250// object is the container widget.
251func (x *StackSwitcher) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
252
253 XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
254
255}
256
257// Updates the next accessible sibling.
258//
259// That might be useful when a new child of a custom accessible
260// is created, and it needs to be linked to a previous child.
261func (x *StackSwitcher) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
262
263 XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
264
265}
266
267// Informs ATs that the platform state has changed.
268//
269// This function should be used by `GtkAccessible` implementations that
270// have a platform state but are not widgets. Widgets handle platform
271// states automatically.
272func (x *StackSwitcher) UpdatePlatformState(StateVar AccessiblePlatformState) {
273
274 XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
275
276}
277
278// Updates a list of accessible properties.
279//
280// See the [enum@Gtk.AccessibleProperty] documentation for the
281// value types of accessible properties.
282//
283// This function should be called by `GtkWidget` types whenever
284// an accessible property change must be communicated to assistive
285// technologies.
286//
287// Example:
288// ```c
289// value = gtk_adjustment_get_value (adjustment);
290// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
291//
292// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
293// -1);
294//
295// ```
296func (x *StackSwitcher) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
297
298 XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
299
300}
301
302// Updates an array of accessible properties.
303//
304// This function should be called by `GtkWidget` types whenever an accessible
305// property change must be communicated to assistive technologies.
306//
307// This function is meant to be used by language bindings.
308func (x *StackSwitcher) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
309
310 XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
311
312}
313
314// Updates a list of accessible relations.
315//
316// This function should be called by `GtkWidget` types whenever an accessible
317// relation change must be communicated to assistive technologies.
318//
319// If the [enum@Gtk.AccessibleRelation] requires a list of references,
320// you should pass each reference individually, followed by `NULL`, e.g.
321//
322// ```c
323// gtk_accessible_update_relation (accessible,
324//
325// GTK_ACCESSIBLE_RELATION_CONTROLS,
326// ref1, NULL,
327// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
328// ref1, ref2, ref3, NULL,
329// -1);
330//
331// ```
332func (x *StackSwitcher) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
333
334 XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
335
336}
337
338// Updates an array of accessible relations.
339//
340// This function should be called by `GtkWidget` types whenever an accessible
341// relation change must be communicated to assistive technologies.
342//
343// This function is meant to be used by language bindings.
344func (x *StackSwitcher) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
345
346 XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
347
348}
349
350// Updates a list of accessible states.
351//
352// See the [enum@Gtk.AccessibleState] documentation for the
353// value types of accessible states.
354//
355// This function should be called by `GtkWidget` types whenever
356// an accessible state change must be communicated to assistive
357// technologies.
358//
359// Example:
360//
361// ```c
362// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
363// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
364//
365// GTK_ACCESSIBLE_STATE_CHECKED, value,
366// -1);
367//
368// ```
369func (x *StackSwitcher) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
370
371 XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
372
373}
374
375// Updates an array of accessible states.
376//
377// This function should be called by `GtkWidget` types whenever an accessible
378// state change must be communicated to assistive technologies.
379//
380// This function is meant to be used by language bindings.
381func (x *StackSwitcher) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
382
383 XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
384
385}
386
387// Gets the ID of the @buildable object.
388//
389// `GtkBuilder` sets the name based on the ID attribute
390// of the `<object>` tag used to construct the @buildable.
391func (x *StackSwitcher) GetBuildableId() string {
392
393 cret := XGtkBuildableGetBuildableId(x.GoPointer())
394 return cret
395}
396
397// Retrieves the orientation of the @orientable.
398func (x *StackSwitcher) GetOrientation() Orientation {
399
400 cret := XGtkOrientableGetOrientation(x.GoPointer())
401 return cret
402}
403
404// Sets the orientation of the @orientable.
405func (x *StackSwitcher) SetOrientation(OrientationVar Orientation) {
406
407 XGtkOrientableSetOrientation(x.GoPointer(), OrientationVar)
408
409}
410
411func init() {
412 core.SetPackageName("GTK", "gtk4")
413 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
414 var libs []uintptr
415 for _, libPath := range core.GetPaths("GTK") {
416 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
417 if err != nil {
418 panic(err)
419 }
420 libs = append(libs, lib)
421 }
422
423 core.PuregoSafeRegister(&xStackSwitcherGLibType, libs, "gtk_stack_switcher_get_type")
424
425 core.PuregoSafeRegister(&xNewStackSwitcher, libs, "gtk_stack_switcher_new")
426
427 core.PuregoSafeRegister(&xStackSwitcherGetStack, libs, "gtk_stack_switcher_get_stack")
428 core.PuregoSafeRegister(&xStackSwitcherSetStack, libs, "gtk_stack_switcher_set_stack")
429
430}