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