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
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 /// [enum@Gtk.AccessibleRole.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 unsafe {
1132 let f: &F = &*(f as *const F);
1133 f(&from_glib_borrow(this)).into_glib()
1134 }
1135 }
1136 unsafe {
1137 let f: Box_<F> = Box_::new(f);
1138 connect_raw(
1139 self.as_ptr() as *mut _,
1140 c"output".as_ptr(),
1141 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1142 output_trampoline::<F> as *const (),
1143 )),
1144 Box_::into_raw(f),
1145 )
1146 }
1147 }
1148
1149 /// Emitted right after the spinbutton wraps.
1150 ///
1151 /// See [`wrapped`][struct@crate::Gtk::SpinButton#wrapped].
1152 #[cfg(feature = "v1_4")]
1153 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1154 #[doc(alias = "wrapped")]
1155 pub fn connect_wrapped<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1156 unsafe extern "C" fn wrapped_trampoline<F: Fn(&SpinRow) + 'static>(
1157 this: *mut ffi::AdwSpinRow,
1158 f: glib::ffi::gpointer,
1159 ) {
1160 unsafe {
1161 let f: &F = &*(f as *const F);
1162 f(&from_glib_borrow(this))
1163 }
1164 }
1165 unsafe {
1166 let f: Box_<F> = Box_::new(f);
1167 connect_raw(
1168 self.as_ptr() as *mut _,
1169 c"wrapped".as_ptr(),
1170 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1171 wrapped_trampoline::<F> as *const (),
1172 )),
1173 Box_::into_raw(f),
1174 )
1175 }
1176 }
1177
1178 #[cfg(feature = "v1_4")]
1179 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1180 #[doc(alias = "adjustment")]
1181 pub fn connect_adjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1182 unsafe extern "C" fn notify_adjustment_trampoline<F: Fn(&SpinRow) + 'static>(
1183 this: *mut ffi::AdwSpinRow,
1184 _param_spec: glib::ffi::gpointer,
1185 f: glib::ffi::gpointer,
1186 ) {
1187 unsafe {
1188 let f: &F = &*(f as *const F);
1189 f(&from_glib_borrow(this))
1190 }
1191 }
1192 unsafe {
1193 let f: Box_<F> = Box_::new(f);
1194 connect_raw(
1195 self.as_ptr() as *mut _,
1196 c"notify::adjustment".as_ptr(),
1197 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1198 notify_adjustment_trampoline::<F> as *const (),
1199 )),
1200 Box_::into_raw(f),
1201 )
1202 }
1203 }
1204
1205 #[cfg(feature = "v1_4")]
1206 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1207 #[doc(alias = "climb-rate")]
1208 pub fn connect_climb_rate_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1209 unsafe extern "C" fn notify_climb_rate_trampoline<F: Fn(&SpinRow) + 'static>(
1210 this: *mut ffi::AdwSpinRow,
1211 _param_spec: glib::ffi::gpointer,
1212 f: glib::ffi::gpointer,
1213 ) {
1214 unsafe {
1215 let f: &F = &*(f as *const F);
1216 f(&from_glib_borrow(this))
1217 }
1218 }
1219 unsafe {
1220 let f: Box_<F> = Box_::new(f);
1221 connect_raw(
1222 self.as_ptr() as *mut _,
1223 c"notify::climb-rate".as_ptr(),
1224 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1225 notify_climb_rate_trampoline::<F> as *const (),
1226 )),
1227 Box_::into_raw(f),
1228 )
1229 }
1230 }
1231
1232 #[cfg(feature = "v1_4")]
1233 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1234 #[doc(alias = "digits")]
1235 pub fn connect_digits_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1236 unsafe extern "C" fn notify_digits_trampoline<F: Fn(&SpinRow) + 'static>(
1237 this: *mut ffi::AdwSpinRow,
1238 _param_spec: glib::ffi::gpointer,
1239 f: glib::ffi::gpointer,
1240 ) {
1241 unsafe {
1242 let f: &F = &*(f as *const F);
1243 f(&from_glib_borrow(this))
1244 }
1245 }
1246 unsafe {
1247 let f: Box_<F> = Box_::new(f);
1248 connect_raw(
1249 self.as_ptr() as *mut _,
1250 c"notify::digits".as_ptr(),
1251 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1252 notify_digits_trampoline::<F> as *const (),
1253 )),
1254 Box_::into_raw(f),
1255 )
1256 }
1257 }
1258
1259 #[cfg(feature = "v1_4")]
1260 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1261 #[doc(alias = "numeric")]
1262 pub fn connect_numeric_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1263 unsafe extern "C" fn notify_numeric_trampoline<F: Fn(&SpinRow) + 'static>(
1264 this: *mut ffi::AdwSpinRow,
1265 _param_spec: glib::ffi::gpointer,
1266 f: glib::ffi::gpointer,
1267 ) {
1268 unsafe {
1269 let f: &F = &*(f as *const F);
1270 f(&from_glib_borrow(this))
1271 }
1272 }
1273 unsafe {
1274 let f: Box_<F> = Box_::new(f);
1275 connect_raw(
1276 self.as_ptr() as *mut _,
1277 c"notify::numeric".as_ptr(),
1278 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1279 notify_numeric_trampoline::<F> as *const (),
1280 )),
1281 Box_::into_raw(f),
1282 )
1283 }
1284 }
1285
1286 #[cfg(feature = "v1_4")]
1287 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1288 #[doc(alias = "snap-to-ticks")]
1289 pub fn connect_snap_to_ticks_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1290 unsafe extern "C" fn notify_snap_to_ticks_trampoline<F: Fn(&SpinRow) + 'static>(
1291 this: *mut ffi::AdwSpinRow,
1292 _param_spec: glib::ffi::gpointer,
1293 f: glib::ffi::gpointer,
1294 ) {
1295 unsafe {
1296 let f: &F = &*(f as *const F);
1297 f(&from_glib_borrow(this))
1298 }
1299 }
1300 unsafe {
1301 let f: Box_<F> = Box_::new(f);
1302 connect_raw(
1303 self.as_ptr() as *mut _,
1304 c"notify::snap-to-ticks".as_ptr(),
1305 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1306 notify_snap_to_ticks_trampoline::<F> as *const (),
1307 )),
1308 Box_::into_raw(f),
1309 )
1310 }
1311 }
1312
1313 #[cfg(feature = "v1_4")]
1314 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1315 #[doc(alias = "update-policy")]
1316 pub fn connect_update_policy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1317 unsafe extern "C" fn notify_update_policy_trampoline<F: Fn(&SpinRow) + 'static>(
1318 this: *mut ffi::AdwSpinRow,
1319 _param_spec: glib::ffi::gpointer,
1320 f: glib::ffi::gpointer,
1321 ) {
1322 unsafe {
1323 let f: &F = &*(f as *const F);
1324 f(&from_glib_borrow(this))
1325 }
1326 }
1327 unsafe {
1328 let f: Box_<F> = Box_::new(f);
1329 connect_raw(
1330 self.as_ptr() as *mut _,
1331 c"notify::update-policy".as_ptr(),
1332 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1333 notify_update_policy_trampoline::<F> as *const (),
1334 )),
1335 Box_::into_raw(f),
1336 )
1337 }
1338 }
1339
1340 #[cfg(feature = "v1_4")]
1341 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1342 #[doc(alias = "value")]
1343 pub fn connect_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1344 unsafe extern "C" fn notify_value_trampoline<F: Fn(&SpinRow) + 'static>(
1345 this: *mut ffi::AdwSpinRow,
1346 _param_spec: glib::ffi::gpointer,
1347 f: glib::ffi::gpointer,
1348 ) {
1349 unsafe {
1350 let f: &F = &*(f as *const F);
1351 f(&from_glib_borrow(this))
1352 }
1353 }
1354 unsafe {
1355 let f: Box_<F> = Box_::new(f);
1356 connect_raw(
1357 self.as_ptr() as *mut _,
1358 c"notify::value".as_ptr(),
1359 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1360 notify_value_trampoline::<F> as *const (),
1361 )),
1362 Box_::into_raw(f),
1363 )
1364 }
1365 }
1366
1367 #[cfg(feature = "v1_4")]
1368 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1369 #[doc(alias = "wrap")]
1370 pub fn connect_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1371 unsafe extern "C" fn notify_wrap_trampoline<F: Fn(&SpinRow) + 'static>(
1372 this: *mut ffi::AdwSpinRow,
1373 _param_spec: glib::ffi::gpointer,
1374 f: glib::ffi::gpointer,
1375 ) {
1376 unsafe {
1377 let f: &F = &*(f as *const F);
1378 f(&from_glib_borrow(this))
1379 }
1380 }
1381 unsafe {
1382 let f: Box_<F> = Box_::new(f);
1383 connect_raw(
1384 self.as_ptr() as *mut _,
1385 c"notify::wrap".as_ptr(),
1386 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1387 notify_wrap_trampoline::<F> as *const (),
1388 )),
1389 Box_::into_raw(f),
1390 )
1391 }
1392 }
1393}
1394
1395#[cfg(feature = "v1_4")]
1396#[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1397impl Default for SpinRow {
1398 fn default() -> Self {
1399 glib::object::Object::new::<Self>()
1400 }
1401}
1402
1403// rustdoc-stripper-ignore-next
1404/// A [builder-pattern] type to construct [`SpinRow`] objects.
1405///
1406/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1407#[must_use = "The builder must be built to be used"]
1408pub struct SpinRowBuilder {
1409 builder: glib::object::ObjectBuilder<'static, SpinRow>,
1410}
1411
1412impl SpinRowBuilder {
1413 fn new() -> Self {
1414 Self {
1415 builder: glib::object::Object::builder(),
1416 }
1417 }
1418
1419 /// The adjustment that holds the value of the spin row.
1420 #[cfg(feature = "v1_4")]
1421 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1422 pub fn adjustment(self, adjustment: &impl IsA<gtk::Adjustment>) -> Self {
1423 Self {
1424 builder: self
1425 .builder
1426 .property("adjustment", adjustment.clone().upcast()),
1427 }
1428 }
1429
1430 /// The acceleration rate when you hold down a button or key.
1431 #[cfg(feature = "v1_4")]
1432 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1433 pub fn climb_rate(self, climb_rate: f64) -> Self {
1434 Self {
1435 builder: self.builder.property("climb-rate", climb_rate),
1436 }
1437 }
1438
1439 /// The number of decimal places to display.
1440 #[cfg(feature = "v1_4")]
1441 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1442 pub fn digits(self, digits: u32) -> Self {
1443 Self {
1444 builder: self.builder.property("digits", digits),
1445 }
1446 }
1447
1448 /// Whether non-numeric characters should be ignored.
1449 #[cfg(feature = "v1_4")]
1450 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1451 pub fn numeric(self, numeric: bool) -> Self {
1452 Self {
1453 builder: self.builder.property("numeric", numeric),
1454 }
1455 }
1456
1457 /// Whether invalid values are snapped to the nearest step increment.
1458 #[cfg(feature = "v1_4")]
1459 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1460 pub fn snap_to_ticks(self, snap_to_ticks: bool) -> Self {
1461 Self {
1462 builder: self.builder.property("snap-to-ticks", snap_to_ticks),
1463 }
1464 }
1465
1466 /// The policy for updating the spin row.
1467 ///
1468 /// The options are always, or only when the value is invalid.
1469 #[cfg(feature = "v1_4")]
1470 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1471 pub fn update_policy(self, update_policy: gtk::SpinButtonUpdatePolicy) -> Self {
1472 Self {
1473 builder: self.builder.property("update-policy", update_policy),
1474 }
1475 }
1476
1477 /// The current value.
1478 #[cfg(feature = "v1_4")]
1479 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1480 pub fn value(self, value: f64) -> Self {
1481 Self {
1482 builder: self.builder.property("value", value),
1483 }
1484 }
1485
1486 /// Whether the spin row should wrap upon reaching its limits.
1487 #[cfg(feature = "v1_4")]
1488 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1489 pub fn wrap(self, wrap: bool) -> Self {
1490 Self {
1491 builder: self.builder.property("wrap", wrap),
1492 }
1493 }
1494
1495 /// The widget to activate when the row is activated.
1496 ///
1497 /// The row can be activated either by clicking on it, calling
1498 /// [`ActionRowExt::activate()`][crate::prelude::ActionRowExt::activate()], or via mnemonics in the title.
1499 /// See the [`use-underline`][struct@crate::PreferencesRow#use-underline] property to enable
1500 /// mnemonics.
1501 ///
1502 /// The target widget will be activated by emitting the
1503 /// [`mnemonic-activate`][struct@crate::gtk::Widget#mnemonic-activate] signal on it.
1504 pub fn activatable_widget(self, activatable_widget: &impl IsA<gtk::Widget>) -> Self {
1505 Self {
1506 builder: self
1507 .builder
1508 .property("activatable-widget", activatable_widget.clone().upcast()),
1509 }
1510 }
1511
1512 /// The icon name for this row.
1513 /// Use [`ActionRowExt::add_prefix()`][crate::prelude::ActionRowExt::add_prefix()] to add an icon.
1514 #[cfg_attr(feature = "v1_3", deprecated = "Since 1.3")]
1515 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
1516 Self {
1517 builder: self.builder.property("icon-name", icon_name.into()),
1518 }
1519 }
1520
1521 /// The subtitle for this row.
1522 ///
1523 /// The subtitle is interpreted as Pango markup unless
1524 /// [`use-markup`][struct@crate::PreferencesRow#use-markup] is set to `FALSE`.
1525 pub fn subtitle(self, subtitle: impl Into<glib::GString>) -> Self {
1526 Self {
1527 builder: self.builder.property("subtitle", subtitle.into()),
1528 }
1529 }
1530
1531 /// The number of lines at the end of which the subtitle label will be
1532 /// ellipsized.
1533 ///
1534 /// If the value is 0, the number of lines won't be limited.
1535 pub fn subtitle_lines(self, subtitle_lines: i32) -> Self {
1536 Self {
1537 builder: self.builder.property("subtitle-lines", subtitle_lines),
1538 }
1539 }
1540
1541 /// Whether the user can copy the subtitle from the label.
1542 ///
1543 /// See also [`selectable`][struct@crate::Gtk::Label#selectable].
1544 #[cfg(feature = "v1_3")]
1545 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
1546 pub fn subtitle_selectable(self, subtitle_selectable: bool) -> Self {
1547 Self {
1548 builder: self
1549 .builder
1550 .property("subtitle-selectable", subtitle_selectable),
1551 }
1552 }
1553
1554 /// The number of lines at the end of which the title label will be ellipsized.
1555 ///
1556 /// If the value is 0, the number of lines won't be limited.
1557 pub fn title_lines(self, title_lines: i32) -> Self {
1558 Self {
1559 builder: self.builder.property("title-lines", title_lines),
1560 }
1561 }
1562
1563 /// The title of the preference represented by this row.
1564 ///
1565 /// The title is interpreted as Pango markup unless
1566 /// [`use-markup`][struct@crate::PreferencesRow#use-markup] is set to `FALSE`.
1567 pub fn title(self, title: impl Into<glib::GString>) -> Self {
1568 Self {
1569 builder: self.builder.property("title", title.into()),
1570 }
1571 }
1572
1573 /// Whether the user can copy the title from the label.
1574 ///
1575 /// See also [`selectable`][struct@crate::Gtk::Label#selectable].
1576 #[cfg(feature = "v1_1")]
1577 #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))]
1578 pub fn title_selectable(self, title_selectable: bool) -> Self {
1579 Self {
1580 builder: self.builder.property("title-selectable", title_selectable),
1581 }
1582 }
1583
1584 /// Whether to use Pango markup for the title label.
1585 ///
1586 /// Subclasses may also use it for other labels, such as subtitle.
1587 ///
1588 /// See also `parse_markup()`.
1589 #[cfg(feature = "v1_2")]
1590 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1591 pub fn use_markup(self, use_markup: bool) -> Self {
1592 Self {
1593 builder: self.builder.property("use-markup", use_markup),
1594 }
1595 }
1596
1597 /// Whether an embedded underline in the title indicates a mnemonic.
1598 pub fn use_underline(self, use_underline: bool) -> Self {
1599 Self {
1600 builder: self.builder.property("use-underline", use_underline),
1601 }
1602 }
1603
1604 /// Determines whether the ::row-activated
1605 /// signal will be emitted for this row.
1606 pub fn activatable(self, activatable: bool) -> Self {
1607 Self {
1608 builder: self.builder.property("activatable", activatable),
1609 }
1610 }
1611
1612 /// The child widget.
1613 pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
1614 Self {
1615 builder: self.builder.property("child", child.clone().upcast()),
1616 }
1617 }
1618
1619 /// Determines whether this row can be selected.
1620 pub fn selectable(self, selectable: bool) -> Self {
1621 Self {
1622 builder: self.builder.property("selectable", selectable),
1623 }
1624 }
1625
1626 /// Whether the widget or any of its descendents can accept
1627 /// the input focus.
1628 ///
1629 /// This property is meant to be set by widget implementations,
1630 /// typically in their instance init function.
1631 pub fn can_focus(self, can_focus: bool) -> Self {
1632 Self {
1633 builder: self.builder.property("can-focus", can_focus),
1634 }
1635 }
1636
1637 /// Whether the widget can receive pointer events.
1638 pub fn can_target(self, can_target: bool) -> Self {
1639 Self {
1640 builder: self.builder.property("can-target", can_target),
1641 }
1642 }
1643
1644 /// A list of css classes applied to this widget.
1645 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1646 Self {
1647 builder: self.builder.property("css-classes", css_classes.into()),
1648 }
1649 }
1650
1651 /// The name of this widget in the CSS tree.
1652 ///
1653 /// This property is meant to be set by widget implementations,
1654 /// typically in their instance init function.
1655 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1656 Self {
1657 builder: self.builder.property("css-name", css_name.into()),
1658 }
1659 }
1660
1661 /// The cursor used by @widget.
1662 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1663 Self {
1664 builder: self.builder.property("cursor", cursor.clone()),
1665 }
1666 }
1667
1668 /// Whether the widget should grab focus when it is clicked with the mouse.
1669 ///
1670 /// This property is only relevant for widgets that can take focus.
1671 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1672 Self {
1673 builder: self.builder.property("focus-on-click", focus_on_click),
1674 }
1675 }
1676
1677 /// Whether this widget itself will accept the input focus.
1678 pub fn focusable(self, focusable: bool) -> Self {
1679 Self {
1680 builder: self.builder.property("focusable", focusable),
1681 }
1682 }
1683
1684 /// How to distribute horizontal space if widget gets extra space.
1685 pub fn halign(self, halign: gtk::Align) -> Self {
1686 Self {
1687 builder: self.builder.property("halign", halign),
1688 }
1689 }
1690
1691 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
1692 /// signal on @widget.
1693 ///
1694 /// A true value indicates that @widget can have a tooltip, in this case
1695 /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
1696 /// determine whether it will provide a tooltip or not.
1697 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1698 Self {
1699 builder: self.builder.property("has-tooltip", has_tooltip),
1700 }
1701 }
1702
1703 /// Overrides for height request of the widget.
1704 ///
1705 /// If this is -1, the natural request will be used.
1706 pub fn height_request(self, height_request: i32) -> Self {
1707 Self {
1708 builder: self.builder.property("height-request", height_request),
1709 }
1710 }
1711
1712 /// Whether to expand horizontally.
1713 pub fn hexpand(self, hexpand: bool) -> Self {
1714 Self {
1715 builder: self.builder.property("hexpand", hexpand),
1716 }
1717 }
1718
1719 /// Whether to use the `hexpand` property.
1720 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1721 Self {
1722 builder: self.builder.property("hexpand-set", hexpand_set),
1723 }
1724 }
1725
1726 /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
1727 /// the preferred size of the widget, and allocate its children.
1728 ///
1729 /// This property is meant to be set by widget implementations,
1730 /// typically in their instance init function.
1731 pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
1732 Self {
1733 builder: self
1734 .builder
1735 .property("layout-manager", layout_manager.clone().upcast()),
1736 }
1737 }
1738
1739 /// Makes this widget act like a modal dialog, with respect to
1740 /// event delivery.
1741 ///
1742 /// Global event controllers will not handle events with targets
1743 /// inside the widget, unless they are set up to ignore propagation
1744 /// limits. See `Gtk::EventController::set_propagation_limit()`.
1745 #[cfg(feature = "gtk_v4_18")]
1746 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
1747 pub fn limit_events(self, limit_events: bool) -> Self {
1748 Self {
1749 builder: self.builder.property("limit-events", limit_events),
1750 }
1751 }
1752
1753 /// Margin on bottom side of widget.
1754 ///
1755 /// This property adds margin outside of the widget's normal size
1756 /// request, the margin will be added in addition to the size from
1757 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1758 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1759 Self {
1760 builder: self.builder.property("margin-bottom", margin_bottom),
1761 }
1762 }
1763
1764 /// Margin on end of widget, horizontally.
1765 ///
1766 /// This property supports left-to-right and right-to-left text
1767 /// directions.
1768 ///
1769 /// This property adds margin outside of the widget's normal size
1770 /// request, the margin will be added in addition to the size from
1771 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1772 pub fn margin_end(self, margin_end: i32) -> Self {
1773 Self {
1774 builder: self.builder.property("margin-end", margin_end),
1775 }
1776 }
1777
1778 /// Margin on start of widget, horizontally.
1779 ///
1780 /// This property supports left-to-right and right-to-left text
1781 /// directions.
1782 ///
1783 /// This property adds margin outside of the widget's normal size
1784 /// request, the margin will be added in addition to the size from
1785 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1786 pub fn margin_start(self, margin_start: i32) -> Self {
1787 Self {
1788 builder: self.builder.property("margin-start", margin_start),
1789 }
1790 }
1791
1792 /// Margin on top side of widget.
1793 ///
1794 /// This property adds margin outside of the widget's normal size
1795 /// request, the margin will be added in addition to the size from
1796 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1797 pub fn margin_top(self, margin_top: i32) -> Self {
1798 Self {
1799 builder: self.builder.property("margin-top", margin_top),
1800 }
1801 }
1802
1803 /// The name of the widget.
1804 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1805 Self {
1806 builder: self.builder.property("name", name.into()),
1807 }
1808 }
1809
1810 /// The requested opacity of the widget.
1811 pub fn opacity(self, opacity: f64) -> Self {
1812 Self {
1813 builder: self.builder.property("opacity", opacity),
1814 }
1815 }
1816
1817 /// How content outside the widget's content area is treated.
1818 ///
1819 /// This property is meant to be set by widget implementations,
1820 /// typically in their instance init function.
1821 pub fn overflow(self, overflow: gtk::Overflow) -> Self {
1822 Self {
1823 builder: self.builder.property("overflow", overflow),
1824 }
1825 }
1826
1827 /// Whether the widget will receive the default action when it is focused.
1828 pub fn receives_default(self, receives_default: bool) -> Self {
1829 Self {
1830 builder: self.builder.property("receives-default", receives_default),
1831 }
1832 }
1833
1834 /// Whether the widget responds to input.
1835 pub fn sensitive(self, sensitive: bool) -> Self {
1836 Self {
1837 builder: self.builder.property("sensitive", sensitive),
1838 }
1839 }
1840
1841 /// Sets the text of tooltip to be the given string, which is marked up
1842 /// with Pango markup.
1843 ///
1844 /// Also see `Gtk::Tooltip::set_markup()`.
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_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1855 Self {
1856 builder: self
1857 .builder
1858 .property("tooltip-markup", tooltip_markup.into()),
1859 }
1860 }
1861
1862 /// Sets the text of tooltip to be the given string.
1863 ///
1864 /// Also see `Gtk::Tooltip::set_text()`.
1865 ///
1866 /// This is a convenience property which will take care of getting the
1867 /// tooltip shown if the given string is not `NULL`:
1868 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
1869 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
1870 /// the default signal handler.
1871 ///
1872 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
1873 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
1874 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1875 Self {
1876 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1877 }
1878 }
1879
1880 /// How to distribute vertical space if widget gets extra space.
1881 pub fn valign(self, valign: gtk::Align) -> Self {
1882 Self {
1883 builder: self.builder.property("valign", valign),
1884 }
1885 }
1886
1887 /// Whether to expand vertically.
1888 pub fn vexpand(self, vexpand: bool) -> Self {
1889 Self {
1890 builder: self.builder.property("vexpand", vexpand),
1891 }
1892 }
1893
1894 /// Whether to use the `vexpand` property.
1895 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1896 Self {
1897 builder: self.builder.property("vexpand-set", vexpand_set),
1898 }
1899 }
1900
1901 /// Whether the widget is visible.
1902 pub fn visible(self, visible: bool) -> Self {
1903 Self {
1904 builder: self.builder.property("visible", visible),
1905 }
1906 }
1907
1908 /// Overrides for width request of the widget.
1909 ///
1910 /// If this is -1, the natural request will be used.
1911 pub fn width_request(self, width_request: i32) -> Self {
1912 Self {
1913 builder: self.builder.property("width-request", width_request),
1914 }
1915 }
1916
1917 /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
1918 ///
1919 /// The accessible role cannot be changed once set.
1920 pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
1921 Self {
1922 builder: self.builder.property("accessible-role", accessible_role),
1923 }
1924 }
1925
1926 /// The name of the action with which this widget should be associated.
1927 pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
1928 Self {
1929 builder: self.builder.property("action-name", action_name.into()),
1930 }
1931 }
1932
1933 /// The target value of the actionable widget's action.
1934 pub fn action_target(self, action_target: &glib::Variant) -> Self {
1935 Self {
1936 builder: self
1937 .builder
1938 .property("action-target", action_target.clone()),
1939 }
1940 }
1941
1942 /// Whether the entry contents can be edited.
1943 pub fn editable(self, editable: bool) -> Self {
1944 Self {
1945 builder: self.builder.property("editable", editable),
1946 }
1947 }
1948
1949 /// If undo/redo should be enabled for the editable.
1950 pub fn enable_undo(self, enable_undo: bool) -> Self {
1951 Self {
1952 builder: self.builder.property("enable-undo", enable_undo),
1953 }
1954 }
1955
1956 /// The desired maximum width of the entry, in characters.
1957 pub fn max_width_chars(self, max_width_chars: i32) -> Self {
1958 Self {
1959 builder: self.builder.property("max-width-chars", max_width_chars),
1960 }
1961 }
1962
1963 /// The contents of the entry.
1964 pub fn text(self, text: impl Into<glib::GString>) -> Self {
1965 Self {
1966 builder: self.builder.property("text", text.into()),
1967 }
1968 }
1969
1970 /// Number of characters to leave space for in the entry.
1971 pub fn width_chars(self, width_chars: i32) -> Self {
1972 Self {
1973 builder: self.builder.property("width-chars", width_chars),
1974 }
1975 }
1976
1977 /// The horizontal alignment, from 0 (left) to 1 (right).
1978 ///
1979 /// Reversed for RTL layouts.
1980 pub fn xalign(self, xalign: f32) -> Self {
1981 Self {
1982 builder: self.builder.property("xalign", xalign),
1983 }
1984 }
1985
1986 // rustdoc-stripper-ignore-next
1987 /// Build the [`SpinRow`].
1988 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1989 pub fn build(self) -> SpinRow {
1990 assert_initialized_main_thread!();
1991 self.builder.build()
1992 }
1993}