1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "unsafe"
6
7 "github.com/ebitengine/purego"
8
9 "github.com/bnema/puregotk/pkg/core"
10 "github.com/bnema/puregotk/v4/gdk"
11 "github.com/bnema/puregotk/v4/glib"
12 "github.com/bnema/puregotk/v4/gobject"
13 "github.com/bnema/puregotk/v4/gobject/types"
14)
15
16const (
17 // Constant to return from a signal handler for the ::input
18 // signal in case of conversion failure.
19 //
20 // See [signal@Gtk.SpinButton::input].
21 INPUT_ERROR int = -1
22)
23
24// Determines whether the spin button displays values outside the adjustment
25// bounds.
26//
27// See [method@Gtk.SpinButton.set_update_policy].
28type SpinButtonUpdatePolicy int
29
30var xSpinButtonUpdatePolicyGLibType func() types.GType
31
32func SpinButtonUpdatePolicyGLibType() types.GType {
33 return xSpinButtonUpdatePolicyGLibType()
34}
35
36const (
37
38 // When refreshing your `GtkSpinButton`, the value is
39 // always displayed
40 UpdateAlwaysValue SpinButtonUpdatePolicy = 0
41 // When refreshing your `GtkSpinButton`, the value is
42 // only displayed if it is valid within the bounds of the spin button's
43 // adjustment
44 UpdateIfValidValue SpinButtonUpdatePolicy = 1
45)
46
47// The values of the GtkSpinType enumeration are used to specify the
48// change to make in gtk_spin_button_spin().
49type SpinType int
50
51var xSpinTypeGLibType func() types.GType
52
53func SpinTypeGLibType() types.GType {
54 return xSpinTypeGLibType()
55}
56
57const (
58
59 // Increment by the adjustments step increment.
60 SpinStepForwardValue SpinType = 0
61 // Decrement by the adjustments step increment.
62 SpinStepBackwardValue SpinType = 1
63 // Increment by the adjustments page increment.
64 SpinPageForwardValue SpinType = 2
65 // Decrement by the adjustments page increment.
66 SpinPageBackwardValue SpinType = 3
67 // Go to the adjustments lower bound.
68 SpinHomeValue SpinType = 4
69 // Go to the adjustments upper bound.
70 SpinEndValue SpinType = 5
71 // Change by a specified amount.
72 SpinUserDefinedValue SpinType = 6
73)
74
75// Allows to enter or change numeric values.
76//
77// <picture>
78//
79// <source srcset="spinbutton-dark.png" media="(prefers-color-scheme: dark)">
80// <img alt="An example GtkSpinButton" src="spinbutton.png">
81//
82// </picture>
83//
84// Rather than having to directly type a number into a `GtkEntry`,
85// `GtkSpinButton` allows the user to click on one of two arrows
86// to increment or decrement the displayed value. A value can still be
87// typed in, with the bonus that it can be checked to ensure it is in a
88// given range.
89//
90// The main properties of a `GtkSpinButton` are through an adjustment.
91// See the [class@Gtk.Adjustment] documentation for more details about
92// an adjustment's properties.
93//
94// Note that `GtkSpinButton` will by default make its entry large enough
95// to accommodate the lower and upper bounds of the adjustment. If this
96// is not desired, the automatic sizing can be turned off by explicitly
97// setting [property@Gtk.Editable:width-chars] to a value != -1.
98//
99// ## Using a GtkSpinButton to get an integer
100//
101// ```c
102// // Provides a function to retrieve an integer value from a GtkSpinButton
103// // and creates a spin button to model percentage values.
104//
105// int
106// grab_int_value (GtkSpinButton *button,
107//
108// gpointer user_data)
109//
110// {
111// return gtk_spin_button_get_value_as_int (button);
112// }
113//
114// void
115// create_integer_spin_button (void)
116// {
117//
118// GtkWidget *window, *button;
119// GtkAdjustment *adjustment;
120//
121// adjustment = gtk_adjustment_new (50.0, 0.0, 100.0, 1.0, 5.0, 0.0);
122//
123// window = gtk_window_new ();
124//
125// // creates the spinbutton, with no decimal places
126// button = gtk_spin_button_new (adjustment, 1.0, 0);
127// gtk_window_set_child (GTK_WINDOW (window), button);
128//
129// gtk_window_present (GTK_WINDOW (window));
130// }
131//
132// ```
133//
134// ## Using a GtkSpinButton to get a floating point value
135//
136// ```c
137// // Provides a function to retrieve a floating point value from a
138// // GtkSpinButton, and creates a high precision spin button.
139//
140// float
141// grab_float_value (GtkSpinButton *button,
142//
143// gpointer user_data)
144//
145// {
146// return gtk_spin_button_get_value (button);
147// }
148//
149// void
150// create_floating_spin_button (void)
151//
152// {
153// GtkWidget *window, *button;
154// GtkAdjustment *adjustment;
155//
156// adjustment = gtk_adjustment_new (2.500, 0.0, 5.0, 0.001, 0.1, 0.0);
157//
158// window = gtk_window_new ();
159//
160// // creates the spinbutton, with three decimal places
161// button = gtk_spin_button_new (adjustment, 0.001, 3);
162// gtk_window_set_child (GTK_WINDOW (window), button);
163//
164// gtk_window_present (GTK_WINDOW (window));
165// }
166//
167// ```
168//
169// # Shortcuts and Gestures
170//
171// The following signals have default keybindings:
172//
173// - [signal@Gtk.SpinButton::change-value]
174//
175// # CSS nodes
176//
177// ```
178// spinbutton.horizontal
179// ├── text
180// │ ├── undershoot.left
181// │ ╰── undershoot.right
182// ├── button.down
183// ╰── button.up
184// ```
185//
186// ```
187// spinbutton.vertical
188// ├── button.up
189// ├── text
190// │ ├── undershoot.left
191// │ ╰── undershoot.right
192// ╰── button.down
193// ```
194//
195// `GtkSpinButton`s main CSS node has the name spinbutton. It creates subnodes
196// for the entry and the two buttons, with these names. The button nodes have
197// the style classes .up and .down. The `GtkText` subnodes (if present) are put
198// below the text node. The orientation of the spin button is reflected in
199// the .vertical or .horizontal style class on the main node.
200//
201// # Accessibility
202//
203// `GtkSpinButton` uses the [enum@Gtk.AccessibleRole.spin_button] role.
204type SpinButton struct {
205 Widget
206}
207
208var xSpinButtonGLibType func() types.GType
209
210func SpinButtonGLibType() types.GType {
211 return xSpinButtonGLibType()
212}
213
214func SpinButtonNewFromInternalPtr(ptr uintptr) *SpinButton {
215 cls := &SpinButton{}
216 cls.Ptr = ptr
217 return cls
218}
219
220var xNewSpinButton func(uintptr, float64, uint) uintptr
221
222// Creates a new `GtkSpinButton`.
223func NewSpinButton(AdjustmentVar *Adjustment, ClimbRateVar float64, DigitsVar uint) *SpinButton {
224 var cls *SpinButton
225
226 cret := xNewSpinButton(AdjustmentVar.GoPointer(), ClimbRateVar, DigitsVar)
227
228 if cret == 0 {
229 return nil
230 }
231 gobject.IncreaseRef(cret)
232 cls = &SpinButton{}
233 cls.Ptr = cret
234 return cls
235}
236
237var xNewSpinButtonWithRange func(float64, float64, float64) uintptr
238
239// Creates a new `GtkSpinButton` with the given properties.
240//
241// This is a convenience constructor that allows creation
242// of a numeric `GtkSpinButton` without manually creating
243// an adjustment. The value is initially set to the minimum
244// value and a page increment of 10 * @step is the default.
245// The precision of the spin button is equivalent to the
246// precision of @step.
247//
248// Note that the way in which the precision is derived works
249// best if @step is a power of ten. If the resulting precision
250// is not suitable for your needs, use
251// [method@Gtk.SpinButton.set_digits] to correct it.
252func NewSpinButtonWithRange(MinVar float64, MaxVar float64, StepVar float64) *SpinButton {
253 var cls *SpinButton
254
255 cret := xNewSpinButtonWithRange(MinVar, MaxVar, StepVar)
256
257 if cret == 0 {
258 return nil
259 }
260 gobject.IncreaseRef(cret)
261 cls = &SpinButton{}
262 cls.Ptr = cret
263 return cls
264}
265
266var xSpinButtonConfigure func(uintptr, uintptr, float64, uint)
267
268// Changes the properties of an existing spin button.
269//
270// The adjustment, climb rate, and number of decimal places
271// are updated accordingly.
272func (x *SpinButton) Configure(AdjustmentVar *Adjustment, ClimbRateVar float64, DigitsVar uint) {
273
274 xSpinButtonConfigure(x.GoPointer(), AdjustmentVar.GoPointer(), ClimbRateVar, DigitsVar)
275
276}
277
278var xSpinButtonGetActivatesDefault func(uintptr) bool
279
280// Retrieves the value set by [method@Gtk.SpinButton.set_activates_default].
281func (x *SpinButton) GetActivatesDefault() bool {
282
283 cret := xSpinButtonGetActivatesDefault(x.GoPointer())
284 return cret
285}
286
287var xSpinButtonGetAdjustment func(uintptr) uintptr
288
289// Get the adjustment associated with a `GtkSpinButton`.
290func (x *SpinButton) GetAdjustment() *Adjustment {
291 var cls *Adjustment
292
293 cret := xSpinButtonGetAdjustment(x.GoPointer())
294
295 if cret == 0 {
296 return nil
297 }
298 gobject.IncreaseRef(cret)
299 cls = &Adjustment{}
300 cls.Ptr = cret
301 return cls
302}
303
304var xSpinButtonGetClimbRate func(uintptr) float64
305
306// Returns the acceleration rate for repeated changes.
307func (x *SpinButton) GetClimbRate() float64 {
308
309 cret := xSpinButtonGetClimbRate(x.GoPointer())
310 return cret
311}
312
313var xSpinButtonGetDigits func(uintptr) uint
314
315// Fetches the precision of @spin_button.
316func (x *SpinButton) GetDigits() uint {
317
318 cret := xSpinButtonGetDigits(x.GoPointer())
319 return cret
320}
321
322var xSpinButtonGetIncrements func(uintptr, *float64, *float64)
323
324// Gets the current step and page the increments
325// used by @spin_button.
326//
327// See [method@Gtk.SpinButton.set_increments].
328func (x *SpinButton) GetIncrements(StepVar *float64, PageVar *float64) {
329
330 xSpinButtonGetIncrements(x.GoPointer(), StepVar, PageVar)
331
332}
333
334var xSpinButtonGetNumeric func(uintptr) bool
335
336// Returns whether non-numeric text can be typed into the spin button.
337func (x *SpinButton) GetNumeric() bool {
338
339 cret := xSpinButtonGetNumeric(x.GoPointer())
340 return cret
341}
342
343var xSpinButtonGetRange func(uintptr, *float64, *float64)
344
345// Gets the range allowed for @spin_button.
346//
347// See [method@Gtk.SpinButton.set_range].
348func (x *SpinButton) GetRange(MinVar *float64, MaxVar *float64) {
349
350 xSpinButtonGetRange(x.GoPointer(), MinVar, MaxVar)
351
352}
353
354var xSpinButtonGetSnapToTicks func(uintptr) bool
355
356// Returns whether the values are corrected to the nearest step.
357func (x *SpinButton) GetSnapToTicks() bool {
358
359 cret := xSpinButtonGetSnapToTicks(x.GoPointer())
360 return cret
361}
362
363var xSpinButtonGetUpdatePolicy func(uintptr) SpinButtonUpdatePolicy
364
365// Gets the update behavior of a spin button.
366//
367// See [method@Gtk.SpinButton.set_update_policy].
368func (x *SpinButton) GetUpdatePolicy() SpinButtonUpdatePolicy {
369
370 cret := xSpinButtonGetUpdatePolicy(x.GoPointer())
371 return cret
372}
373
374var xSpinButtonGetValue func(uintptr) float64
375
376// Get the value in the @spin_button.
377func (x *SpinButton) GetValue() float64 {
378
379 cret := xSpinButtonGetValue(x.GoPointer())
380 return cret
381}
382
383var xSpinButtonGetValueAsInt func(uintptr) int
384
385// Get the value @spin_button represented as an integer.
386func (x *SpinButton) GetValueAsInt() int {
387
388 cret := xSpinButtonGetValueAsInt(x.GoPointer())
389 return cret
390}
391
392var xSpinButtonGetWrap func(uintptr) bool
393
394// Returns whether the spin button’s value wraps around to the
395// opposite limit when the upper or lower limit of the range is
396// exceeded.
397func (x *SpinButton) GetWrap() bool {
398
399 cret := xSpinButtonGetWrap(x.GoPointer())
400 return cret
401}
402
403var xSpinButtonSetActivatesDefault func(uintptr, bool)
404
405// Sets whether activating the spin button will activate the default
406// widget for the window containing the spin button.
407//
408// See [signal@Gtk.SpinButton::activate] for what counts as activation.
409func (x *SpinButton) SetActivatesDefault(ActivatesDefaultVar bool) {
410
411 xSpinButtonSetActivatesDefault(x.GoPointer(), ActivatesDefaultVar)
412
413}
414
415var xSpinButtonSetAdjustment func(uintptr, uintptr)
416
417// Replaces the `GtkAdjustment` associated with @spin_button.
418func (x *SpinButton) SetAdjustment(AdjustmentVar *Adjustment) {
419
420 xSpinButtonSetAdjustment(x.GoPointer(), AdjustmentVar.GoPointer())
421
422}
423
424var xSpinButtonSetClimbRate func(uintptr, float64)
425
426// Sets the acceleration rate for repeated changes when you
427// hold down a button or key.
428func (x *SpinButton) SetClimbRate(ClimbRateVar float64) {
429
430 xSpinButtonSetClimbRate(x.GoPointer(), ClimbRateVar)
431
432}
433
434var xSpinButtonSetDigits func(uintptr, uint)
435
436// Set the precision to be displayed by @spin_button.
437//
438// Up to 20 digit precision is allowed.
439func (x *SpinButton) SetDigits(DigitsVar uint) {
440
441 xSpinButtonSetDigits(x.GoPointer(), DigitsVar)
442
443}
444
445var xSpinButtonSetIncrements func(uintptr, float64, float64)
446
447// Sets the step and page increments for spin_button.
448//
449// This affects how quickly the value changes when
450// the spin button’s arrows are activated.
451func (x *SpinButton) SetIncrements(StepVar float64, PageVar float64) {
452
453 xSpinButtonSetIncrements(x.GoPointer(), StepVar, PageVar)
454
455}
456
457var xSpinButtonSetNumeric func(uintptr, bool)
458
459// Sets the flag that determines if non-numeric text can be typed
460// into the spin button.
461func (x *SpinButton) SetNumeric(NumericVar bool) {
462
463 xSpinButtonSetNumeric(x.GoPointer(), NumericVar)
464
465}
466
467var xSpinButtonSetRange func(uintptr, float64, float64)
468
469// Sets the minimum and maximum allowable values for @spin_button.
470//
471// If the current value is outside this range, it will be adjusted
472// to fit within the range, otherwise it will remain unchanged.
473func (x *SpinButton) SetRange(MinVar float64, MaxVar float64) {
474
475 xSpinButtonSetRange(x.GoPointer(), MinVar, MaxVar)
476
477}
478
479var xSpinButtonSetSnapToTicks func(uintptr, bool)
480
481// Sets the policy as to whether values are corrected to the
482// nearest step increment when a spin button is activated after
483// providing an invalid value.
484func (x *SpinButton) SetSnapToTicks(SnapToTicksVar bool) {
485
486 xSpinButtonSetSnapToTicks(x.GoPointer(), SnapToTicksVar)
487
488}
489
490var xSpinButtonSetUpdatePolicy func(uintptr, SpinButtonUpdatePolicy)
491
492// Sets the update behavior of a spin button.
493//
494// This determines whether the spin button is always
495// updated or only when a valid value is set.
496func (x *SpinButton) SetUpdatePolicy(PolicyVar SpinButtonUpdatePolicy) {
497
498 xSpinButtonSetUpdatePolicy(x.GoPointer(), PolicyVar)
499
500}
501
502var xSpinButtonSetValue func(uintptr, float64)
503
504// Sets the value of @spin_button.
505func (x *SpinButton) SetValue(ValueVar float64) {
506
507 xSpinButtonSetValue(x.GoPointer(), ValueVar)
508
509}
510
511var xSpinButtonSetWrap func(uintptr, bool)
512
513// Sets the flag that determines if a spin button value wraps
514// around to the opposite limit when the upper or lower limit
515// of the range is exceeded.
516func (x *SpinButton) SetWrap(WrapVar bool) {
517
518 xSpinButtonSetWrap(x.GoPointer(), WrapVar)
519
520}
521
522var xSpinButtonSpin func(uintptr, SpinType, float64)
523
524// Increment or decrement a spin button’s value in a specified
525// direction by a specified amount.
526func (x *SpinButton) Spin(DirectionVar SpinType, IncrementVar float64) {
527
528 xSpinButtonSpin(x.GoPointer(), DirectionVar, IncrementVar)
529
530}
531
532var xSpinButtonUpdate func(uintptr)
533
534// Manually force an update of the spin button.
535func (x *SpinButton) Update() {
536
537 xSpinButtonUpdate(x.GoPointer())
538
539}
540
541func (c *SpinButton) GoPointer() uintptr {
542 if c == nil {
543 return 0
544 }
545 return c.Ptr
546}
547
548func (c *SpinButton) SetGoPointer(ptr uintptr) {
549 c.Ptr = ptr
550}
551
552// SetPropertyActivatesDefault sets the "activates-default" property.
553// Whether to activate the default widget when the spin button is activated.
554//
555// See [signal@Gtk.SpinButton::activate] for what counts as activation.
556func (x *SpinButton) SetPropertyActivatesDefault(value bool) {
557 var v gobject.Value
558 v.Init(gobject.TypeBooleanVal)
559 v.SetBoolean(value)
560 x.SetProperty("activates-default", &v)
561}
562
563// GetPropertyActivatesDefault gets the "activates-default" property.
564// Whether to activate the default widget when the spin button is activated.
565//
566// See [signal@Gtk.SpinButton::activate] for what counts as activation.
567func (x *SpinButton) GetPropertyActivatesDefault() bool {
568 var v gobject.Value
569 x.GetProperty("activates-default", &v)
570 return v.GetBoolean()
571}
572
573// SetPropertyClimbRate sets the "climb-rate" property.
574// The acceleration rate when you hold down a button or key.
575func (x *SpinButton) SetPropertyClimbRate(value float64) {
576 var v gobject.Value
577 v.Init(gobject.TypeDoubleVal)
578 v.SetDouble(value)
579 x.SetProperty("climb-rate", &v)
580}
581
582// GetPropertyClimbRate gets the "climb-rate" property.
583// The acceleration rate when you hold down a button or key.
584func (x *SpinButton) GetPropertyClimbRate() float64 {
585 var v gobject.Value
586 x.GetProperty("climb-rate", &v)
587 return v.GetDouble()
588}
589
590// SetPropertyDigits sets the "digits" property.
591// The number of decimal places to display.
592func (x *SpinButton) SetPropertyDigits(value uint) {
593 var v gobject.Value
594 v.Init(gobject.TypeUintVal)
595 v.SetUint(value)
596 x.SetProperty("digits", &v)
597}
598
599// GetPropertyDigits gets the "digits" property.
600// The number of decimal places to display.
601func (x *SpinButton) GetPropertyDigits() uint {
602 var v gobject.Value
603 x.GetProperty("digits", &v)
604 return v.GetUint()
605}
606
607// SetPropertyNumeric sets the "numeric" property.
608// Whether non-numeric characters should be ignored.
609func (x *SpinButton) SetPropertyNumeric(value bool) {
610 var v gobject.Value
611 v.Init(gobject.TypeBooleanVal)
612 v.SetBoolean(value)
613 x.SetProperty("numeric", &v)
614}
615
616// GetPropertyNumeric gets the "numeric" property.
617// Whether non-numeric characters should be ignored.
618func (x *SpinButton) GetPropertyNumeric() bool {
619 var v gobject.Value
620 x.GetProperty("numeric", &v)
621 return v.GetBoolean()
622}
623
624// SetPropertySnapToTicks sets the "snap-to-ticks" property.
625// Whether erroneous values are automatically changed to the spin buttons
626// nearest step increment.
627func (x *SpinButton) SetPropertySnapToTicks(value bool) {
628 var v gobject.Value
629 v.Init(gobject.TypeBooleanVal)
630 v.SetBoolean(value)
631 x.SetProperty("snap-to-ticks", &v)
632}
633
634// GetPropertySnapToTicks gets the "snap-to-ticks" property.
635// Whether erroneous values are automatically changed to the spin buttons
636// nearest step increment.
637func (x *SpinButton) GetPropertySnapToTicks() bool {
638 var v gobject.Value
639 x.GetProperty("snap-to-ticks", &v)
640 return v.GetBoolean()
641}
642
643// SetPropertyValue sets the "value" property.
644// The current value.
645func (x *SpinButton) SetPropertyValue(value float64) {
646 var v gobject.Value
647 v.Init(gobject.TypeDoubleVal)
648 v.SetDouble(value)
649 x.SetProperty("value", &v)
650}
651
652// GetPropertyValue gets the "value" property.
653// The current value.
654func (x *SpinButton) GetPropertyValue() float64 {
655 var v gobject.Value
656 x.GetProperty("value", &v)
657 return v.GetDouble()
658}
659
660// SetPropertyWrap sets the "wrap" property.
661// Whether a spin button should wrap upon reaching its limits.
662func (x *SpinButton) SetPropertyWrap(value bool) {
663 var v gobject.Value
664 v.Init(gobject.TypeBooleanVal)
665 v.SetBoolean(value)
666 x.SetProperty("wrap", &v)
667}
668
669// GetPropertyWrap gets the "wrap" property.
670// Whether a spin button should wrap upon reaching its limits.
671func (x *SpinButton) GetPropertyWrap() bool {
672 var v gobject.Value
673 x.GetProperty("wrap", &v)
674 return v.GetBoolean()
675}
676
677// Emitted when the spin button is activated.
678//
679// The keybindings for this signal are all forms of the <kbd>Enter</kbd> key.
680//
681// If the <kbd>Enter</kbd> key results in the value being committed to the
682// spin button, then activation does not occur until <kbd>Enter</kbd> is
683// pressed again.
684func (x *SpinButton) ConnectActivate(cb *func(SpinButton)) uint {
685 cbPtr := uintptr(unsafe.Pointer(cb))
686 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
687 handlerID := gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr)
688 glib.SaveHandlerMapping(handlerID, cbPtr)
689 return handlerID
690 }
691
692 fcb := func(clsPtr uintptr) {
693 fa := SpinButton{}
694 fa.Ptr = clsPtr
695 cbFn := *cb
696
697 cbFn(fa)
698
699 }
700 cbRefPtr := purego.NewCallback(fcb)
701 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
702 handlerID := gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr)
703 glib.SaveHandlerMapping(handlerID, cbPtr)
704 return handlerID
705}
706
707// Emitted when the user initiates a value change.
708//
709// This is a [keybinding signal](class.SignalAction.html).
710//
711// Applications should not connect to it, but may emit it with
712// g_signal_emit_by_name() if they need to control the cursor
713// programmatically.
714//
715// The default bindings for this signal are Up/Down and PageUp/PageDown.
716func (x *SpinButton) ConnectChangeValue(cb *func(SpinButton, ScrollType)) uint {
717 cbPtr := uintptr(unsafe.Pointer(cb))
718 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
719 handlerID := gobject.SignalConnect(x.GoPointer(), "change-value", cbRefPtr)
720 glib.SaveHandlerMapping(handlerID, cbPtr)
721 return handlerID
722 }
723
724 fcb := func(clsPtr uintptr, ScrollVarp ScrollType) {
725 fa := SpinButton{}
726 fa.Ptr = clsPtr
727 cbFn := *cb
728
729 cbFn(fa, ScrollVarp)
730
731 }
732 cbRefPtr := purego.NewCallback(fcb)
733 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
734 handlerID := gobject.SignalConnect(x.GoPointer(), "change-value", cbRefPtr)
735 glib.SaveHandlerMapping(handlerID, cbPtr)
736 return handlerID
737}
738
739// Emitted to convert the users input into a double value.
740//
741// The signal handler is expected to use [method@Gtk.Editable.get_text]
742// to retrieve the text of the spinbutton and set @new_value to the
743// new value.
744//
745// The default conversion uses g_strtod().
746func (x *SpinButton) ConnectInput(cb *func(SpinButton, *float64) int) uint {
747 cbPtr := uintptr(unsafe.Pointer(cb))
748 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
749 handlerID := gobject.SignalConnect(x.GoPointer(), "input", cbRefPtr)
750 glib.SaveHandlerMapping(handlerID, cbPtr)
751 return handlerID
752 }
753
754 fcb := func(clsPtr uintptr, NewValueVarp *float64) int {
755 fa := SpinButton{}
756 fa.Ptr = clsPtr
757 cbFn := *cb
758
759 return cbFn(fa, NewValueVarp)
760
761 }
762 cbRefPtr := purego.NewCallback(fcb)
763 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
764 handlerID := gobject.SignalConnect(x.GoPointer(), "input", cbRefPtr)
765 glib.SaveHandlerMapping(handlerID, cbPtr)
766 return handlerID
767}
768
769// Emitted to tweak the formatting of the value for display.
770//
771// ```c
772// // show leading zeros
773// static gboolean
774// on_output (GtkSpinButton *spin,
775//
776// gpointer data)
777//
778// {
779// char *text;
780// int value;
781//
782// value = gtk_spin_button_get_value_as_int (spin);
783// text = g_strdup_printf ("%02d", value);
784// gtk_editable_set_text (GTK_EDITABLE (spin), text):
785// g_free (text);
786//
787// return TRUE;
788// }
789//
790// ```
791func (x *SpinButton) ConnectOutput(cb *func(SpinButton) bool) uint {
792 cbPtr := uintptr(unsafe.Pointer(cb))
793 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
794 handlerID := gobject.SignalConnect(x.GoPointer(), "output", cbRefPtr)
795 glib.SaveHandlerMapping(handlerID, cbPtr)
796 return handlerID
797 }
798
799 fcb := func(clsPtr uintptr) bool {
800 fa := SpinButton{}
801 fa.Ptr = clsPtr
802 cbFn := *cb
803
804 return cbFn(fa)
805
806 }
807 cbRefPtr := purego.NewCallback(fcb)
808 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
809 handlerID := gobject.SignalConnect(x.GoPointer(), "output", cbRefPtr)
810 glib.SaveHandlerMapping(handlerID, cbPtr)
811 return handlerID
812}
813
814// Emitted when the value is changed.
815//
816// Also see the [signal@Gtk.SpinButton::output] signal.
817func (x *SpinButton) ConnectValueChanged(cb *func(SpinButton)) uint {
818 cbPtr := uintptr(unsafe.Pointer(cb))
819 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
820 handlerID := gobject.SignalConnect(x.GoPointer(), "value-changed", cbRefPtr)
821 glib.SaveHandlerMapping(handlerID, cbPtr)
822 return handlerID
823 }
824
825 fcb := func(clsPtr uintptr) {
826 fa := SpinButton{}
827 fa.Ptr = clsPtr
828 cbFn := *cb
829
830 cbFn(fa)
831
832 }
833 cbRefPtr := purego.NewCallback(fcb)
834 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
835 handlerID := gobject.SignalConnect(x.GoPointer(), "value-changed", cbRefPtr)
836 glib.SaveHandlerMapping(handlerID, cbPtr)
837 return handlerID
838}
839
840// Emitted right after the spinbutton wraps from its maximum
841// to its minimum value or vice-versa.
842func (x *SpinButton) ConnectWrapped(cb *func(SpinButton)) uint {
843 cbPtr := uintptr(unsafe.Pointer(cb))
844 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
845 handlerID := gobject.SignalConnect(x.GoPointer(), "wrapped", cbRefPtr)
846 glib.SaveHandlerMapping(handlerID, cbPtr)
847 return handlerID
848 }
849
850 fcb := func(clsPtr uintptr) {
851 fa := SpinButton{}
852 fa.Ptr = clsPtr
853 cbFn := *cb
854
855 cbFn(fa)
856
857 }
858 cbRefPtr := purego.NewCallback(fcb)
859 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
860 handlerID := gobject.SignalConnect(x.GoPointer(), "wrapped", cbRefPtr)
861 glib.SaveHandlerMapping(handlerID, cbPtr)
862 return handlerID
863}
864
865// Requests the user's screen reader to announce the given message.
866//
867// This kind of notification is useful for messages that
868// either have only a visual representation or that are not
869// exposed visually at all, e.g. a notification about a
870// successful operation.
871//
872// Also, by using this API, you can ensure that the message
873// does not interrupts the user's current screen reader output.
874func (x *SpinButton) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
875
876 XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
877
878}
879
880// Retrieves the accessible parent for an accessible object.
881//
882// This function returns `NULL` for top level widgets.
883func (x *SpinButton) GetAccessibleParent() *AccessibleBase {
884 var cls *AccessibleBase
885
886 cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
887
888 if cret == 0 {
889 return nil
890 }
891 cls = &AccessibleBase{}
892 cls.Ptr = cret
893 return cls
894}
895
896// Retrieves the accessible role of an accessible object.
897func (x *SpinButton) GetAccessibleRole() AccessibleRole {
898
899 cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
900 return cret
901}
902
903// Retrieves the implementation for the given accessible object.
904func (x *SpinButton) GetAtContext() *ATContext {
905 var cls *ATContext
906
907 cret := XGtkAccessibleGetAtContext(x.GoPointer())
908
909 if cret == 0 {
910 return nil
911 }
912 cls = &ATContext{}
913 cls.Ptr = cret
914 return cls
915}
916
917// Queries the coordinates and dimensions of this accessible
918//
919// This functionality can be overridden by `GtkAccessible`
920// implementations, e.g. to get the bounds from an ignored
921// child widget.
922func (x *SpinButton) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
923
924 cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
925 return cret
926}
927
928// Retrieves the first accessible child of an accessible object.
929func (x *SpinButton) GetFirstAccessibleChild() *AccessibleBase {
930 var cls *AccessibleBase
931
932 cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
933
934 if cret == 0 {
935 return nil
936 }
937 cls = &AccessibleBase{}
938 cls.Ptr = cret
939 return cls
940}
941
942// Retrieves the next accessible sibling of an accessible object
943func (x *SpinButton) GetNextAccessibleSibling() *AccessibleBase {
944 var cls *AccessibleBase
945
946 cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
947
948 if cret == 0 {
949 return nil
950 }
951 cls = &AccessibleBase{}
952 cls.Ptr = cret
953 return cls
954}
955
956// Queries a platform state, such as focus.
957//
958// This functionality can be overridden by `GtkAccessible`
959// implementations, e.g. to get platform state from an ignored
960// child widget, as is the case for `GtkText` wrappers.
961func (x *SpinButton) GetPlatformState(StateVar AccessiblePlatformState) bool {
962
963 cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
964 return cret
965}
966
967// Resets the accessible property to its default value.
968func (x *SpinButton) ResetProperty(PropertyVar AccessibleProperty) {
969
970 XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
971
972}
973
974// Resets the accessible relation to its default value.
975func (x *SpinButton) ResetRelation(RelationVar AccessibleRelation) {
976
977 XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
978
979}
980
981// Resets the accessible state to its default value.
982func (x *SpinButton) ResetState(StateVar AccessibleState) {
983
984 XGtkAccessibleResetState(x.GoPointer(), StateVar)
985
986}
987
988// Sets the parent and sibling of an accessible object.
989//
990// This function is meant to be used by accessible implementations that are
991// not part of the widget hierarchy, and but act as a logical bridge between
992// widgets. For instance, if a widget creates an object that holds metadata
993// for each child, and you want that object to implement the `GtkAccessible`
994// interface, you will use this function to ensure that the parent of each
995// child widget is the metadata object, and the parent of each metadata
996// object is the container widget.
997func (x *SpinButton) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
998
999 XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
1000
1001}
1002
1003// Updates the next accessible sibling.
1004//
1005// That might be useful when a new child of a custom accessible
1006// is created, and it needs to be linked to a previous child.
1007func (x *SpinButton) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
1008
1009 XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
1010
1011}
1012
1013// Informs ATs that the platform state has changed.
1014//
1015// This function should be used by `GtkAccessible` implementations that
1016// have a platform state but are not widgets. Widgets handle platform
1017// states automatically.
1018func (x *SpinButton) UpdatePlatformState(StateVar AccessiblePlatformState) {
1019
1020 XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
1021
1022}
1023
1024// Updates a list of accessible properties.
1025//
1026// See the [enum@Gtk.AccessibleProperty] documentation for the
1027// value types of accessible properties.
1028//
1029// This function should be called by `GtkWidget` types whenever
1030// an accessible property change must be communicated to assistive
1031// technologies.
1032//
1033// Example:
1034// ```c
1035// value = gtk_adjustment_get_value (adjustment);
1036// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
1037//
1038// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
1039// -1);
1040//
1041// ```
1042func (x *SpinButton) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
1043
1044 XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
1045
1046}
1047
1048// Updates an array of accessible properties.
1049//
1050// This function should be called by `GtkWidget` types whenever an accessible
1051// property change must be communicated to assistive technologies.
1052//
1053// This function is meant to be used by language bindings.
1054func (x *SpinButton) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
1055
1056 XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
1057
1058}
1059
1060// Updates a list of accessible relations.
1061//
1062// This function should be called by `GtkWidget` types whenever an accessible
1063// relation change must be communicated to assistive technologies.
1064//
1065// If the [enum@Gtk.AccessibleRelation] requires a list of references,
1066// you should pass each reference individually, followed by `NULL`, e.g.
1067//
1068// ```c
1069// gtk_accessible_update_relation (accessible,
1070//
1071// GTK_ACCESSIBLE_RELATION_CONTROLS,
1072// ref1, NULL,
1073// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
1074// ref1, ref2, ref3, NULL,
1075// -1);
1076//
1077// ```
1078func (x *SpinButton) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
1079
1080 XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
1081
1082}
1083
1084// Updates an array of accessible relations.
1085//
1086// This function should be called by `GtkWidget` types whenever an accessible
1087// relation change must be communicated to assistive technologies.
1088//
1089// This function is meant to be used by language bindings.
1090func (x *SpinButton) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
1091
1092 XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
1093
1094}
1095
1096// Updates a list of accessible states.
1097//
1098// See the [enum@Gtk.AccessibleState] documentation for the
1099// value types of accessible states.
1100//
1101// This function should be called by `GtkWidget` types whenever
1102// an accessible state change must be communicated to assistive
1103// technologies.
1104//
1105// Example:
1106//
1107// ```c
1108// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
1109// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
1110//
1111// GTK_ACCESSIBLE_STATE_CHECKED, value,
1112// -1);
1113//
1114// ```
1115func (x *SpinButton) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
1116
1117 XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
1118
1119}
1120
1121// Updates an array of accessible states.
1122//
1123// This function should be called by `GtkWidget` types whenever an accessible
1124// state change must be communicated to assistive technologies.
1125//
1126// This function is meant to be used by language bindings.
1127func (x *SpinButton) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
1128
1129 XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
1130
1131}
1132
1133// Gets the ID of the @buildable object.
1134//
1135// `GtkBuilder` sets the name based on the ID attribute
1136// of the `<object>` tag used to construct the @buildable.
1137func (x *SpinButton) GetBuildableId() string {
1138
1139 cret := XGtkBuildableGetBuildableId(x.GoPointer())
1140 return cret
1141}
1142
1143// Emits the `GtkCellEditable::editing-done` signal.
1144func (x *SpinButton) EditingDone() {
1145
1146 XGtkCellEditableEditingDone(x.GoPointer())
1147
1148}
1149
1150// Emits the `GtkCellEditable::remove-widget` signal.
1151func (x *SpinButton) RemoveWidget() {
1152
1153 XGtkCellEditableRemoveWidget(x.GoPointer())
1154
1155}
1156
1157// Begins editing on a @cell_editable.
1158//
1159// The `GtkCellRenderer` for the cell creates and returns a `GtkCellEditable` from
1160// gtk_cell_renderer_start_editing(), configured for the `GtkCellRenderer` type.
1161//
1162// gtk_cell_editable_start_editing() can then set up @cell_editable suitably for
1163// editing a cell, e.g. making the Esc key emit `GtkCellEditable::editing-done`.
1164//
1165// Note that the @cell_editable is created on-demand for the current edit; its
1166// lifetime is temporary and does not persist across other edits and/or cells.
1167func (x *SpinButton) StartEditing(EventVar *gdk.Event) {
1168
1169 XGtkCellEditableStartEditing(x.GoPointer(), EventVar.GoPointer())
1170
1171}
1172
1173// Retrieves the accessible platform state from the editable delegate.
1174//
1175// This is an helper function to retrieve the accessible state for
1176// `GtkEditable` interface implementations using a delegate pattern.
1177//
1178// You should call this function in your editable widget implementation
1179// of the [vfunc@Gtk.Accessible.get_platform_state] virtual function, for
1180// instance:
1181//
1182// ```c
1183// static void
1184// accessible_interface_init (GtkAccessibleInterface *iface)
1185//
1186// {
1187// iface->get_platform_state = your_editable_get_accessible_platform_state;
1188// }
1189//
1190// static gboolean
1191// your_editable_get_accessible_platform_state (GtkAccessible *accessible,
1192//
1193// GtkAccessiblePlatformState state)
1194//
1195// {
1196// return gtk_editable_delegate_get_accessible_platform_state (GTK_EDITABLE (accessible), state);
1197// }
1198//
1199// ```
1200//
1201// Note that the widget which is the delegate *must* be a direct child of
1202// this widget, otherwise your implementation of [vfunc@Gtk.Accessible.get_platform_state]
1203// might not even be called, as the platform change will originate from
1204// the parent of the delegate, and, as a result, will not work properly.
1205//
1206// So, if you can't ensure the direct child condition, you should give the
1207// delegate the %GTK_ACCESSIBLE_ROLE_TEXT_BOX role, or you can
1208// change your tree to allow this function to work.
1209func (x *SpinButton) DelegateGetAccessiblePlatformState(StateVar AccessiblePlatformState) bool {
1210
1211 cret := XGtkEditableDelegateGetAccessiblePlatformState(x.GoPointer(), StateVar)
1212 return cret
1213}
1214
1215// Deletes the currently selected text of the editable.
1216//
1217// This call doesn’t do anything if there is no selected text.
1218func (x *SpinButton) DeleteSelection() {
1219
1220 XGtkEditableDeleteSelection(x.GoPointer())
1221
1222}
1223
1224// Deletes a sequence of characters.
1225//
1226// The characters that are deleted are those characters at positions
1227// from @start_pos up to, but not including @end_pos. If @end_pos is
1228// negative, then the characters deleted are those from @start_pos to
1229// the end of the text.
1230//
1231// Note that the positions are specified in characters, not bytes.
1232func (x *SpinButton) DeleteText(StartPosVar int, EndPosVar int) {
1233
1234 XGtkEditableDeleteText(x.GoPointer(), StartPosVar, EndPosVar)
1235
1236}
1237
1238// Undoes the setup done by [method@Gtk.Editable.init_delegate].
1239//
1240// This is a helper function that should be called from dispose,
1241// before removing the delegate object.
1242func (x *SpinButton) FinishDelegate() {
1243
1244 XGtkEditableFinishDelegate(x.GoPointer())
1245
1246}
1247
1248// Gets the alignment of the editable.
1249func (x *SpinButton) GetAlignment() float32 {
1250
1251 cret := XGtkEditableGetAlignment(x.GoPointer())
1252 return cret
1253}
1254
1255// Retrieves a sequence of characters.
1256//
1257// The characters that are retrieved are those characters at positions
1258// from @start_pos up to, but not including @end_pos. If @end_pos is negative,
1259// then the characters retrieved are those characters from @start_pos to
1260// the end of the text.
1261//
1262// Note that positions are specified in characters, not bytes.
1263func (x *SpinButton) GetChars(StartPosVar int, EndPosVar int) string {
1264
1265 cret := XGtkEditableGetChars(x.GoPointer(), StartPosVar, EndPosVar)
1266 return cret
1267}
1268
1269// Gets the `GtkEditable` that @editable is delegating its
1270// implementation to.
1271//
1272// Typically, the delegate is a [class@Gtk.Text] widget.
1273func (x *SpinButton) GetDelegate() *EditableBase {
1274 var cls *EditableBase
1275
1276 cret := XGtkEditableGetDelegate(x.GoPointer())
1277
1278 if cret == 0 {
1279 return nil
1280 }
1281 gobject.IncreaseRef(cret)
1282 cls = &EditableBase{}
1283 cls.Ptr = cret
1284 return cls
1285}
1286
1287// Retrieves whether @editable is editable.
1288func (x *SpinButton) GetEditable() bool {
1289
1290 cret := XGtkEditableGetEditable(x.GoPointer())
1291 return cret
1292}
1293
1294// Gets if undo/redo actions are enabled for @editable
1295func (x *SpinButton) GetEnableUndo() bool {
1296
1297 cret := XGtkEditableGetEnableUndo(x.GoPointer())
1298 return cret
1299}
1300
1301// Retrieves the desired maximum width of @editable, in characters.
1302func (x *SpinButton) GetMaxWidthChars() int {
1303
1304 cret := XGtkEditableGetMaxWidthChars(x.GoPointer())
1305 return cret
1306}
1307
1308// Retrieves the current position of the cursor relative
1309// to the start of the content of the editable.
1310//
1311// Note that this position is in characters, not in bytes.
1312func (x *SpinButton) GetPosition() int {
1313
1314 cret := XGtkEditableGetPosition(x.GoPointer())
1315 return cret
1316}
1317
1318// Retrieves the selection bound of the editable.
1319//
1320// @start_pos will be filled with the start of the selection and
1321// @end_pos with end. If no text was selected both will be identical
1322// and %FALSE will be returned.
1323//
1324// Note that positions are specified in characters, not bytes.
1325func (x *SpinButton) GetSelectionBounds(StartPosVar *int, EndPosVar *int) bool {
1326
1327 cret := XGtkEditableGetSelectionBounds(x.GoPointer(), StartPosVar, EndPosVar)
1328 return cret
1329}
1330
1331// Retrieves the contents of @editable.
1332//
1333// The returned string is owned by GTK and must not be modified or freed.
1334func (x *SpinButton) GetText() string {
1335
1336 cret := XGtkEditableGetText(x.GoPointer())
1337 return cret
1338}
1339
1340// Gets the number of characters of space reserved
1341// for the contents of the editable.
1342func (x *SpinButton) GetWidthChars() int {
1343
1344 cret := XGtkEditableGetWidthChars(x.GoPointer())
1345 return cret
1346}
1347
1348// Sets up a delegate for `GtkEditable`.
1349//
1350// This is assuming that the get_delegate vfunc in the `GtkEditable`
1351// interface has been set up for the @editable's type.
1352//
1353// This is a helper function that should be called in instance init,
1354// after creating the delegate object.
1355func (x *SpinButton) InitDelegate() {
1356
1357 XGtkEditableInitDelegate(x.GoPointer())
1358
1359}
1360
1361// Inserts @length bytes of @text into the contents of the
1362// widget, at position @position.
1363//
1364// Note that the position is in characters, not in bytes.
1365// The function updates @position to point after the newly
1366// inserted text.
1367func (x *SpinButton) InsertText(TextVar string, LengthVar int, PositionVar int) {
1368
1369 XGtkEditableInsertText(x.GoPointer(), TextVar, LengthVar, PositionVar)
1370
1371}
1372
1373// Selects a region of text.
1374//
1375// The characters that are selected are those characters at positions
1376// from @start_pos up to, but not including @end_pos. If @end_pos is
1377// negative, then the characters selected are those characters from
1378// @start_pos to the end of the text.
1379//
1380// Note that positions are specified in characters, not bytes.
1381func (x *SpinButton) SelectRegion(StartPosVar int, EndPosVar int) {
1382
1383 XGtkEditableSelectRegion(x.GoPointer(), StartPosVar, EndPosVar)
1384
1385}
1386
1387// Sets the alignment for the contents of the editable.
1388//
1389// This controls the horizontal positioning of the contents when
1390// the displayed text is shorter than the width of the editable.
1391func (x *SpinButton) SetAlignment(XalignVar float32) {
1392
1393 XGtkEditableSetAlignment(x.GoPointer(), XalignVar)
1394
1395}
1396
1397// Determines if the user can edit the text in the editable widget.
1398func (x *SpinButton) SetEditable(IsEditableVar bool) {
1399
1400 XGtkEditableSetEditable(x.GoPointer(), IsEditableVar)
1401
1402}
1403
1404// If enabled, changes to @editable will be saved for undo/redo
1405// actions.
1406//
1407// This results in an additional copy of text changes and are not
1408// stored in secure memory. As such, undo is forcefully disabled
1409// when [property@Gtk.Text:visibility] is set to %FALSE.
1410func (x *SpinButton) SetEnableUndo(EnableUndoVar bool) {
1411
1412 XGtkEditableSetEnableUndo(x.GoPointer(), EnableUndoVar)
1413
1414}
1415
1416// Sets the desired maximum width in characters of @editable.
1417func (x *SpinButton) SetMaxWidthChars(NCharsVar int) {
1418
1419 XGtkEditableSetMaxWidthChars(x.GoPointer(), NCharsVar)
1420
1421}
1422
1423// Sets the cursor position in the editable to the given value.
1424//
1425// The cursor is displayed before the character with the given (base 0)
1426// index in the contents of the editable. The value must be less than
1427// or equal to the number of characters in the editable. A value of -1
1428// indicates that the position should be set after the last character
1429// of the editable. Note that @position is in characters, not in bytes.
1430func (x *SpinButton) SetPosition(PositionVar int) {
1431
1432 XGtkEditableSetPosition(x.GoPointer(), PositionVar)
1433
1434}
1435
1436// Sets the text in the editable to the given value.
1437//
1438// This is replacing the current contents.
1439func (x *SpinButton) SetText(TextVar string) {
1440
1441 XGtkEditableSetText(x.GoPointer(), TextVar)
1442
1443}
1444
1445// Changes the size request of the editable to be about the
1446// right size for @n_chars characters.
1447//
1448// Note that it changes the size request, the size can still
1449// be affected by how you pack the widget into containers.
1450// If @n_chars is -1, the size reverts to the default size.
1451func (x *SpinButton) SetWidthChars(NCharsVar int) {
1452
1453 XGtkEditableSetWidthChars(x.GoPointer(), NCharsVar)
1454
1455}
1456
1457// Retrieves the orientation of the @orientable.
1458func (x *SpinButton) GetOrientation() Orientation {
1459
1460 cret := XGtkOrientableGetOrientation(x.GoPointer())
1461 return cret
1462}
1463
1464// Sets the orientation of the @orientable.
1465func (x *SpinButton) SetOrientation(OrientationVar Orientation) {
1466
1467 XGtkOrientableSetOrientation(x.GoPointer(), OrientationVar)
1468
1469}
1470
1471func init() {
1472 core.SetPackageName("GTK", "gtk4")
1473 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
1474 var libs []uintptr
1475 for _, libPath := range core.GetPaths("GTK") {
1476 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
1477 if err != nil {
1478 panic(err)
1479 }
1480 libs = append(libs, lib)
1481 }
1482
1483 core.PuregoSafeRegister(&xSpinButtonUpdatePolicyGLibType, libs, "gtk_spin_button_update_policy_get_type")
1484
1485 core.PuregoSafeRegister(&xSpinTypeGLibType, libs, "gtk_spin_type_get_type")
1486
1487 core.PuregoSafeRegister(&xSpinButtonGLibType, libs, "gtk_spin_button_get_type")
1488
1489 core.PuregoSafeRegister(&xNewSpinButton, libs, "gtk_spin_button_new")
1490 core.PuregoSafeRegister(&xNewSpinButtonWithRange, libs, "gtk_spin_button_new_with_range")
1491
1492 core.PuregoSafeRegister(&xSpinButtonConfigure, libs, "gtk_spin_button_configure")
1493 core.PuregoSafeRegister(&xSpinButtonGetActivatesDefault, libs, "gtk_spin_button_get_activates_default")
1494 core.PuregoSafeRegister(&xSpinButtonGetAdjustment, libs, "gtk_spin_button_get_adjustment")
1495 core.PuregoSafeRegister(&xSpinButtonGetClimbRate, libs, "gtk_spin_button_get_climb_rate")
1496 core.PuregoSafeRegister(&xSpinButtonGetDigits, libs, "gtk_spin_button_get_digits")
1497 core.PuregoSafeRegister(&xSpinButtonGetIncrements, libs, "gtk_spin_button_get_increments")
1498 core.PuregoSafeRegister(&xSpinButtonGetNumeric, libs, "gtk_spin_button_get_numeric")
1499 core.PuregoSafeRegister(&xSpinButtonGetRange, libs, "gtk_spin_button_get_range")
1500 core.PuregoSafeRegister(&xSpinButtonGetSnapToTicks, libs, "gtk_spin_button_get_snap_to_ticks")
1501 core.PuregoSafeRegister(&xSpinButtonGetUpdatePolicy, libs, "gtk_spin_button_get_update_policy")
1502 core.PuregoSafeRegister(&xSpinButtonGetValue, libs, "gtk_spin_button_get_value")
1503 core.PuregoSafeRegister(&xSpinButtonGetValueAsInt, libs, "gtk_spin_button_get_value_as_int")
1504 core.PuregoSafeRegister(&xSpinButtonGetWrap, libs, "gtk_spin_button_get_wrap")
1505 core.PuregoSafeRegister(&xSpinButtonSetActivatesDefault, libs, "gtk_spin_button_set_activates_default")
1506 core.PuregoSafeRegister(&xSpinButtonSetAdjustment, libs, "gtk_spin_button_set_adjustment")
1507 core.PuregoSafeRegister(&xSpinButtonSetClimbRate, libs, "gtk_spin_button_set_climb_rate")
1508 core.PuregoSafeRegister(&xSpinButtonSetDigits, libs, "gtk_spin_button_set_digits")
1509 core.PuregoSafeRegister(&xSpinButtonSetIncrements, libs, "gtk_spin_button_set_increments")
1510 core.PuregoSafeRegister(&xSpinButtonSetNumeric, libs, "gtk_spin_button_set_numeric")
1511 core.PuregoSafeRegister(&xSpinButtonSetRange, libs, "gtk_spin_button_set_range")
1512 core.PuregoSafeRegister(&xSpinButtonSetSnapToTicks, libs, "gtk_spin_button_set_snap_to_ticks")
1513 core.PuregoSafeRegister(&xSpinButtonSetUpdatePolicy, libs, "gtk_spin_button_set_update_policy")
1514 core.PuregoSafeRegister(&xSpinButtonSetValue, libs, "gtk_spin_button_set_value")
1515 core.PuregoSafeRegister(&xSpinButtonSetWrap, libs, "gtk_spin_button_set_wrap")
1516 core.PuregoSafeRegister(&xSpinButtonSpin, libs, "gtk_spin_button_spin")
1517 core.PuregoSafeRegister(&xSpinButtonUpdate, libs, "gtk_spin_button_update")
1518
1519}