Skip to main content

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