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