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 Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, LayoutManager, Overflow,
7 Widget, ffi,
8};
9use glib::{
10 prelude::*,
11 signal::{SignalHandlerId, connect_raw},
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 unsafe {
425 let f: &F = &*(f as *const F);
426 f(&from_glib_borrow(this))
427 }
428 }
429 unsafe {
430 let f: Box_<F> = Box_::new(f);
431 connect_raw(
432 self.as_ptr() as *mut _,
433 c"notify::spinning".as_ptr() as *const _,
434 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
435 notify_spinning_trampoline::<F> as *const (),
436 )),
437 Box_::into_raw(f),
438 )
439 }
440 }
441}
442
443impl Default for Spinner {
444 fn default() -> Self {
445 Self::new()
446 }
447}
448
449// rustdoc-stripper-ignore-next
450/// A [builder-pattern] type to construct [`Spinner`] objects.
451///
452/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
453#[must_use = "The builder must be built to be used"]
454pub struct SpinnerBuilder {
455 builder: glib::object::ObjectBuilder<'static, Spinner>,
456}
457
458impl SpinnerBuilder {
459 fn new() -> Self {
460 Self {
461 builder: glib::object::Object::builder(),
462 }
463 }
464
465 /// Whether the spinner is spinning
466 pub fn spinning(self, spinning: bool) -> Self {
467 Self {
468 builder: self.builder.property("spinning", spinning),
469 }
470 }
471
472 /// Whether the widget or any of its descendents can accept
473 /// the input focus.
474 ///
475 /// This property is meant to be set by widget implementations,
476 /// typically in their instance init function.
477 pub fn can_focus(self, can_focus: bool) -> Self {
478 Self {
479 builder: self.builder.property("can-focus", can_focus),
480 }
481 }
482
483 /// Whether the widget can receive pointer events.
484 pub fn can_target(self, can_target: bool) -> Self {
485 Self {
486 builder: self.builder.property("can-target", can_target),
487 }
488 }
489
490 /// A list of css classes applied to this widget.
491 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
492 Self {
493 builder: self.builder.property("css-classes", css_classes.into()),
494 }
495 }
496
497 /// The name of this widget in the CSS tree.
498 ///
499 /// This property is meant to be set by widget implementations,
500 /// typically in their instance init function.
501 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
502 Self {
503 builder: self.builder.property("css-name", css_name.into()),
504 }
505 }
506
507 /// The cursor used by @widget.
508 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
509 Self {
510 builder: self.builder.property("cursor", cursor.clone()),
511 }
512 }
513
514 /// Whether the widget should grab focus when it is clicked with the mouse.
515 ///
516 /// This property is only relevant for widgets that can take focus.
517 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
518 Self {
519 builder: self.builder.property("focus-on-click", focus_on_click),
520 }
521 }
522
523 /// Whether this widget itself will accept the input focus.
524 pub fn focusable(self, focusable: bool) -> Self {
525 Self {
526 builder: self.builder.property("focusable", focusable),
527 }
528 }
529
530 /// How to distribute horizontal space if widget gets extra space.
531 pub fn halign(self, halign: Align) -> Self {
532 Self {
533 builder: self.builder.property("halign", halign),
534 }
535 }
536
537 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
538 /// signal on @widget.
539 ///
540 /// A true value indicates that @widget can have a tooltip, in this case
541 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
542 /// determine whether it will provide a tooltip or not.
543 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
544 Self {
545 builder: self.builder.property("has-tooltip", has_tooltip),
546 }
547 }
548
549 /// Overrides for height request of the widget.
550 ///
551 /// If this is -1, the natural request will be used.
552 pub fn height_request(self, height_request: i32) -> Self {
553 Self {
554 builder: self.builder.property("height-request", height_request),
555 }
556 }
557
558 /// Whether to expand horizontally.
559 pub fn hexpand(self, hexpand: bool) -> Self {
560 Self {
561 builder: self.builder.property("hexpand", hexpand),
562 }
563 }
564
565 /// Whether to use the `hexpand` property.
566 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
567 Self {
568 builder: self.builder.property("hexpand-set", hexpand_set),
569 }
570 }
571
572 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
573 /// the preferred size of the widget, and allocate its children.
574 ///
575 /// This property is meant to be set by widget implementations,
576 /// typically in their instance init function.
577 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
578 Self {
579 builder: self
580 .builder
581 .property("layout-manager", layout_manager.clone().upcast()),
582 }
583 }
584
585 /// Makes this widget act like a modal dialog, with respect to
586 /// event delivery.
587 ///
588 /// Global event controllers will not handle events with targets
589 /// inside the widget, unless they are set up to ignore propagation
590 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
591 #[cfg(feature = "v4_18")]
592 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
593 pub fn limit_events(self, limit_events: bool) -> Self {
594 Self {
595 builder: self.builder.property("limit-events", limit_events),
596 }
597 }
598
599 /// Margin on bottom side of widget.
600 ///
601 /// This property adds margin outside of the widget's normal size
602 /// request, the margin will be added in addition to the size from
603 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
604 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
605 Self {
606 builder: self.builder.property("margin-bottom", margin_bottom),
607 }
608 }
609
610 /// Margin on end of widget, horizontally.
611 ///
612 /// This property supports left-to-right and right-to-left text
613 /// directions.
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_end(self, margin_end: i32) -> Self {
619 Self {
620 builder: self.builder.property("margin-end", margin_end),
621 }
622 }
623
624 /// Margin on start 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_start(self, margin_start: i32) -> Self {
633 Self {
634 builder: self.builder.property("margin-start", margin_start),
635 }
636 }
637
638 /// Margin on top side of widget.
639 ///
640 /// This property adds margin outside of the widget's normal size
641 /// request, the margin will be added in addition to the size from
642 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
643 pub fn margin_top(self, margin_top: i32) -> Self {
644 Self {
645 builder: self.builder.property("margin-top", margin_top),
646 }
647 }
648
649 /// The name of the widget.
650 pub fn name(self, name: impl Into<glib::GString>) -> Self {
651 Self {
652 builder: self.builder.property("name", name.into()),
653 }
654 }
655
656 /// The requested opacity of the widget.
657 pub fn opacity(self, opacity: f64) -> Self {
658 Self {
659 builder: self.builder.property("opacity", opacity),
660 }
661 }
662
663 /// How content outside the widget's content area is treated.
664 ///
665 /// This property is meant to be set by widget implementations,
666 /// typically in their instance init function.
667 pub fn overflow(self, overflow: Overflow) -> Self {
668 Self {
669 builder: self.builder.property("overflow", overflow),
670 }
671 }
672
673 /// Whether the widget will receive the default action when it is focused.
674 pub fn receives_default(self, receives_default: bool) -> Self {
675 Self {
676 builder: self.builder.property("receives-default", receives_default),
677 }
678 }
679
680 /// Whether the widget responds to input.
681 pub fn sensitive(self, sensitive: bool) -> Self {
682 Self {
683 builder: self.builder.property("sensitive", sensitive),
684 }
685 }
686
687 /// Sets the text of tooltip to be the given string, which is marked up
688 /// with Pango markup.
689 ///
690 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
691 ///
692 /// This is a convenience property which will take care of getting the
693 /// tooltip shown if the given string is not `NULL`:
694 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
695 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
696 /// the default signal handler.
697 ///
698 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
699 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
700 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
701 Self {
702 builder: self
703 .builder
704 .property("tooltip-markup", tooltip_markup.into()),
705 }
706 }
707
708 /// Sets the text of tooltip to be the given string.
709 ///
710 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
711 ///
712 /// This is a convenience property which will take care of getting the
713 /// tooltip shown if the given string is not `NULL`:
714 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
715 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
716 /// the default signal handler.
717 ///
718 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
719 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
720 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
721 Self {
722 builder: self.builder.property("tooltip-text", tooltip_text.into()),
723 }
724 }
725
726 /// How to distribute vertical space if widget gets extra space.
727 pub fn valign(self, valign: Align) -> Self {
728 Self {
729 builder: self.builder.property("valign", valign),
730 }
731 }
732
733 /// Whether to expand vertically.
734 pub fn vexpand(self, vexpand: bool) -> Self {
735 Self {
736 builder: self.builder.property("vexpand", vexpand),
737 }
738 }
739
740 /// Whether to use the `vexpand` property.
741 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
742 Self {
743 builder: self.builder.property("vexpand-set", vexpand_set),
744 }
745 }
746
747 /// Whether the widget is visible.
748 pub fn visible(self, visible: bool) -> Self {
749 Self {
750 builder: self.builder.property("visible", visible),
751 }
752 }
753
754 /// Overrides for width request of the widget.
755 ///
756 /// If this is -1, the natural request will be used.
757 pub fn width_request(self, width_request: i32) -> Self {
758 Self {
759 builder: self.builder.property("width-request", width_request),
760 }
761 }
762
763 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
764 ///
765 /// The accessible role cannot be changed once set.
766 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
767 Self {
768 builder: self.builder.property("accessible-role", accessible_role),
769 }
770 }
771
772 // rustdoc-stripper-ignore-next
773 /// Build the [`Spinner`].
774 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
775 pub fn build(self) -> Spinner {
776 assert_initialized_main_thread!();
777 self.builder.build()
778 }
779}