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