gtk4/auto/
spinner.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{
6    ffi, Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, LayoutManager, Overflow,
7    Widget,
8};
9use glib::{
10    prelude::*,
11    signal::{connect_raw, SignalHandlerId},
12    translate::*,
13};
14use std::boxed::Box as Box_;
15
16glib::wrapper! {
17    /// Displays an icon-size spinning animation.
18    ///
19    /// It is often used as an alternative to a [`ProgressBar`][crate::ProgressBar]
20    /// for displaying indefinite activity, instead of actual progress.
21    ///
22    /// <picture>
23    ///   <source srcset="spinner-dark.png" media="(prefers-color-scheme: dark)">
24    ///   <img alt="An example GtkSpinner" src="spinner.png">
25    /// </picture>
26    ///
27    /// To start the animation, use [`start()`][Self::start()], to stop it
28    /// use [`stop()`][Self::stop()].
29    ///
30    /// # CSS nodes
31    ///
32    /// [`Spinner`][crate::Spinner] has a single CSS node with the name spinner.
33    /// When the animation is active, the :checked pseudoclass is
34    /// added to this node.
35    ///
36    /// # Accessibility
37    ///
38    /// [`Spinner`][crate::Spinner] uses the [enum@Gtk.AccessibleRole.progress_bar] role.
39    ///
40    /// ## Properties
41    ///
42    ///
43    /// #### `spinning`
44    ///  Whether the spinner is spinning
45    ///
46    /// Readable | Writeable
47    /// <details><summary><h4>Widget</h4></summary>
48    ///
49    ///
50    /// #### `can-focus`
51    ///  Whether the widget or any of its descendents can accept
52    /// the input focus.
53    ///
54    /// This property is meant to be set by widget implementations,
55    /// typically in their instance init function.
56    ///
57    /// Readable | Writeable
58    ///
59    ///
60    /// #### `can-target`
61    ///  Whether the widget can receive pointer events.
62    ///
63    /// Readable | Writeable
64    ///
65    ///
66    /// #### `css-classes`
67    ///  A list of css classes applied to this widget.
68    ///
69    /// Readable | Writeable
70    ///
71    ///
72    /// #### `css-name`
73    ///  The name of this widget in the CSS tree.
74    ///
75    /// This property is meant to be set by widget implementations,
76    /// typically in their instance init function.
77    ///
78    /// Readable | Writeable | Construct Only
79    ///
80    ///
81    /// #### `cursor`
82    ///  The cursor used by @widget.
83    ///
84    /// Readable | Writeable
85    ///
86    ///
87    /// #### `focus-on-click`
88    ///  Whether the widget should grab focus when it is clicked with the mouse.
89    ///
90    /// This property is only relevant for widgets that can take focus.
91    ///
92    /// Readable | Writeable
93    ///
94    ///
95    /// #### `focusable`
96    ///  Whether this widget itself will accept the input focus.
97    ///
98    /// Readable | Writeable
99    ///
100    ///
101    /// #### `halign`
102    ///  How to distribute horizontal space if widget gets extra space.
103    ///
104    /// Readable | Writeable
105    ///
106    ///
107    /// #### `has-default`
108    ///  Whether the widget is the default widget.
109    ///
110    /// Readable
111    ///
112    ///
113    /// #### `has-focus`
114    ///  Whether the widget has the input focus.
115    ///
116    /// Readable
117    ///
118    ///
119    /// #### `has-tooltip`
120    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
121    /// signal on @widget.
122    ///
123    /// A true value indicates that @widget can have a tooltip, in this case
124    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
125    /// determine whether it will provide a tooltip or not.
126    ///
127    /// Readable | Writeable
128    ///
129    ///
130    /// #### `height-request`
131    ///  Overrides for height request of the widget.
132    ///
133    /// If this is -1, the natural request will be used.
134    ///
135    /// Readable | Writeable
136    ///
137    ///
138    /// #### `hexpand`
139    ///  Whether to expand horizontally.
140    ///
141    /// Readable | Writeable
142    ///
143    ///
144    /// #### `hexpand-set`
145    ///  Whether to use the `hexpand` property.
146    ///
147    /// Readable | Writeable
148    ///
149    ///
150    /// #### `layout-manager`
151    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
152    /// the preferred size of the widget, and allocate its children.
153    ///
154    /// This property is meant to be set by widget implementations,
155    /// typically in their instance init function.
156    ///
157    /// Readable | Writeable
158    ///
159    ///
160    /// #### `limit-events`
161    ///  Makes this widget act like a modal dialog, with respect to
162    /// event delivery.
163    ///
164    /// Global event controllers will not handle events with targets
165    /// inside the widget, unless they are set up to ignore propagation
166    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
167    ///
168    /// Readable | Writeable
169    ///
170    ///
171    /// #### `margin-bottom`
172    ///  Margin on bottom side of widget.
173    ///
174    /// This property adds margin outside of the widget's normal size
175    /// request, the margin will be added in addition to the size from
176    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
177    ///
178    /// Readable | Writeable
179    ///
180    ///
181    /// #### `margin-end`
182    ///  Margin on end of widget, horizontally.
183    ///
184    /// This property supports left-to-right and right-to-left text
185    /// directions.
186    ///
187    /// This property adds margin outside of the widget's normal size
188    /// request, the margin will be added in addition to the size from
189    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
190    ///
191    /// Readable | Writeable
192    ///
193    ///
194    /// #### `margin-start`
195    ///  Margin on start of widget, horizontally.
196    ///
197    /// This property supports left-to-right and right-to-left text
198    /// directions.
199    ///
200    /// This property adds margin outside of the widget's normal size
201    /// request, the margin will be added in addition to the size from
202    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
203    ///
204    /// Readable | Writeable
205    ///
206    ///
207    /// #### `margin-top`
208    ///  Margin on top side of widget.
209    ///
210    /// This property adds margin outside of the widget's normal size
211    /// request, the margin will be added in addition to the size from
212    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
213    ///
214    /// Readable | Writeable
215    ///
216    ///
217    /// #### `name`
218    ///  The name of the widget.
219    ///
220    /// Readable | Writeable
221    ///
222    ///
223    /// #### `opacity`
224    ///  The requested opacity of the widget.
225    ///
226    /// Readable | Writeable
227    ///
228    ///
229    /// #### `overflow`
230    ///  How content outside the widget's content area is treated.
231    ///
232    /// This property is meant to be set by widget implementations,
233    /// typically in their instance init function.
234    ///
235    /// Readable | Writeable
236    ///
237    ///
238    /// #### `parent`
239    ///  The parent widget of this widget.
240    ///
241    /// Readable
242    ///
243    ///
244    /// #### `receives-default`
245    ///  Whether the widget will receive the default action when it is focused.
246    ///
247    /// Readable | Writeable
248    ///
249    ///
250    /// #### `root`
251    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
252    ///
253    /// This will be `NULL` if the widget is not contained in a root widget.
254    ///
255    /// Readable
256    ///
257    ///
258    /// #### `scale-factor`
259    ///  The scale factor of the widget.
260    ///
261    /// Readable
262    ///
263    ///
264    /// #### `sensitive`
265    ///  Whether the widget responds to input.
266    ///
267    /// Readable | Writeable
268    ///
269    ///
270    /// #### `tooltip-markup`
271    ///  Sets the text of tooltip to be the given string, which is marked up
272    /// with Pango markup.
273    ///
274    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
275    ///
276    /// This is a convenience property which will take care of getting the
277    /// tooltip shown if the given string is not `NULL`:
278    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
279    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
280    /// the default signal handler.
281    ///
282    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
283    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
284    ///
285    /// Readable | Writeable
286    ///
287    ///
288    /// #### `tooltip-text`
289    ///  Sets the text of tooltip to be the given string.
290    ///
291    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
292    ///
293    /// This is a convenience property which will take care of getting the
294    /// tooltip shown if the given string is not `NULL`:
295    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
296    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
297    /// the default signal handler.
298    ///
299    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
300    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
301    ///
302    /// Readable | Writeable
303    ///
304    ///
305    /// #### `valign`
306    ///  How to distribute vertical space if widget gets extra space.
307    ///
308    /// Readable | Writeable
309    ///
310    ///
311    /// #### `vexpand`
312    ///  Whether to expand vertically.
313    ///
314    /// Readable | Writeable
315    ///
316    ///
317    /// #### `vexpand-set`
318    ///  Whether to use the `vexpand` property.
319    ///
320    /// Readable | Writeable
321    ///
322    ///
323    /// #### `visible`
324    ///  Whether the widget is visible.
325    ///
326    /// Readable | Writeable
327    ///
328    ///
329    /// #### `width-request`
330    ///  Overrides for width request of the widget.
331    ///
332    /// If this is -1, the natural request will be used.
333    ///
334    /// Readable | Writeable
335    /// </details>
336    /// <details><summary><h4>Accessible</h4></summary>
337    ///
338    ///
339    /// #### `accessible-role`
340    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
341    ///
342    /// The accessible role cannot be changed once set.
343    ///
344    /// Readable | Writeable
345    /// </details>
346    ///
347    /// # Implements
348    ///
349    /// [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
350    #[doc(alias = "GtkSpinner")]
351    pub struct Spinner(Object<ffi::GtkSpinner>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget;
352
353    match fn {
354        type_ => || ffi::gtk_spinner_get_type(),
355    }
356}
357
358impl Spinner {
359    /// Returns a new spinner widget. Not yet started.
360    ///
361    /// # Returns
362    ///
363    /// a new [`Spinner`][crate::Spinner]
364    #[doc(alias = "gtk_spinner_new")]
365    pub fn new() -> Spinner {
366        assert_initialized_main_thread!();
367        unsafe { Widget::from_glib_none(ffi::gtk_spinner_new()).unsafe_cast() }
368    }
369
370    // rustdoc-stripper-ignore-next
371    /// Creates a new builder-pattern struct instance to construct [`Spinner`] objects.
372    ///
373    /// This method returns an instance of [`SpinnerBuilder`](crate::builders::SpinnerBuilder) which can be used to create [`Spinner`] objects.
374    pub fn builder() -> SpinnerBuilder {
375        SpinnerBuilder::new()
376    }
377
378    /// Returns whether the spinner is spinning.
379    ///
380    /// # Returns
381    ///
382    /// [`true`] if the spinner is active
383    #[doc(alias = "gtk_spinner_get_spinning")]
384    #[doc(alias = "get_spinning")]
385    #[doc(alias = "spinning")]
386    pub fn is_spinning(&self) -> bool {
387        unsafe { from_glib(ffi::gtk_spinner_get_spinning(self.to_glib_none().0)) }
388    }
389
390    /// Sets the activity of the spinner.
391    /// ## `spinning`
392    /// whether the spinner should be spinning
393    #[doc(alias = "gtk_spinner_set_spinning")]
394    #[doc(alias = "spinning")]
395    pub fn set_spinning(&self, spinning: bool) {
396        unsafe {
397            ffi::gtk_spinner_set_spinning(self.to_glib_none().0, spinning.into_glib());
398        }
399    }
400
401    /// Starts the animation of the spinner.
402    #[doc(alias = "gtk_spinner_start")]
403    pub fn start(&self) {
404        unsafe {
405            ffi::gtk_spinner_start(self.to_glib_none().0);
406        }
407    }
408
409    /// Stops the animation of the spinner.
410    #[doc(alias = "gtk_spinner_stop")]
411    pub fn stop(&self) {
412        unsafe {
413            ffi::gtk_spinner_stop(self.to_glib_none().0);
414        }
415    }
416
417    #[doc(alias = "spinning")]
418    pub fn connect_spinning_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
419        unsafe extern "C" fn notify_spinning_trampoline<F: Fn(&Spinner) + 'static>(
420            this: *mut ffi::GtkSpinner,
421            _param_spec: glib::ffi::gpointer,
422            f: glib::ffi::gpointer,
423        ) {
424            let f: &F = &*(f as *const F);
425            f(&from_glib_borrow(this))
426        }
427        unsafe {
428            let f: Box_<F> = Box_::new(f);
429            connect_raw(
430                self.as_ptr() as *mut _,
431                c"notify::spinning".as_ptr() as *const _,
432                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
433                    notify_spinning_trampoline::<F> as *const (),
434                )),
435                Box_::into_raw(f),
436            )
437        }
438    }
439}
440
441impl Default for Spinner {
442    fn default() -> Self {
443        Self::new()
444    }
445}
446
447// rustdoc-stripper-ignore-next
448/// A [builder-pattern] type to construct [`Spinner`] objects.
449///
450/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
451#[must_use = "The builder must be built to be used"]
452pub struct SpinnerBuilder {
453    builder: glib::object::ObjectBuilder<'static, Spinner>,
454}
455
456impl SpinnerBuilder {
457    fn new() -> Self {
458        Self {
459            builder: glib::object::Object::builder(),
460        }
461    }
462
463    /// Whether the spinner is spinning
464    pub fn spinning(self, spinning: bool) -> Self {
465        Self {
466            builder: self.builder.property("spinning", spinning),
467        }
468    }
469
470    /// Whether the widget or any of its descendents can accept
471    /// the input focus.
472    ///
473    /// This property is meant to be set by widget implementations,
474    /// typically in their instance init function.
475    pub fn can_focus(self, can_focus: bool) -> Self {
476        Self {
477            builder: self.builder.property("can-focus", can_focus),
478        }
479    }
480
481    /// Whether the widget can receive pointer events.
482    pub fn can_target(self, can_target: bool) -> Self {
483        Self {
484            builder: self.builder.property("can-target", can_target),
485        }
486    }
487
488    /// A list of css classes applied to this widget.
489    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
490        Self {
491            builder: self.builder.property("css-classes", css_classes.into()),
492        }
493    }
494
495    /// The name of this widget in the CSS tree.
496    ///
497    /// This property is meant to be set by widget implementations,
498    /// typically in their instance init function.
499    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
500        Self {
501            builder: self.builder.property("css-name", css_name.into()),
502        }
503    }
504
505    /// The cursor used by @widget.
506    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
507        Self {
508            builder: self.builder.property("cursor", cursor.clone()),
509        }
510    }
511
512    /// Whether the widget should grab focus when it is clicked with the mouse.
513    ///
514    /// This property is only relevant for widgets that can take focus.
515    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
516        Self {
517            builder: self.builder.property("focus-on-click", focus_on_click),
518        }
519    }
520
521    /// Whether this widget itself will accept the input focus.
522    pub fn focusable(self, focusable: bool) -> Self {
523        Self {
524            builder: self.builder.property("focusable", focusable),
525        }
526    }
527
528    /// How to distribute horizontal space if widget gets extra space.
529    pub fn halign(self, halign: Align) -> Self {
530        Self {
531            builder: self.builder.property("halign", halign),
532        }
533    }
534
535    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
536    /// signal on @widget.
537    ///
538    /// A true value indicates that @widget can have a tooltip, in this case
539    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
540    /// determine whether it will provide a tooltip or not.
541    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
542        Self {
543            builder: self.builder.property("has-tooltip", has_tooltip),
544        }
545    }
546
547    /// Overrides for height request of the widget.
548    ///
549    /// If this is -1, the natural request will be used.
550    pub fn height_request(self, height_request: i32) -> Self {
551        Self {
552            builder: self.builder.property("height-request", height_request),
553        }
554    }
555
556    /// Whether to expand horizontally.
557    pub fn hexpand(self, hexpand: bool) -> Self {
558        Self {
559            builder: self.builder.property("hexpand", hexpand),
560        }
561    }
562
563    /// Whether to use the `hexpand` property.
564    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
565        Self {
566            builder: self.builder.property("hexpand-set", hexpand_set),
567        }
568    }
569
570    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
571    /// the preferred size of the widget, and allocate its children.
572    ///
573    /// This property is meant to be set by widget implementations,
574    /// typically in their instance init function.
575    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
576        Self {
577            builder: self
578                .builder
579                .property("layout-manager", layout_manager.clone().upcast()),
580        }
581    }
582
583    /// Makes this widget act like a modal dialog, with respect to
584    /// event delivery.
585    ///
586    /// Global event controllers will not handle events with targets
587    /// inside the widget, unless they are set up to ignore propagation
588    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
589    #[cfg(feature = "v4_18")]
590    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
591    pub fn limit_events(self, limit_events: bool) -> Self {
592        Self {
593            builder: self.builder.property("limit-events", limit_events),
594        }
595    }
596
597    /// Margin on bottom side of widget.
598    ///
599    /// This property adds margin outside of the widget's normal size
600    /// request, the margin will be added in addition to the size from
601    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
602    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
603        Self {
604            builder: self.builder.property("margin-bottom", margin_bottom),
605        }
606    }
607
608    /// Margin on end of widget, horizontally.
609    ///
610    /// This property supports left-to-right and right-to-left text
611    /// directions.
612    ///
613    /// This property adds margin outside of the widget's normal size
614    /// request, the margin will be added in addition to the size from
615    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
616    pub fn margin_end(self, margin_end: i32) -> Self {
617        Self {
618            builder: self.builder.property("margin-end", margin_end),
619        }
620    }
621
622    /// Margin on start of widget, horizontally.
623    ///
624    /// This property supports left-to-right and right-to-left text
625    /// directions.
626    ///
627    /// This property adds margin outside of the widget's normal size
628    /// request, the margin will be added in addition to the size from
629    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
630    pub fn margin_start(self, margin_start: i32) -> Self {
631        Self {
632            builder: self.builder.property("margin-start", margin_start),
633        }
634    }
635
636    /// Margin on top side of widget.
637    ///
638    /// This property adds margin outside of the widget's normal size
639    /// request, the margin will be added in addition to the size from
640    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
641    pub fn margin_top(self, margin_top: i32) -> Self {
642        Self {
643            builder: self.builder.property("margin-top", margin_top),
644        }
645    }
646
647    /// The name of the widget.
648    pub fn name(self, name: impl Into<glib::GString>) -> Self {
649        Self {
650            builder: self.builder.property("name", name.into()),
651        }
652    }
653
654    /// The requested opacity of the widget.
655    pub fn opacity(self, opacity: f64) -> Self {
656        Self {
657            builder: self.builder.property("opacity", opacity),
658        }
659    }
660
661    /// How content outside the widget's content area is treated.
662    ///
663    /// This property is meant to be set by widget implementations,
664    /// typically in their instance init function.
665    pub fn overflow(self, overflow: Overflow) -> Self {
666        Self {
667            builder: self.builder.property("overflow", overflow),
668        }
669    }
670
671    /// Whether the widget will receive the default action when it is focused.
672    pub fn receives_default(self, receives_default: bool) -> Self {
673        Self {
674            builder: self.builder.property("receives-default", receives_default),
675        }
676    }
677
678    /// Whether the widget responds to input.
679    pub fn sensitive(self, sensitive: bool) -> Self {
680        Self {
681            builder: self.builder.property("sensitive", sensitive),
682        }
683    }
684
685    /// Sets the text of tooltip to be the given string, which is marked up
686    /// with Pango markup.
687    ///
688    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
689    ///
690    /// This is a convenience property which will take care of getting the
691    /// tooltip shown if the given string is not `NULL`:
692    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
693    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
694    /// the default signal handler.
695    ///
696    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
697    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
698    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
699        Self {
700            builder: self
701                .builder
702                .property("tooltip-markup", tooltip_markup.into()),
703        }
704    }
705
706    /// Sets the text of tooltip to be the given string.
707    ///
708    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
709    ///
710    /// This is a convenience property which will take care of getting the
711    /// tooltip shown if the given string is not `NULL`:
712    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
713    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
714    /// the default signal handler.
715    ///
716    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
717    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
718    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
719        Self {
720            builder: self.builder.property("tooltip-text", tooltip_text.into()),
721        }
722    }
723
724    /// How to distribute vertical space if widget gets extra space.
725    pub fn valign(self, valign: Align) -> Self {
726        Self {
727            builder: self.builder.property("valign", valign),
728        }
729    }
730
731    /// Whether to expand vertically.
732    pub fn vexpand(self, vexpand: bool) -> Self {
733        Self {
734            builder: self.builder.property("vexpand", vexpand),
735        }
736    }
737
738    /// Whether to use the `vexpand` property.
739    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
740        Self {
741            builder: self.builder.property("vexpand-set", vexpand_set),
742        }
743    }
744
745    /// Whether the widget is visible.
746    pub fn visible(self, visible: bool) -> Self {
747        Self {
748            builder: self.builder.property("visible", visible),
749        }
750    }
751
752    /// Overrides for width request of the widget.
753    ///
754    /// If this is -1, the natural request will be used.
755    pub fn width_request(self, width_request: i32) -> Self {
756        Self {
757            builder: self.builder.property("width-request", width_request),
758        }
759    }
760
761    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
762    ///
763    /// The accessible role cannot be changed once set.
764    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
765        Self {
766            builder: self.builder.property("accessible-role", accessible_role),
767        }
768    }
769
770    // rustdoc-stripper-ignore-next
771    /// Build the [`Spinner`].
772    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
773    pub fn build(self) -> Spinner {
774        assert_initialized_main_thread!();
775        self.builder.build()
776    }
777}