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