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