Skip to main content

gtk4/auto/
spin_button.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5#[cfg(feature = "v4_10")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
7use crate::{Accessible, AccessibleRange};
8use crate::{
9    AccessibleRole, Adjustment, Align, Buildable, CellEditable, ConstraintTarget, Editable,
10    LayoutManager, Orientable, Orientation, Overflow, ScrollType, SpinButtonUpdatePolicy, SpinType,
11    Widget, ffi,
12};
13use glib::{
14    object::ObjectType as _,
15    prelude::*,
16    signal::{SignalHandlerId, connect_raw},
17    translate::*,
18};
19use std::boxed::Box as Box_;
20
21#[cfg(feature = "v4_10")]
22#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
23glib::wrapper! {
24    ///  button.down
25    /// ```text
26    ///
27    /// [`SpinButton`][crate::SpinButton]s main CSS node has the name spinbutton. It creates subnodes
28    /// for the entry and the two buttons, with these names. The button nodes have
29    /// the style classes .up and .down. The [`Text`][crate::Text] subnodes (if present) are put
30    /// below the text node. The orientation of the spin button is reflected in
31    /// the .vertical or .horizontal style class on the main node.
32    ///
33    /// # Accessibility
34    ///
35    /// [`SpinButton`][crate::SpinButton] uses the [enum@Gtk.AccessibleRole.spin_button] role.
36    ///
37    /// ## Properties
38    ///
39    ///
40    /// #### `activates-default`
41    ///  Whether to activate the default widget when the spin button is activated.
42    ///
43    /// See [`activate`][struct@crate::SpinButton#activate] for what counts as activation.
44    ///
45    /// Readable | Writable
46    ///
47    ///
48    /// #### `adjustment`
49    ///  The adjustment that holds the value of the spin button.
50    ///
51    /// Readable | Writable
52    ///
53    ///
54    /// #### `climb-rate`
55    ///  The acceleration rate when you hold down a button or key.
56    ///
57    /// Readable | Writable
58    ///
59    ///
60    /// #### `digits`
61    ///  The number of decimal places to display.
62    ///
63    /// Readable | Writable
64    ///
65    ///
66    /// #### `numeric`
67    ///  Whether non-numeric characters should be ignored.
68    ///
69    /// Readable | Writable
70    ///
71    ///
72    /// #### `snap-to-ticks`
73    ///  Whether erroneous values are automatically changed to the spin buttons
74    /// nearest step increment.
75    ///
76    /// Readable | Writable
77    ///
78    ///
79    /// #### `update-policy`
80    ///  Whether the spin button should update always, or only when the value
81    /// is acceptable.
82    ///
83    /// Readable | Writable
84    ///
85    ///
86    /// #### `value`
87    ///  The current value.
88    ///
89    /// Readable | Writable
90    ///
91    ///
92    /// #### `wrap`
93    ///  Whether a spin button should wrap upon reaching its limits.
94    ///
95    /// Readable | Writable
96    /// <details><summary><h4>Widget</h4></summary>
97    ///
98    ///
99    /// #### `can-focus`
100    ///  Whether the widget or any of its descendents can accept
101    /// the input focus.
102    ///
103    /// This property is meant to be set by widget implementations,
104    /// typically in their instance init function.
105    ///
106    /// Readable | Writable
107    ///
108    ///
109    /// #### `can-target`
110    ///  Whether the widget can receive pointer events.
111    ///
112    /// Readable | Writable
113    ///
114    ///
115    /// #### `css-classes`
116    ///  A list of css classes applied to this widget.
117    ///
118    /// Readable | Writable
119    ///
120    ///
121    /// #### `css-name`
122    ///  The name of this widget in the CSS tree.
123    ///
124    /// This property is meant to be set by widget implementations,
125    /// typically in their instance init function.
126    ///
127    /// Readable | Writable | Construct Only
128    ///
129    ///
130    /// #### `cursor`
131    ///  The cursor used by @widget.
132    ///
133    /// Readable | Writable
134    ///
135    ///
136    /// #### `focus-on-click`
137    ///  Whether the widget should grab focus when it is clicked with the mouse.
138    ///
139    /// This property is only relevant for widgets that can take focus.
140    ///
141    /// Readable | Writable
142    ///
143    ///
144    /// #### `focusable`
145    ///  Whether this widget itself will accept the input focus.
146    ///
147    /// Readable | Writable
148    ///
149    ///
150    /// #### `halign`
151    ///  How to distribute horizontal space if widget gets extra space.
152    ///
153    /// Readable | Writable
154    ///
155    ///
156    /// #### `has-default`
157    ///  Whether the widget is the default widget.
158    ///
159    /// Readable
160    ///
161    ///
162    /// #### `has-focus`
163    ///  Whether the widget has the input focus.
164    ///
165    /// Readable
166    ///
167    ///
168    /// #### `has-tooltip`
169    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
170    /// signal on @widget.
171    ///
172    /// A true value indicates that @widget can have a tooltip, in this case
173    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
174    /// determine whether it will provide a tooltip or not.
175    ///
176    /// Readable | Writable
177    ///
178    ///
179    /// #### `height-request`
180    ///  Overrides for height request of the widget.
181    ///
182    /// If this is -1, the natural request will be used.
183    ///
184    /// Readable | Writable
185    ///
186    ///
187    /// #### `hexpand`
188    ///  Whether to expand horizontally.
189    ///
190    /// Readable | Writable
191    ///
192    ///
193    /// #### `hexpand-set`
194    ///  Whether to use the `hexpand` property.
195    ///
196    /// Readable | Writable
197    ///
198    ///
199    /// #### `layout-manager`
200    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
201    /// the preferred size of the widget, and allocate its children.
202    ///
203    /// This property is meant to be set by widget implementations,
204    /// typically in their instance init function.
205    ///
206    /// Readable | Writable
207    ///
208    ///
209    /// #### `limit-events`
210    ///  Makes this widget act like a modal dialog, with respect to
211    /// event delivery.
212    ///
213    /// Global event controllers will not handle events with targets
214    /// inside the widget, unless they are set up to ignore propagation
215    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
216    ///
217    /// Readable | Writable
218    ///
219    ///
220    /// #### `margin-bottom`
221    ///  Margin on bottom side of widget.
222    ///
223    /// This property adds margin outside of the widget's normal size
224    /// request, the margin will be added in addition to the size from
225    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
226    ///
227    /// Readable | Writable
228    ///
229    ///
230    /// #### `margin-end`
231    ///  Margin on end of widget, horizontally.
232    ///
233    /// This property supports left-to-right and right-to-left text
234    /// directions.
235    ///
236    /// This property adds margin outside of the widget's normal size
237    /// request, the margin will be added in addition to the size from
238    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
239    ///
240    /// Readable | Writable
241    ///
242    ///
243    /// #### `margin-start`
244    ///  Margin on start of widget, horizontally.
245    ///
246    /// This property supports left-to-right and right-to-left text
247    /// directions.
248    ///
249    /// This property adds margin outside of the widget's normal size
250    /// request, the margin will be added in addition to the size from
251    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
252    ///
253    /// Readable | Writable
254    ///
255    ///
256    /// #### `margin-top`
257    ///  Margin on top side of widget.
258    ///
259    /// This property adds margin outside of the widget's normal size
260    /// request, the margin will be added in addition to the size from
261    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
262    ///
263    /// Readable | Writable
264    ///
265    ///
266    /// #### `name`
267    ///  The name of the widget.
268    ///
269    /// Readable | Writable
270    ///
271    ///
272    /// #### `opacity`
273    ///  The requested opacity of the widget.
274    ///
275    /// Readable | Writable
276    ///
277    ///
278    /// #### `overflow`
279    ///  How content outside the widget's content area is treated.
280    ///
281    /// This property is meant to be set by widget implementations,
282    /// typically in their instance init function.
283    ///
284    /// Readable | Writable
285    ///
286    ///
287    /// #### `parent`
288    ///  The parent widget of this widget.
289    ///
290    /// Readable
291    ///
292    ///
293    /// #### `receives-default`
294    ///  Whether the widget will receive the default action when it is focused.
295    ///
296    /// Readable | Writable
297    ///
298    ///
299    /// #### `root`
300    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
301    ///
302    /// This will be `NULL` if the widget is not contained in a root widget.
303    ///
304    /// Readable
305    ///
306    ///
307    /// #### `scale-factor`
308    ///  The scale factor of the widget.
309    ///
310    /// Readable
311    ///
312    ///
313    /// #### `sensitive`
314    ///  Whether the widget responds to input.
315    ///
316    /// Readable | Writable
317    ///
318    ///
319    /// #### `tooltip-markup`
320    ///  Sets the text of tooltip to be the given string, which is marked up
321    /// with Pango markup.
322    ///
323    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
324    ///
325    /// This is a convenience property which will take care of getting the
326    /// tooltip shown if the given string is not `NULL`:
327    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
328    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
329    /// the default signal handler.
330    ///
331    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
332    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
333    ///
334    /// Readable | Writable
335    ///
336    ///
337    /// #### `tooltip-text`
338    ///  Sets the text of tooltip to be the given string.
339    ///
340    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
341    ///
342    /// This is a convenience property which will take care of getting the
343    /// tooltip shown if the given string is not `NULL`:
344    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
345    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
346    /// the default signal handler.
347    ///
348    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
349    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
350    ///
351    /// Readable | Writable
352    ///
353    ///
354    /// #### `valign`
355    ///  How to distribute vertical space if widget gets extra space.
356    ///
357    /// Readable | Writable
358    ///
359    ///
360    /// #### `vexpand`
361    ///  Whether to expand vertically.
362    ///
363    /// Readable | Writable
364    ///
365    ///
366    /// #### `vexpand-set`
367    ///  Whether to use the `vexpand` property.
368    ///
369    /// Readable | Writable
370    ///
371    ///
372    /// #### `visible`
373    ///  Whether the widget is visible.
374    ///
375    /// Readable | Writable
376    ///
377    ///
378    /// #### `width-request`
379    ///  Overrides for width request of the widget.
380    ///
381    /// If this is -1, the natural request will be used.
382    ///
383    /// Readable | Writable
384    /// </details>
385    /// <details><summary><h4>Accessible</h4></summary>
386    ///
387    ///
388    /// #### `accessible-role`
389    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
390    ///
391    /// The accessible role cannot be changed once set.
392    ///
393    /// Readable | Writable
394    /// </details>
395    /// <details><summary><h4>CellEditable</h4></summary>
396    ///
397    ///
398    /// #### `editing-canceled`
399    ///  Indicates whether editing on the cell has been canceled.
400    ///
401    /// Readable | Writable
402    /// </details>
403    /// <details><summary><h4>Editable</h4></summary>
404    ///
405    ///
406    /// #### `complete-text`
407    ///  The contents of the entry, including uncommited content such as the
408    /// preedit.
409    ///
410    /// Readable
411    ///
412    ///
413    /// #### `cursor-position`
414    ///  The current position of the insertion cursor in chars.
415    ///
416    /// Readable
417    ///
418    ///
419    /// #### `editable`
420    ///  Whether the entry contents can be edited.
421    ///
422    /// Readable | Writable
423    ///
424    ///
425    /// #### `enable-undo`
426    ///  If undo/redo should be enabled for the editable.
427    ///
428    /// Readable | Writable
429    ///
430    ///
431    /// #### `max-width-chars`
432    ///  The desired maximum width of the entry, in characters.
433    ///
434    /// Readable | Writable
435    ///
436    ///
437    /// #### `selection-bound`
438    ///  The position of the opposite end of the selection from the cursor in chars.
439    ///
440    /// Readable
441    ///
442    ///
443    /// #### `text`
444    ///  The contents of the entry.
445    ///
446    /// Readable | Writable
447    ///
448    ///
449    /// #### `width-chars`
450    ///  Number of characters to leave space for in the entry.
451    ///
452    /// Readable | Writable
453    ///
454    ///
455    /// #### `xalign`
456    ///  The horizontal alignment, from 0 (left) to 1 (right).
457    ///
458    /// Reversed for RTL layouts.
459    ///
460    /// Readable | Writable
461    /// </details>
462    /// <details><summary><h4>Orientable</h4></summary>
463    ///
464    ///
465    /// #### `orientation`
466    ///  The orientation of the orientable.
467    ///
468    /// Readable | Writable
469    /// </details>
470    ///
471    /// ## Signals
472    ///
473    ///
474    /// #### `activate`
475    ///   is
476    /// pressed again.
477    ///
478    /// Action
479    ///
480    ///
481    /// #### `change-value`
482    ///  Emitted when the user initiates a value change.
483    ///
484    /// This is a [keybinding signal](class.SignalAction.html).
485    ///
486    /// Applications should not connect to it, but may emit it with
487    /// g_signal_emit_by_name() if they need to control the cursor
488    /// programmatically.
489    ///
490    /// The default bindings for this signal are Up/Down and PageUp/PageDown.
491    ///
492    /// Action
493    ///
494    ///
495    /// #### `input`
496    ///  Emitted to convert the users input into a double value.
497    ///
498    /// The signal handler is expected to use [`EditableExt::text()`][crate::prelude::EditableExt::text()]
499    /// to retrieve the text of the spinbutton and set @new_value to the
500    /// new value.
501    ///
502    /// The default conversion uses g_strtod().
503    ///
504    ///
505    ///
506    ///
507    /// #### `output`
508    ///  Emitted to tweak the formatting of the value for display.
509    ///
510    /// **⚠️ The following code is in c ⚠️**
511    ///
512    /// ```c
513    /// // show leading zeros
514    /// static gboolean
515    /// on_output (GtkSpinButton *spin,
516    ///            gpointer       data)
517    /// {
518    ///    char *text;
519    ///    int value;
520    ///
521    ///    value = gtk_spin_button_get_value_as_int (spin);
522    ///    text = g_strdup_printf ("%02d", value);
523    ///    gtk_editable_set_text (GTK_EDITABLE (spin), text):
524    ///    g_free (text);
525    ///
526    ///    return TRUE;
527    /// }
528    /// ```
529    ///
530    ///
531    ///
532    ///
533    /// #### `value-changed`
534    ///  Emitted when the value is changed.
535    ///
536    /// Also see the [`output`][struct@crate::SpinButton#output] signal.
537    ///
538    ///
539    ///
540    ///
541    /// #### `wrapped`
542    ///  Emitted right after the spinbutton wraps from its maximum
543    /// to its minimum value or vice-versa.
544    ///
545    ///
546    /// <details><summary><h4>Widget</h4></summary>
547    ///
548    ///
549    /// #### `destroy`
550    ///  Signals that all holders of a reference to the widget should release
551    /// the reference that they hold.
552    ///
553    /// May result in finalization of the widget if all references are released.
554    ///
555    /// This signal is not suitable for saving widget state.
556    ///
557    ///
558    ///
559    ///
560    /// #### `direction-changed`
561    ///  Emitted when the text direction of a widget changes.
562    ///
563    ///
564    ///
565    ///
566    /// #### `hide`
567    ///  Emitted when @widget is hidden.
568    ///
569    ///
570    ///
571    ///
572    /// #### `keynav-failed`
573    ///  Emitted if keyboard navigation fails.
574    ///
575    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
576    ///
577    ///
578    ///
579    ///
580    /// #### `map`
581    ///  Emitted when @widget is going to be mapped.
582    ///
583    /// A widget is mapped when the widget is visible (which is controlled with
584    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
585    /// are also visible.
586    ///
587    /// The `::map` signal can be used to determine whether a widget will be drawn,
588    /// for instance it can resume an animation that was stopped during the
589    /// emission of [`unmap`][struct@crate::Widget#unmap].
590    ///
591    ///
592    ///
593    ///
594    /// #### `mnemonic-activate`
595    ///  Emitted when a widget is activated via a mnemonic.
596    ///
597    /// The default handler for this signal activates @widget if @group_cycling
598    /// is false, or just makes @widget grab focus if @group_cycling is true.
599    ///
600    ///
601    ///
602    ///
603    /// #### `move-focus`
604    ///   to move backward.
605    ///
606    /// Action
607    ///
608    ///
609    /// #### `query-tooltip`
610    ///  s tooltip is about to be shown.
611    ///
612    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
613    /// is true and the hover timeout has expired with the cursor hovering
614    /// above @widget; or emitted when @widget got focus in keyboard mode.
615    ///
616    /// Using the given coordinates, the signal handler should determine
617    /// whether a tooltip should be shown for @widget. If this is the case
618    /// true should be returned, false otherwise. Note that if @keyboard_mode
619    /// is true, the values of @x and @y are undefined and should not be used.
620    ///
621    /// The signal handler is free to manipulate @tooltip with the therefore
622    /// destined function calls.
623    ///
624    ///
625    ///
626    ///
627    /// #### `realize`
628    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
629    ///
630    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
631    /// or the widget has been mapped (that is, it is going to be drawn).
632    ///
633    ///
634    ///
635    ///
636    /// #### `show`
637    ///  Emitted when @widget is shown.
638    ///
639    ///
640    ///
641    ///
642    /// #### `state-flags-changed`
643    ///  Emitted when the widget state changes.
644    ///
645    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
646    ///
647    ///
648    ///
649    ///
650    /// #### `unmap`
651    ///  Emitted when @widget is going to be unmapped.
652    ///
653    /// A widget is unmapped when either it or any of its parents up to the
654    /// toplevel widget have been set as hidden.
655    ///
656    /// As `::unmap` indicates that a widget will not be shown any longer,
657    /// it can be used to, for example, stop an animation on the widget.
658    ///
659    ///
660    ///
661    ///
662    /// #### `unrealize`
663    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
664    ///
665    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
666    /// or the widget has been unmapped (that is, it is going to be hidden).
667    ///
668    ///
669    /// </details>
670    /// <details><summary><h4>CellEditable</h4></summary>
671    ///
672    ///
673    /// #### `editing-done`
674    ///  This signal is a sign for the cell renderer to update its
675    /// value from the @cell_editable.
676    ///
677    /// Implementations of [`CellEditable`][crate::CellEditable] are responsible for
678    /// emitting this signal when they are done editing, e.g.
679    /// [`Entry`][crate::Entry] emits this signal when the user presses Enter. Typical things to
680    /// do in a handler for ::editing-done are to capture the edited value,
681    /// disconnect the @cell_editable from signals on the [`CellRenderer`][crate::CellRenderer], etc.
682    ///
683    /// gtk_cell_editable_editing_done() is a convenience method
684    /// for emitting `GtkCellEditable::editing-done`.
685    ///
686    ///
687    ///
688    ///
689    /// #### `remove-widget`
690    ///  This signal is meant to indicate that the cell is finished
691    /// editing, and the @cell_editable widget is being removed and may
692    /// subsequently be destroyed.
693    ///
694    /// Implementations of [`CellEditable`][crate::CellEditable] are responsible for
695    /// emitting this signal when they are done editing. It must
696    /// be emitted after the `GtkCellEditable::editing-done` signal,
697    /// to give the cell renderer a chance to update the cell's value
698    /// before the widget is removed.
699    ///
700    /// gtk_cell_editable_remove_widget() is a convenience method
701    /// for emitting `GtkCellEditable::remove-widget`.
702    ///
703    ///
704    /// </details>
705    /// <details><summary><h4>Editable</h4></summary>
706    ///
707    ///
708    /// #### `changed`
709    ///  Emitted at the end of a single user-visible operation on the
710    /// contents.
711    ///
712    /// E.g., a paste operation that replaces the contents of the
713    /// selection will cause only one signal emission (even though it
714    /// is implemented by first deleting the selection, then inserting
715    /// the new content, and may cause multiple ::notify::text signals
716    /// to be emitted).
717    ///
718    ///
719    ///
720    ///
721    /// #### `delete-text`
722    ///  Emitted when text is deleted from the widget by the user.
723    ///
724    /// The default handler for this signal will normally be responsible for
725    /// deleting the text, so by connecting to this signal and then stopping
726    /// the signal with g_signal_stop_emission(), it is possible to modify the
727    /// range of deleted text, or prevent it from being deleted entirely.
728    ///
729    /// The @start_pos and @end_pos parameters are interpreted as for
730    /// [`EditableExt::delete_text()`][crate::prelude::EditableExt::delete_text()].
731    ///
732    ///
733    ///
734    ///
735    /// #### `insert-text`
736    ///  Emitted when text is inserted into the widget by the user.
737    ///
738    /// The default handler for this signal will normally be responsible
739    /// for inserting the text, so by connecting to this signal and then
740    /// stopping the signal with g_signal_stop_emission(), it is possible
741    /// to modify the inserted text, or prevent it from being inserted entirely.
742    ///
743    ///
744    /// </details>
745    ///
746    /// # Implements
747    ///
748    /// [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`AccessibleRangeExt`][trait@crate::prelude::AccessibleRangeExt], [`CellEditableExt`][trait@crate::prelude::CellEditableExt], [`EditableExt`][trait@crate::prelude::EditableExt], [`OrientableExt`][trait@crate::prelude::OrientableExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual], [`EditableExtManual`][trait@crate::prelude::EditableExtManual]
749    #[doc(alias = "GtkSpinButton")]
750    pub struct SpinButton(Object<ffi::GtkSpinButton>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, AccessibleRange, CellEditable, Editable, Orientable;
751
752    match fn {
753        type_ => || ffi::gtk_spin_button_get_type(),
754    }
755}
756
757#[cfg(not(feature = "v4_10"))]
758glib::wrapper! {
759    #[doc(alias = "GtkSpinButton")]
760    pub struct SpinButton(Object<ffi::GtkSpinButton>) @extends Widget, @implements Buildable, ConstraintTarget, CellEditable, Editable, Orientable;
761
762    match fn {
763        type_ => || ffi::gtk_spin_button_get_type(),
764    }
765}
766
767impl SpinButton {
768    /// Creates a new [`SpinButton`][crate::SpinButton].
769    /// ## `adjustment`
770    /// the [`Adjustment`][crate::Adjustment] that this spin button should use
771    /// ## `climb_rate`
772    /// specifies by how much the rate of change in the value will
773    ///   accelerate if you continue to hold down an up/down button or arrow key
774    /// ## `digits`
775    /// the number of decimal places to display
776    ///
777    /// # Returns
778    ///
779    /// The new [`SpinButton`][crate::SpinButton]
780    #[doc(alias = "gtk_spin_button_new")]
781    pub fn new(
782        adjustment: Option<&impl IsA<Adjustment>>,
783        climb_rate: f64,
784        digits: u32,
785    ) -> SpinButton {
786        assert_initialized_main_thread!();
787        unsafe {
788            Widget::from_glib_none(ffi::gtk_spin_button_new(
789                adjustment.map(|p| p.as_ref()).to_glib_none().0,
790                climb_rate,
791                digits,
792            ))
793            .unsafe_cast()
794        }
795    }
796
797    /// Creates a new [`SpinButton`][crate::SpinButton] with the given properties.
798    ///
799    /// This is a convenience constructor that allows creation
800    /// of a numeric [`SpinButton`][crate::SpinButton] without manually creating
801    /// an adjustment. The value is initially set to the minimum
802    /// value and a page increment of 10 * @step is the default.
803    /// The precision of the spin button is equivalent to the
804    /// precision of @step.
805    ///
806    /// Note that the way in which the precision is derived works
807    /// best if @step is a power of ten. If the resulting precision
808    /// is not suitable for your needs, use
809    /// [`set_digits()`][Self::set_digits()] to correct it.
810    /// ## `min`
811    /// Minimum allowable value
812    /// ## `max`
813    /// Maximum allowable value
814    /// ## `step`
815    /// Increment added or subtracted by spinning the widget
816    ///
817    /// # Returns
818    ///
819    /// The new [`SpinButton`][crate::SpinButton]
820    #[doc(alias = "gtk_spin_button_new_with_range")]
821    #[doc(alias = "new_with_range")]
822    pub fn with_range(min: f64, max: f64, step: f64) -> SpinButton {
823        assert_initialized_main_thread!();
824        unsafe {
825            Widget::from_glib_none(ffi::gtk_spin_button_new_with_range(min, max, step))
826                .unsafe_cast()
827        }
828    }
829
830    // rustdoc-stripper-ignore-next
831    /// Creates a new builder-pattern struct instance to construct [`SpinButton`] objects.
832    ///
833    /// This method returns an instance of [`SpinButtonBuilder`](crate::builders::SpinButtonBuilder) which can be used to create [`SpinButton`] objects.
834    pub fn builder() -> SpinButtonBuilder {
835        SpinButtonBuilder::new()
836    }
837
838    /// Changes the properties of an existing spin button.
839    ///
840    /// The adjustment, climb rate, and number of decimal places
841    /// are updated accordingly.
842    /// ## `adjustment`
843    /// s
844    ///   existing adjustment, or [`None`] to leave its current adjustment unchanged
845    /// ## `climb_rate`
846    /// the new climb rate
847    /// ## `digits`
848    /// the number of decimal places to display in the spin button
849    #[doc(alias = "gtk_spin_button_configure")]
850    pub fn configure(
851        &self,
852        adjustment: Option<&impl IsA<Adjustment>>,
853        climb_rate: f64,
854        digits: u32,
855    ) {
856        unsafe {
857            ffi::gtk_spin_button_configure(
858                self.to_glib_none().0,
859                adjustment.map(|p| p.as_ref()).to_glib_none().0,
860                climb_rate,
861                digits,
862            );
863        }
864    }
865
866    /// Retrieves the value set by [`set_activates_default()`][Self::set_activates_default()].
867    ///
868    /// # Returns
869    ///
870    /// [`true`] if the spin button will activate the default widget
871    #[cfg(feature = "v4_14")]
872    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
873    #[doc(alias = "gtk_spin_button_get_activates_default")]
874    #[doc(alias = "get_activates_default")]
875    #[doc(alias = "activates-default")]
876    pub fn activates_default(&self) -> bool {
877        unsafe {
878            from_glib(ffi::gtk_spin_button_get_activates_default(
879                self.to_glib_none().0,
880            ))
881        }
882    }
883
884    /// Get the adjustment associated with a [`SpinButton`][crate::SpinButton].
885    ///
886    /// # Returns
887    ///
888    /// the [`Adjustment`][crate::Adjustment] of @self
889    #[doc(alias = "gtk_spin_button_get_adjustment")]
890    #[doc(alias = "get_adjustment")]
891    pub fn adjustment(&self) -> Adjustment {
892        unsafe { from_glib_none(ffi::gtk_spin_button_get_adjustment(self.to_glib_none().0)) }
893    }
894
895    /// Returns the acceleration rate for repeated changes.
896    ///
897    /// # Returns
898    ///
899    /// the acceleration rate
900    #[doc(alias = "gtk_spin_button_get_climb_rate")]
901    #[doc(alias = "get_climb_rate")]
902    #[doc(alias = "climb-rate")]
903    pub fn climb_rate(&self) -> f64 {
904        unsafe { ffi::gtk_spin_button_get_climb_rate(self.to_glib_none().0) }
905    }
906
907    /// Fetches the precision of @self.
908    ///
909    /// # Returns
910    ///
911    /// the current precision
912    #[doc(alias = "gtk_spin_button_get_digits")]
913    #[doc(alias = "get_digits")]
914    pub fn digits(&self) -> u32 {
915        unsafe { ffi::gtk_spin_button_get_digits(self.to_glib_none().0) }
916    }
917
918    /// Gets the current step and page the increments
919    /// used by @self.
920    ///
921    /// See [`set_increments()`][Self::set_increments()].
922    ///
923    /// # Returns
924    ///
925    ///
926    /// ## `step`
927    /// location to store step increment
928    ///
929    /// ## `page`
930    /// location to store page increment
931    #[doc(alias = "gtk_spin_button_get_increments")]
932    #[doc(alias = "get_increments")]
933    pub fn increments(&self) -> (f64, f64) {
934        unsafe {
935            let mut step = std::mem::MaybeUninit::uninit();
936            let mut page = std::mem::MaybeUninit::uninit();
937            ffi::gtk_spin_button_get_increments(
938                self.to_glib_none().0,
939                step.as_mut_ptr(),
940                page.as_mut_ptr(),
941            );
942            (step.assume_init(), page.assume_init())
943        }
944    }
945
946    /// Returns whether non-numeric text can be typed into the spin button.
947    ///
948    /// # Returns
949    ///
950    /// [`true`] if only numeric text can be entered
951    #[doc(alias = "gtk_spin_button_get_numeric")]
952    #[doc(alias = "get_numeric")]
953    #[doc(alias = "numeric")]
954    pub fn is_numeric(&self) -> bool {
955        unsafe { from_glib(ffi::gtk_spin_button_get_numeric(self.to_glib_none().0)) }
956    }
957
958    /// Gets the range allowed for @self.
959    ///
960    /// See [`set_range()`][Self::set_range()].
961    ///
962    /// # Returns
963    ///
964    ///
965    /// ## `min`
966    /// location to store minimum allowed value
967    ///
968    /// ## `max`
969    /// location to store maximum allowed value
970    #[doc(alias = "gtk_spin_button_get_range")]
971    #[doc(alias = "get_range")]
972    pub fn range(&self) -> (f64, f64) {
973        unsafe {
974            let mut min = std::mem::MaybeUninit::uninit();
975            let mut max = std::mem::MaybeUninit::uninit();
976            ffi::gtk_spin_button_get_range(
977                self.to_glib_none().0,
978                min.as_mut_ptr(),
979                max.as_mut_ptr(),
980            );
981            (min.assume_init(), max.assume_init())
982        }
983    }
984
985    /// Returns whether the values are corrected to the nearest step.
986    ///
987    /// # Returns
988    ///
989    /// [`true`] if values are snapped to the nearest step
990    #[doc(alias = "gtk_spin_button_get_snap_to_ticks")]
991    #[doc(alias = "get_snap_to_ticks")]
992    #[doc(alias = "snap-to-ticks")]
993    pub fn snaps_to_ticks(&self) -> bool {
994        unsafe {
995            from_glib(ffi::gtk_spin_button_get_snap_to_ticks(
996                self.to_glib_none().0,
997            ))
998        }
999    }
1000
1001    /// Gets the update behavior of a spin button.
1002    ///
1003    /// See [`set_update_policy()`][Self::set_update_policy()].
1004    ///
1005    /// # Returns
1006    ///
1007    /// the current update policy
1008    #[doc(alias = "gtk_spin_button_get_update_policy")]
1009    #[doc(alias = "get_update_policy")]
1010    #[doc(alias = "update-policy")]
1011    pub fn update_policy(&self) -> SpinButtonUpdatePolicy {
1012        unsafe {
1013            from_glib(ffi::gtk_spin_button_get_update_policy(
1014                self.to_glib_none().0,
1015            ))
1016        }
1017    }
1018
1019    /// Get the value in the @self.
1020    ///
1021    /// # Returns
1022    ///
1023    /// the value of @self
1024    #[doc(alias = "gtk_spin_button_get_value")]
1025    #[doc(alias = "get_value")]
1026    pub fn value(&self) -> f64 {
1027        unsafe { ffi::gtk_spin_button_get_value(self.to_glib_none().0) }
1028    }
1029
1030    /// Get the value @self represented as an integer.
1031    ///
1032    /// # Returns
1033    ///
1034    /// the value of @self
1035    #[doc(alias = "gtk_spin_button_get_value_as_int")]
1036    #[doc(alias = "get_value_as_int")]
1037    pub fn value_as_int(&self) -> i32 {
1038        unsafe { ffi::gtk_spin_button_get_value_as_int(self.to_glib_none().0) }
1039    }
1040
1041    /// s value wraps around to the
1042    /// opposite limit when the upper or lower limit of the range is
1043    /// exceeded.
1044    ///
1045    /// # Returns
1046    ///
1047    /// [`true`] if the spin button wraps around
1048    #[doc(alias = "gtk_spin_button_get_wrap")]
1049    #[doc(alias = "get_wrap")]
1050    #[doc(alias = "wrap")]
1051    pub fn wraps(&self) -> bool {
1052        unsafe { from_glib(ffi::gtk_spin_button_get_wrap(self.to_glib_none().0)) }
1053    }
1054
1055    /// Sets whether activating the spin button will activate the default
1056    /// widget for the window containing the spin button.
1057    ///
1058    /// See [`activate`][struct@crate::SpinButton#activate] for what counts as activation.
1059    /// ## `activates_default`
1060    /// s default widget on activation
1061    #[cfg(feature = "v4_14")]
1062    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
1063    #[doc(alias = "gtk_spin_button_set_activates_default")]
1064    #[doc(alias = "activates-default")]
1065    pub fn set_activates_default(&self, activates_default: bool) {
1066        unsafe {
1067            ffi::gtk_spin_button_set_activates_default(
1068                self.to_glib_none().0,
1069                activates_default.into_glib(),
1070            );
1071        }
1072    }
1073
1074    /// Replaces the [`Adjustment`][crate::Adjustment] associated with @self.
1075    /// ## `adjustment`
1076    /// a [`Adjustment`][crate::Adjustment] to replace the existing adjustment
1077    #[doc(alias = "gtk_spin_button_set_adjustment")]
1078    #[doc(alias = "adjustment")]
1079    pub fn set_adjustment(&self, adjustment: &impl IsA<Adjustment>) {
1080        unsafe {
1081            ffi::gtk_spin_button_set_adjustment(
1082                self.to_glib_none().0,
1083                adjustment.as_ref().to_glib_none().0,
1084            );
1085        }
1086    }
1087
1088    /// Sets the acceleration rate for repeated changes when you
1089    /// hold down a button or key.
1090    /// ## `climb_rate`
1091    /// = 0
1092    #[doc(alias = "gtk_spin_button_set_climb_rate")]
1093    #[doc(alias = "climb-rate")]
1094    pub fn set_climb_rate(&self, climb_rate: f64) {
1095        unsafe {
1096            ffi::gtk_spin_button_set_climb_rate(self.to_glib_none().0, climb_rate);
1097        }
1098    }
1099
1100    /// Set the precision to be displayed by @self.
1101    ///
1102    /// Up to 20 digit precision is allowed.
1103    /// ## `digits`
1104    /// s value
1105    #[doc(alias = "gtk_spin_button_set_digits")]
1106    #[doc(alias = "digits")]
1107    pub fn set_digits(&self, digits: u32) {
1108        unsafe {
1109            ffi::gtk_spin_button_set_digits(self.to_glib_none().0, digits);
1110        }
1111    }
1112
1113    /// s arrows are activated.
1114    /// ## `step`
1115    /// increment applied for a button 1 press.
1116    /// ## `page`
1117    /// increment applied for a button 2 press.
1118    #[doc(alias = "gtk_spin_button_set_increments")]
1119    pub fn set_increments(&self, step: f64, page: f64) {
1120        unsafe {
1121            ffi::gtk_spin_button_set_increments(self.to_glib_none().0, step, page);
1122        }
1123    }
1124
1125    /// Sets the flag that determines if non-numeric text can be typed
1126    /// into the spin button.
1127    /// ## `numeric`
1128    /// flag indicating if only numeric entry is allowed
1129    #[doc(alias = "gtk_spin_button_set_numeric")]
1130    #[doc(alias = "numeric")]
1131    pub fn set_numeric(&self, numeric: bool) {
1132        unsafe {
1133            ffi::gtk_spin_button_set_numeric(self.to_glib_none().0, numeric.into_glib());
1134        }
1135    }
1136
1137    /// Sets the minimum and maximum allowable values for @self.
1138    ///
1139    /// If the current value is outside this range, it will be adjusted
1140    /// to fit within the range, otherwise it will remain unchanged.
1141    /// ## `min`
1142    /// minimum allowable value
1143    /// ## `max`
1144    /// maximum allowable value
1145    #[doc(alias = "gtk_spin_button_set_range")]
1146    pub fn set_range(&self, min: f64, max: f64) {
1147        unsafe {
1148            ffi::gtk_spin_button_set_range(self.to_glib_none().0, min, max);
1149        }
1150    }
1151
1152    /// Sets the policy as to whether values are corrected to the
1153    /// nearest step increment when a spin button is activated after
1154    /// providing an invalid value.
1155    /// ## `snap_to_ticks`
1156    /// a flag indicating if invalid values should be corrected
1157    #[doc(alias = "gtk_spin_button_set_snap_to_ticks")]
1158    #[doc(alias = "snap-to-ticks")]
1159    pub fn set_snap_to_ticks(&self, snap_to_ticks: bool) {
1160        unsafe {
1161            ffi::gtk_spin_button_set_snap_to_ticks(
1162                self.to_glib_none().0,
1163                snap_to_ticks.into_glib(),
1164            );
1165        }
1166    }
1167
1168    /// Sets the update behavior of a spin button.
1169    ///
1170    /// This determines whether the spin button is always
1171    /// updated or only when a valid value is set.
1172    /// ## `policy`
1173    /// a [`SpinButtonUpdatePolicy`][crate::SpinButtonUpdatePolicy] value
1174    #[doc(alias = "gtk_spin_button_set_update_policy")]
1175    #[doc(alias = "update-policy")]
1176    pub fn set_update_policy(&self, policy: SpinButtonUpdatePolicy) {
1177        unsafe {
1178            ffi::gtk_spin_button_set_update_policy(self.to_glib_none().0, policy.into_glib());
1179        }
1180    }
1181
1182    /// Sets the value of @self.
1183    /// ## `value`
1184    /// the new value
1185    #[doc(alias = "gtk_spin_button_set_value")]
1186    #[doc(alias = "value")]
1187    pub fn set_value(&self, value: f64) {
1188        unsafe {
1189            ffi::gtk_spin_button_set_value(self.to_glib_none().0, value);
1190        }
1191    }
1192
1193    /// Sets the flag that determines if a spin button value wraps
1194    /// around to the opposite limit when the upper or lower limit
1195    /// of the range is exceeded.
1196    /// ## `wrap`
1197    /// a flag indicating if wrapping behavior is performed
1198    #[doc(alias = "gtk_spin_button_set_wrap")]
1199    #[doc(alias = "wrap")]
1200    pub fn set_wrap(&self, wrap: bool) {
1201        unsafe {
1202            ffi::gtk_spin_button_set_wrap(self.to_glib_none().0, wrap.into_glib());
1203        }
1204    }
1205
1206    /// s value in a specified
1207    /// direction by a specified amount.
1208    /// ## `direction`
1209    /// a [`SpinType`][crate::SpinType] indicating the direction to spin
1210    /// ## `increment`
1211    /// step increment to apply in the specified direction
1212    #[doc(alias = "gtk_spin_button_spin")]
1213    pub fn spin(&self, direction: SpinType, increment: f64) {
1214        unsafe {
1215            ffi::gtk_spin_button_spin(self.to_glib_none().0, direction.into_glib(), increment);
1216        }
1217    }
1218
1219    /// Manually force an update of the spin button.
1220    #[doc(alias = "gtk_spin_button_update")]
1221    pub fn update(&self) {
1222        unsafe {
1223            ffi::gtk_spin_button_update(self.to_glib_none().0);
1224        }
1225    }
1226
1227    ///  is
1228    /// pressed again.
1229    #[cfg(feature = "v4_14")]
1230    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
1231    #[doc(alias = "activate")]
1232    pub fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1233        unsafe extern "C" fn activate_trampoline<F: Fn(&SpinButton) + 'static>(
1234            this: *mut ffi::GtkSpinButton,
1235            f: glib::ffi::gpointer,
1236        ) {
1237            unsafe {
1238                let f: &F = &*(f as *const F);
1239                f(&from_glib_borrow(this))
1240            }
1241        }
1242        unsafe {
1243            let f: Box_<F> = Box_::new(f);
1244            connect_raw(
1245                self.as_ptr() as *mut _,
1246                c"activate".as_ptr(),
1247                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1248                    activate_trampoline::<F> as *const (),
1249                )),
1250                Box_::into_raw(f),
1251            )
1252        }
1253    }
1254
1255    #[cfg(feature = "v4_14")]
1256    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
1257    pub fn emit_activate(&self) {
1258        self.emit_by_name::<()>("activate", &[]);
1259    }
1260
1261    /// Emitted when the user initiates a value change.
1262    ///
1263    /// This is a [keybinding signal](class.SignalAction.html).
1264    ///
1265    /// Applications should not connect to it, but may emit it with
1266    /// g_signal_emit_by_name() if they need to control the cursor
1267    /// programmatically.
1268    ///
1269    /// The default bindings for this signal are Up/Down and PageUp/PageDown.
1270    /// ## `scroll`
1271    /// a [`ScrollType`][crate::ScrollType] to specify the speed and amount of change
1272    #[doc(alias = "change-value")]
1273    pub fn connect_change_value<F: Fn(&Self, ScrollType) + 'static>(
1274        &self,
1275        f: F,
1276    ) -> SignalHandlerId {
1277        unsafe extern "C" fn change_value_trampoline<F: Fn(&SpinButton, ScrollType) + 'static>(
1278            this: *mut ffi::GtkSpinButton,
1279            scroll: ffi::GtkScrollType,
1280            f: glib::ffi::gpointer,
1281        ) {
1282            unsafe {
1283                let f: &F = &*(f as *const F);
1284                f(&from_glib_borrow(this), from_glib(scroll))
1285            }
1286        }
1287        unsafe {
1288            let f: Box_<F> = Box_::new(f);
1289            connect_raw(
1290                self.as_ptr() as *mut _,
1291                c"change-value".as_ptr(),
1292                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1293                    change_value_trampoline::<F> as *const (),
1294                )),
1295                Box_::into_raw(f),
1296            )
1297        }
1298    }
1299
1300    pub fn emit_change_value(&self, scroll: ScrollType) {
1301        self.emit_by_name::<()>("change-value", &[&scroll]);
1302    }
1303
1304    /// Emitted to tweak the formatting of the value for display.
1305    ///
1306    /// **⚠️ The following code is in c ⚠️**
1307    ///
1308    /// ```c
1309    /// // show leading zeros
1310    /// static gboolean
1311    /// on_output (GtkSpinButton *spin,
1312    ///            gpointer       data)
1313    /// {
1314    ///    char *text;
1315    ///    int value;
1316    ///
1317    ///    value = gtk_spin_button_get_value_as_int (spin);
1318    ///    text = g_strdup_printf ("%02d", value);
1319    ///    gtk_editable_set_text (GTK_EDITABLE (spin), text):
1320    ///    g_free (text);
1321    ///
1322    ///    return TRUE;
1323    /// }
1324    /// ```
1325    ///
1326    /// # Returns
1327    ///
1328    /// [`true`] if the value has been displayed
1329    #[doc(alias = "output")]
1330    pub fn connect_output<F: Fn(&Self) -> glib::Propagation + 'static>(
1331        &self,
1332        f: F,
1333    ) -> SignalHandlerId {
1334        unsafe extern "C" fn output_trampoline<
1335            F: Fn(&SpinButton) -> glib::Propagation + 'static,
1336        >(
1337            this: *mut ffi::GtkSpinButton,
1338            f: glib::ffi::gpointer,
1339        ) -> glib::ffi::gboolean {
1340            unsafe {
1341                let f: &F = &*(f as *const F);
1342                f(&from_glib_borrow(this)).into_glib()
1343            }
1344        }
1345        unsafe {
1346            let f: Box_<F> = Box_::new(f);
1347            connect_raw(
1348                self.as_ptr() as *mut _,
1349                c"output".as_ptr(),
1350                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1351                    output_trampoline::<F> as *const (),
1352                )),
1353                Box_::into_raw(f),
1354            )
1355        }
1356    }
1357
1358    /// Emitted when the value is changed.
1359    ///
1360    /// Also see the [`output`][struct@crate::SpinButton#output] signal.
1361    #[doc(alias = "value-changed")]
1362    pub fn connect_value_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1363        unsafe extern "C" fn value_changed_trampoline<F: Fn(&SpinButton) + 'static>(
1364            this: *mut ffi::GtkSpinButton,
1365            f: glib::ffi::gpointer,
1366        ) {
1367            unsafe {
1368                let f: &F = &*(f as *const F);
1369                f(&from_glib_borrow(this))
1370            }
1371        }
1372        unsafe {
1373            let f: Box_<F> = Box_::new(f);
1374            connect_raw(
1375                self.as_ptr() as *mut _,
1376                c"value-changed".as_ptr(),
1377                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1378                    value_changed_trampoline::<F> as *const (),
1379                )),
1380                Box_::into_raw(f),
1381            )
1382        }
1383    }
1384
1385    /// Emitted right after the spinbutton wraps from its maximum
1386    /// to its minimum value or vice-versa.
1387    #[doc(alias = "wrapped")]
1388    pub fn connect_wrapped<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1389        unsafe extern "C" fn wrapped_trampoline<F: Fn(&SpinButton) + 'static>(
1390            this: *mut ffi::GtkSpinButton,
1391            f: glib::ffi::gpointer,
1392        ) {
1393            unsafe {
1394                let f: &F = &*(f as *const F);
1395                f(&from_glib_borrow(this))
1396            }
1397        }
1398        unsafe {
1399            let f: Box_<F> = Box_::new(f);
1400            connect_raw(
1401                self.as_ptr() as *mut _,
1402                c"wrapped".as_ptr(),
1403                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1404                    wrapped_trampoline::<F> as *const (),
1405                )),
1406                Box_::into_raw(f),
1407            )
1408        }
1409    }
1410
1411    #[cfg(feature = "v4_14")]
1412    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
1413    #[doc(alias = "activates-default")]
1414    pub fn connect_activates_default_notify<F: Fn(&Self) + 'static>(
1415        &self,
1416        f: F,
1417    ) -> SignalHandlerId {
1418        unsafe extern "C" fn notify_activates_default_trampoline<F: Fn(&SpinButton) + 'static>(
1419            this: *mut ffi::GtkSpinButton,
1420            _param_spec: glib::ffi::gpointer,
1421            f: glib::ffi::gpointer,
1422        ) {
1423            unsafe {
1424                let f: &F = &*(f as *const F);
1425                f(&from_glib_borrow(this))
1426            }
1427        }
1428        unsafe {
1429            let f: Box_<F> = Box_::new(f);
1430            connect_raw(
1431                self.as_ptr() as *mut _,
1432                c"notify::activates-default".as_ptr(),
1433                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1434                    notify_activates_default_trampoline::<F> as *const (),
1435                )),
1436                Box_::into_raw(f),
1437            )
1438        }
1439    }
1440
1441    #[doc(alias = "adjustment")]
1442    pub fn connect_adjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1443        unsafe extern "C" fn notify_adjustment_trampoline<F: Fn(&SpinButton) + 'static>(
1444            this: *mut ffi::GtkSpinButton,
1445            _param_spec: glib::ffi::gpointer,
1446            f: glib::ffi::gpointer,
1447        ) {
1448            unsafe {
1449                let f: &F = &*(f as *const F);
1450                f(&from_glib_borrow(this))
1451            }
1452        }
1453        unsafe {
1454            let f: Box_<F> = Box_::new(f);
1455            connect_raw(
1456                self.as_ptr() as *mut _,
1457                c"notify::adjustment".as_ptr(),
1458                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1459                    notify_adjustment_trampoline::<F> as *const (),
1460                )),
1461                Box_::into_raw(f),
1462            )
1463        }
1464    }
1465
1466    #[doc(alias = "climb-rate")]
1467    pub fn connect_climb_rate_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1468        unsafe extern "C" fn notify_climb_rate_trampoline<F: Fn(&SpinButton) + 'static>(
1469            this: *mut ffi::GtkSpinButton,
1470            _param_spec: glib::ffi::gpointer,
1471            f: glib::ffi::gpointer,
1472        ) {
1473            unsafe {
1474                let f: &F = &*(f as *const F);
1475                f(&from_glib_borrow(this))
1476            }
1477        }
1478        unsafe {
1479            let f: Box_<F> = Box_::new(f);
1480            connect_raw(
1481                self.as_ptr() as *mut _,
1482                c"notify::climb-rate".as_ptr(),
1483                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1484                    notify_climb_rate_trampoline::<F> as *const (),
1485                )),
1486                Box_::into_raw(f),
1487            )
1488        }
1489    }
1490
1491    #[doc(alias = "digits")]
1492    pub fn connect_digits_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1493        unsafe extern "C" fn notify_digits_trampoline<F: Fn(&SpinButton) + 'static>(
1494            this: *mut ffi::GtkSpinButton,
1495            _param_spec: glib::ffi::gpointer,
1496            f: glib::ffi::gpointer,
1497        ) {
1498            unsafe {
1499                let f: &F = &*(f as *const F);
1500                f(&from_glib_borrow(this))
1501            }
1502        }
1503        unsafe {
1504            let f: Box_<F> = Box_::new(f);
1505            connect_raw(
1506                self.as_ptr() as *mut _,
1507                c"notify::digits".as_ptr(),
1508                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1509                    notify_digits_trampoline::<F> as *const (),
1510                )),
1511                Box_::into_raw(f),
1512            )
1513        }
1514    }
1515
1516    #[doc(alias = "numeric")]
1517    pub fn connect_numeric_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1518        unsafe extern "C" fn notify_numeric_trampoline<F: Fn(&SpinButton) + 'static>(
1519            this: *mut ffi::GtkSpinButton,
1520            _param_spec: glib::ffi::gpointer,
1521            f: glib::ffi::gpointer,
1522        ) {
1523            unsafe {
1524                let f: &F = &*(f as *const F);
1525                f(&from_glib_borrow(this))
1526            }
1527        }
1528        unsafe {
1529            let f: Box_<F> = Box_::new(f);
1530            connect_raw(
1531                self.as_ptr() as *mut _,
1532                c"notify::numeric".as_ptr(),
1533                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1534                    notify_numeric_trampoline::<F> as *const (),
1535                )),
1536                Box_::into_raw(f),
1537            )
1538        }
1539    }
1540
1541    #[doc(alias = "snap-to-ticks")]
1542    pub fn connect_snap_to_ticks_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1543        unsafe extern "C" fn notify_snap_to_ticks_trampoline<F: Fn(&SpinButton) + 'static>(
1544            this: *mut ffi::GtkSpinButton,
1545            _param_spec: glib::ffi::gpointer,
1546            f: glib::ffi::gpointer,
1547        ) {
1548            unsafe {
1549                let f: &F = &*(f as *const F);
1550                f(&from_glib_borrow(this))
1551            }
1552        }
1553        unsafe {
1554            let f: Box_<F> = Box_::new(f);
1555            connect_raw(
1556                self.as_ptr() as *mut _,
1557                c"notify::snap-to-ticks".as_ptr(),
1558                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1559                    notify_snap_to_ticks_trampoline::<F> as *const (),
1560                )),
1561                Box_::into_raw(f),
1562            )
1563        }
1564    }
1565
1566    #[doc(alias = "update-policy")]
1567    pub fn connect_update_policy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1568        unsafe extern "C" fn notify_update_policy_trampoline<F: Fn(&SpinButton) + 'static>(
1569            this: *mut ffi::GtkSpinButton,
1570            _param_spec: glib::ffi::gpointer,
1571            f: glib::ffi::gpointer,
1572        ) {
1573            unsafe {
1574                let f: &F = &*(f as *const F);
1575                f(&from_glib_borrow(this))
1576            }
1577        }
1578        unsafe {
1579            let f: Box_<F> = Box_::new(f);
1580            connect_raw(
1581                self.as_ptr() as *mut _,
1582                c"notify::update-policy".as_ptr(),
1583                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1584                    notify_update_policy_trampoline::<F> as *const (),
1585                )),
1586                Box_::into_raw(f),
1587            )
1588        }
1589    }
1590
1591    #[doc(alias = "value")]
1592    pub fn connect_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1593        unsafe extern "C" fn notify_value_trampoline<F: Fn(&SpinButton) + 'static>(
1594            this: *mut ffi::GtkSpinButton,
1595            _param_spec: glib::ffi::gpointer,
1596            f: glib::ffi::gpointer,
1597        ) {
1598            unsafe {
1599                let f: &F = &*(f as *const F);
1600                f(&from_glib_borrow(this))
1601            }
1602        }
1603        unsafe {
1604            let f: Box_<F> = Box_::new(f);
1605            connect_raw(
1606                self.as_ptr() as *mut _,
1607                c"notify::value".as_ptr(),
1608                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1609                    notify_value_trampoline::<F> as *const (),
1610                )),
1611                Box_::into_raw(f),
1612            )
1613        }
1614    }
1615
1616    #[doc(alias = "wrap")]
1617    pub fn connect_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1618        unsafe extern "C" fn notify_wrap_trampoline<F: Fn(&SpinButton) + 'static>(
1619            this: *mut ffi::GtkSpinButton,
1620            _param_spec: glib::ffi::gpointer,
1621            f: glib::ffi::gpointer,
1622        ) {
1623            unsafe {
1624                let f: &F = &*(f as *const F);
1625                f(&from_glib_borrow(this))
1626            }
1627        }
1628        unsafe {
1629            let f: Box_<F> = Box_::new(f);
1630            connect_raw(
1631                self.as_ptr() as *mut _,
1632                c"notify::wrap".as_ptr(),
1633                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1634                    notify_wrap_trampoline::<F> as *const (),
1635                )),
1636                Box_::into_raw(f),
1637            )
1638        }
1639    }
1640}
1641
1642impl Default for SpinButton {
1643    fn default() -> Self {
1644        glib::object::Object::new::<Self>()
1645    }
1646}
1647
1648// rustdoc-stripper-ignore-next
1649/// A [builder-pattern] type to construct [`SpinButton`] objects.
1650///
1651/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1652#[must_use = "The builder must be built to be used"]
1653pub struct SpinButtonBuilder {
1654    builder: glib::object::ObjectBuilder<'static, SpinButton>,
1655}
1656
1657impl SpinButtonBuilder {
1658    fn new() -> Self {
1659        Self {
1660            builder: glib::object::Object::builder(),
1661        }
1662    }
1663
1664    /// Whether to activate the default widget when the spin button is activated.
1665    ///
1666    /// See [`activate`][struct@crate::SpinButton#activate] for what counts as activation.
1667    #[cfg(feature = "v4_14")]
1668    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
1669    pub fn activates_default(self, activates_default: bool) -> Self {
1670        Self {
1671            builder: self
1672                .builder
1673                .property("activates-default", activates_default),
1674        }
1675    }
1676
1677    /// The adjustment that holds the value of the spin button.
1678    pub fn adjustment(self, adjustment: &impl IsA<Adjustment>) -> Self {
1679        Self {
1680            builder: self
1681                .builder
1682                .property("adjustment", adjustment.clone().upcast()),
1683        }
1684    }
1685
1686    /// The acceleration rate when you hold down a button or key.
1687    pub fn climb_rate(self, climb_rate: f64) -> Self {
1688        Self {
1689            builder: self.builder.property("climb-rate", climb_rate),
1690        }
1691    }
1692
1693    /// The number of decimal places to display.
1694    pub fn digits(self, digits: u32) -> Self {
1695        Self {
1696            builder: self.builder.property("digits", digits),
1697        }
1698    }
1699
1700    /// Whether non-numeric characters should be ignored.
1701    pub fn numeric(self, numeric: bool) -> Self {
1702        Self {
1703            builder: self.builder.property("numeric", numeric),
1704        }
1705    }
1706
1707    /// Whether erroneous values are automatically changed to the spin buttons
1708    /// nearest step increment.
1709    pub fn snap_to_ticks(self, snap_to_ticks: bool) -> Self {
1710        Self {
1711            builder: self.builder.property("snap-to-ticks", snap_to_ticks),
1712        }
1713    }
1714
1715    /// Whether the spin button should update always, or only when the value
1716    /// is acceptable.
1717    pub fn update_policy(self, update_policy: SpinButtonUpdatePolicy) -> Self {
1718        Self {
1719            builder: self.builder.property("update-policy", update_policy),
1720        }
1721    }
1722
1723    /// The current value.
1724    pub fn value(self, value: f64) -> Self {
1725        Self {
1726            builder: self.builder.property("value", value),
1727        }
1728    }
1729
1730    /// Whether a spin button should wrap upon reaching its limits.
1731    pub fn wrap(self, wrap: bool) -> Self {
1732        Self {
1733            builder: self.builder.property("wrap", wrap),
1734        }
1735    }
1736
1737    /// Whether the widget or any of its descendents can accept
1738    /// the input focus.
1739    ///
1740    /// This property is meant to be set by widget implementations,
1741    /// typically in their instance init function.
1742    pub fn can_focus(self, can_focus: bool) -> Self {
1743        Self {
1744            builder: self.builder.property("can-focus", can_focus),
1745        }
1746    }
1747
1748    /// Whether the widget can receive pointer events.
1749    pub fn can_target(self, can_target: bool) -> Self {
1750        Self {
1751            builder: self.builder.property("can-target", can_target),
1752        }
1753    }
1754
1755    /// A list of css classes applied to this widget.
1756    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1757        Self {
1758            builder: self.builder.property("css-classes", css_classes.into()),
1759        }
1760    }
1761
1762    /// The name of this widget in the CSS tree.
1763    ///
1764    /// This property is meant to be set by widget implementations,
1765    /// typically in their instance init function.
1766    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1767        Self {
1768            builder: self.builder.property("css-name", css_name.into()),
1769        }
1770    }
1771
1772    /// The cursor used by @widget.
1773    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1774        Self {
1775            builder: self.builder.property("cursor", cursor.clone()),
1776        }
1777    }
1778
1779    /// Whether the widget should grab focus when it is clicked with the mouse.
1780    ///
1781    /// This property is only relevant for widgets that can take focus.
1782    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1783        Self {
1784            builder: self.builder.property("focus-on-click", focus_on_click),
1785        }
1786    }
1787
1788    /// Whether this widget itself will accept the input focus.
1789    pub fn focusable(self, focusable: bool) -> Self {
1790        Self {
1791            builder: self.builder.property("focusable", focusable),
1792        }
1793    }
1794
1795    /// How to distribute horizontal space if widget gets extra space.
1796    pub fn halign(self, halign: Align) -> Self {
1797        Self {
1798            builder: self.builder.property("halign", halign),
1799        }
1800    }
1801
1802    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1803    /// signal on @widget.
1804    ///
1805    /// A true value indicates that @widget can have a tooltip, in this case
1806    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1807    /// determine whether it will provide a tooltip or not.
1808    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1809        Self {
1810            builder: self.builder.property("has-tooltip", has_tooltip),
1811        }
1812    }
1813
1814    /// Overrides for height request of the widget.
1815    ///
1816    /// If this is -1, the natural request will be used.
1817    pub fn height_request(self, height_request: i32) -> Self {
1818        Self {
1819            builder: self.builder.property("height-request", height_request),
1820        }
1821    }
1822
1823    /// Whether to expand horizontally.
1824    pub fn hexpand(self, hexpand: bool) -> Self {
1825        Self {
1826            builder: self.builder.property("hexpand", hexpand),
1827        }
1828    }
1829
1830    /// Whether to use the `hexpand` property.
1831    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1832        Self {
1833            builder: self.builder.property("hexpand-set", hexpand_set),
1834        }
1835    }
1836
1837    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1838    /// the preferred size of the widget, and allocate its children.
1839    ///
1840    /// This property is meant to be set by widget implementations,
1841    /// typically in their instance init function.
1842    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1843        Self {
1844            builder: self
1845                .builder
1846                .property("layout-manager", layout_manager.clone().upcast()),
1847        }
1848    }
1849
1850    /// Makes this widget act like a modal dialog, with respect to
1851    /// event delivery.
1852    ///
1853    /// Global event controllers will not handle events with targets
1854    /// inside the widget, unless they are set up to ignore propagation
1855    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1856    #[cfg(feature = "v4_18")]
1857    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1858    pub fn limit_events(self, limit_events: bool) -> Self {
1859        Self {
1860            builder: self.builder.property("limit-events", limit_events),
1861        }
1862    }
1863
1864    /// Margin on bottom side of widget.
1865    ///
1866    /// This property adds margin outside of the widget's normal size
1867    /// request, the margin will be added in addition to the size from
1868    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1869    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1870        Self {
1871            builder: self.builder.property("margin-bottom", margin_bottom),
1872        }
1873    }
1874
1875    /// Margin on end of widget, horizontally.
1876    ///
1877    /// This property supports left-to-right and right-to-left text
1878    /// directions.
1879    ///
1880    /// This property adds margin outside of the widget's normal size
1881    /// request, the margin will be added in addition to the size from
1882    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1883    pub fn margin_end(self, margin_end: i32) -> Self {
1884        Self {
1885            builder: self.builder.property("margin-end", margin_end),
1886        }
1887    }
1888
1889    /// Margin on start of widget, horizontally.
1890    ///
1891    /// This property supports left-to-right and right-to-left text
1892    /// directions.
1893    ///
1894    /// This property adds margin outside of the widget's normal size
1895    /// request, the margin will be added in addition to the size from
1896    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1897    pub fn margin_start(self, margin_start: i32) -> Self {
1898        Self {
1899            builder: self.builder.property("margin-start", margin_start),
1900        }
1901    }
1902
1903    /// Margin on top side of widget.
1904    ///
1905    /// This property adds margin outside of the widget's normal size
1906    /// request, the margin will be added in addition to the size from
1907    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1908    pub fn margin_top(self, margin_top: i32) -> Self {
1909        Self {
1910            builder: self.builder.property("margin-top", margin_top),
1911        }
1912    }
1913
1914    /// The name of the widget.
1915    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1916        Self {
1917            builder: self.builder.property("name", name.into()),
1918        }
1919    }
1920
1921    /// The requested opacity of the widget.
1922    pub fn opacity(self, opacity: f64) -> Self {
1923        Self {
1924            builder: self.builder.property("opacity", opacity),
1925        }
1926    }
1927
1928    /// How content outside the widget's content area is treated.
1929    ///
1930    /// This property is meant to be set by widget implementations,
1931    /// typically in their instance init function.
1932    pub fn overflow(self, overflow: Overflow) -> Self {
1933        Self {
1934            builder: self.builder.property("overflow", overflow),
1935        }
1936    }
1937
1938    /// Whether the widget will receive the default action when it is focused.
1939    pub fn receives_default(self, receives_default: bool) -> Self {
1940        Self {
1941            builder: self.builder.property("receives-default", receives_default),
1942        }
1943    }
1944
1945    /// Whether the widget responds to input.
1946    pub fn sensitive(self, sensitive: bool) -> Self {
1947        Self {
1948            builder: self.builder.property("sensitive", sensitive),
1949        }
1950    }
1951
1952    /// Sets the text of tooltip to be the given string, which is marked up
1953    /// with Pango markup.
1954    ///
1955    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1956    ///
1957    /// This is a convenience property which will take care of getting the
1958    /// tooltip shown if the given string is not `NULL`:
1959    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1960    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1961    /// the default signal handler.
1962    ///
1963    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1964    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1965    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1966        Self {
1967            builder: self
1968                .builder
1969                .property("tooltip-markup", tooltip_markup.into()),
1970        }
1971    }
1972
1973    /// Sets the text of tooltip to be the given string.
1974    ///
1975    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1976    ///
1977    /// This is a convenience property which will take care of getting the
1978    /// tooltip shown if the given string is not `NULL`:
1979    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1980    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1981    /// the default signal handler.
1982    ///
1983    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1984    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1985    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1986        Self {
1987            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1988        }
1989    }
1990
1991    /// How to distribute vertical space if widget gets extra space.
1992    pub fn valign(self, valign: Align) -> Self {
1993        Self {
1994            builder: self.builder.property("valign", valign),
1995        }
1996    }
1997
1998    /// Whether to expand vertically.
1999    pub fn vexpand(self, vexpand: bool) -> Self {
2000        Self {
2001            builder: self.builder.property("vexpand", vexpand),
2002        }
2003    }
2004
2005    /// Whether to use the `vexpand` property.
2006    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
2007        Self {
2008            builder: self.builder.property("vexpand-set", vexpand_set),
2009        }
2010    }
2011
2012    /// Whether the widget is visible.
2013    pub fn visible(self, visible: bool) -> Self {
2014        Self {
2015            builder: self.builder.property("visible", visible),
2016        }
2017    }
2018
2019    /// Overrides for width request of the widget.
2020    ///
2021    /// If this is -1, the natural request will be used.
2022    pub fn width_request(self, width_request: i32) -> Self {
2023        Self {
2024            builder: self.builder.property("width-request", width_request),
2025        }
2026    }
2027
2028    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
2029    ///
2030    /// The accessible role cannot be changed once set.
2031    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
2032        Self {
2033            builder: self.builder.property("accessible-role", accessible_role),
2034        }
2035    }
2036
2037    /// Indicates whether editing on the cell has been canceled.
2038    pub fn editing_canceled(self, editing_canceled: bool) -> Self {
2039        Self {
2040            builder: self.builder.property("editing-canceled", editing_canceled),
2041        }
2042    }
2043
2044    /// Whether the entry contents can be edited.
2045    pub fn editable(self, editable: bool) -> Self {
2046        Self {
2047            builder: self.builder.property("editable", editable),
2048        }
2049    }
2050
2051    /// If undo/redo should be enabled for the editable.
2052    pub fn enable_undo(self, enable_undo: bool) -> Self {
2053        Self {
2054            builder: self.builder.property("enable-undo", enable_undo),
2055        }
2056    }
2057
2058    /// The desired maximum width of the entry, in characters.
2059    pub fn max_width_chars(self, max_width_chars: i32) -> Self {
2060        Self {
2061            builder: self.builder.property("max-width-chars", max_width_chars),
2062        }
2063    }
2064
2065    /// The contents of the entry.
2066    pub fn text(self, text: impl Into<glib::GString>) -> Self {
2067        Self {
2068            builder: self.builder.property("text", text.into()),
2069        }
2070    }
2071
2072    /// Number of characters to leave space for in the entry.
2073    pub fn width_chars(self, width_chars: i32) -> Self {
2074        Self {
2075            builder: self.builder.property("width-chars", width_chars),
2076        }
2077    }
2078
2079    /// The horizontal alignment, from 0 (left) to 1 (right).
2080    ///
2081    /// Reversed for RTL layouts.
2082    pub fn xalign(self, xalign: f32) -> Self {
2083        Self {
2084            builder: self.builder.property("xalign", xalign),
2085        }
2086    }
2087
2088    /// The orientation of the orientable.
2089    pub fn orientation(self, orientation: Orientation) -> Self {
2090        Self {
2091            builder: self.builder.property("orientation", orientation),
2092        }
2093    }
2094
2095    // rustdoc-stripper-ignore-next
2096    /// Build the [`SpinButton`].
2097    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
2098    pub fn build(self) -> SpinButton {
2099        assert_initialized_main_thread!();
2100        self.builder.build()
2101    }
2102}