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