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 ///
22 ///
23 /// To start the animation, use [`start()`][Self::start()], to stop it
24 /// use [`stop()`][Self::stop()].
25 ///
26 /// # CSS nodes
27 ///
28 /// [`Spinner`][crate::Spinner] has a single CSS node with the name spinner.
29 /// When the animation is active, the :checked pseudoclass is
30 /// added to this node.
31 ///
32 /// # Accessibility
33 ///
34 /// [`Spinner`][crate::Spinner] uses the [enum@Gtk.AccessibleRole.progress_bar] role.
35 ///
36 /// ## Properties
37 ///
38 ///
39 /// #### `spinning`
40 /// Whether the spinner is spinning
41 ///
42 /// Readable | Writable
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 | Writable
54 ///
55 ///
56 /// #### `can-target`
57 /// Whether the widget can receive pointer events.
58 ///
59 /// Readable | Writable
60 ///
61 ///
62 /// #### `css-classes`
63 /// A list of css classes applied to this widget.
64 ///
65 /// Readable | Writable
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 | Writable | Construct Only
75 ///
76 ///
77 /// #### `cursor`
78 /// The cursor used by @widget.
79 ///
80 /// Readable | Writable
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 | Writable
89 ///
90 ///
91 /// #### `focusable`
92 /// Whether this widget itself will accept the input focus.
93 ///
94 /// Readable | Writable
95 ///
96 ///
97 /// #### `halign`
98 /// How to distribute horizontal space if widget gets extra space.
99 ///
100 /// Readable | Writable
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 | Writable
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 | Writable
132 ///
133 ///
134 /// #### `hexpand`
135 /// Whether to expand horizontally.
136 ///
137 /// Readable | Writable
138 ///
139 ///
140 /// #### `hexpand-set`
141 /// Whether to use the `hexpand` property.
142 ///
143 /// Readable | Writable
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 | Writable
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 | Writable
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 | Writable
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 | Writable
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 | Writable
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 | Writable
211 ///
212 ///
213 /// #### `name`
214 /// The name of the widget.
215 ///
216 /// Readable | Writable
217 ///
218 ///
219 /// #### `opacity`
220 /// The requested opacity of the widget.
221 ///
222 /// Readable | Writable
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 | Writable
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 | Writable
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 | Writable
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 | Writable
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 | Writable
299 ///
300 ///
301 /// #### `valign`
302 /// How to distribute vertical space if widget gets extra space.
303 ///
304 /// Readable | Writable
305 ///
306 ///
307 /// #### `vexpand`
308 /// Whether to expand vertically.
309 ///
310 /// Readable | Writable
311 ///
312 ///
313 /// #### `vexpand-set`
314 /// Whether to use the `vexpand` property.
315 ///
316 /// Readable | Writable
317 ///
318 ///
319 /// #### `visible`
320 /// Whether the widget is visible.
321 ///
322 /// Readable | Writable
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 | Writable
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 | Writable
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
354#[cfg(not(feature = "v4_10"))]
355glib::wrapper! {
356 #[doc(alias = "GtkSpinner")]
357 pub struct Spinner(Object<ffi::GtkSpinner>) @extends Widget, @implements Buildable, ConstraintTarget;
358
359 match fn {
360 type_ => || ffi::gtk_spinner_get_type(),
361 }
362}
363
364impl Spinner {
365 /// Returns a new spinner widget. Not yet started.
366 ///
367 /// # Returns
368 ///
369 /// a new [`Spinner`][crate::Spinner]
370 #[doc(alias = "gtk_spinner_new")]
371 pub fn new() -> Spinner {
372 assert_initialized_main_thread!();
373 unsafe { Widget::from_glib_none(ffi::gtk_spinner_new()).unsafe_cast() }
374 }
375
376 // rustdoc-stripper-ignore-next
377 /// Creates a new builder-pattern struct instance to construct [`Spinner`] objects.
378 ///
379 /// This method returns an instance of [`SpinnerBuilder`](crate::builders::SpinnerBuilder) which can be used to create [`Spinner`] objects.
380 pub fn builder() -> SpinnerBuilder {
381 SpinnerBuilder::new()
382 }
383
384 /// Returns whether the spinner is spinning.
385 ///
386 /// # Returns
387 ///
388 /// [`true`] if the spinner is active
389 #[doc(alias = "gtk_spinner_get_spinning")]
390 #[doc(alias = "get_spinning")]
391 #[doc(alias = "spinning")]
392 pub fn is_spinning(&self) -> bool {
393 unsafe { from_glib(ffi::gtk_spinner_get_spinning(self.to_glib_none().0)) }
394 }
395
396 /// Sets the activity of the spinner.
397 /// ## `spinning`
398 /// whether the spinner should be spinning
399 #[doc(alias = "gtk_spinner_set_spinning")]
400 #[doc(alias = "spinning")]
401 pub fn set_spinning(&self, spinning: bool) {
402 unsafe {
403 ffi::gtk_spinner_set_spinning(self.to_glib_none().0, spinning.into_glib());
404 }
405 }
406
407 /// Starts the animation of the spinner.
408 #[doc(alias = "gtk_spinner_start")]
409 pub fn start(&self) {
410 unsafe {
411 ffi::gtk_spinner_start(self.to_glib_none().0);
412 }
413 }
414
415 /// Stops the animation of the spinner.
416 #[doc(alias = "gtk_spinner_stop")]
417 pub fn stop(&self) {
418 unsafe {
419 ffi::gtk_spinner_stop(self.to_glib_none().0);
420 }
421 }
422
423 #[doc(alias = "spinning")]
424 pub fn connect_spinning_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
425 unsafe extern "C" fn notify_spinning_trampoline<F: Fn(&Spinner) + 'static>(
426 this: *mut ffi::GtkSpinner,
427 _param_spec: glib::ffi::gpointer,
428 f: glib::ffi::gpointer,
429 ) {
430 unsafe {
431 let f: &F = &*(f as *const F);
432 f(&from_glib_borrow(this))
433 }
434 }
435 unsafe {
436 let f: Box_<F> = Box_::new(f);
437 connect_raw(
438 self.as_ptr() as *mut _,
439 c"notify::spinning".as_ptr(),
440 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
441 notify_spinning_trampoline::<F> as *const (),
442 )),
443 Box_::into_raw(f),
444 )
445 }
446 }
447}
448
449impl Default for Spinner {
450 fn default() -> Self {
451 Self::new()
452 }
453}
454
455// rustdoc-stripper-ignore-next
456/// A [builder-pattern] type to construct [`Spinner`] objects.
457///
458/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
459#[must_use = "The builder must be built to be used"]
460pub struct SpinnerBuilder {
461 builder: glib::object::ObjectBuilder<'static, Spinner>,
462}
463
464impl SpinnerBuilder {
465 fn new() -> Self {
466 Self {
467 builder: glib::object::Object::builder(),
468 }
469 }
470
471 /// Whether the spinner is spinning
472 pub fn spinning(self, spinning: bool) -> Self {
473 Self {
474 builder: self.builder.property("spinning", spinning),
475 }
476 }
477
478 /// Whether the widget or any of its descendents can accept
479 /// the input focus.
480 ///
481 /// This property is meant to be set by widget implementations,
482 /// typically in their instance init function.
483 pub fn can_focus(self, can_focus: bool) -> Self {
484 Self {
485 builder: self.builder.property("can-focus", can_focus),
486 }
487 }
488
489 /// Whether the widget can receive pointer events.
490 pub fn can_target(self, can_target: bool) -> Self {
491 Self {
492 builder: self.builder.property("can-target", can_target),
493 }
494 }
495
496 /// A list of css classes applied to this widget.
497 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
498 Self {
499 builder: self.builder.property("css-classes", css_classes.into()),
500 }
501 }
502
503 /// The name of this widget in the CSS tree.
504 ///
505 /// This property is meant to be set by widget implementations,
506 /// typically in their instance init function.
507 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
508 Self {
509 builder: self.builder.property("css-name", css_name.into()),
510 }
511 }
512
513 /// The cursor used by @widget.
514 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
515 Self {
516 builder: self.builder.property("cursor", cursor.clone()),
517 }
518 }
519
520 /// Whether the widget should grab focus when it is clicked with the mouse.
521 ///
522 /// This property is only relevant for widgets that can take focus.
523 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
524 Self {
525 builder: self.builder.property("focus-on-click", focus_on_click),
526 }
527 }
528
529 /// Whether this widget itself will accept the input focus.
530 pub fn focusable(self, focusable: bool) -> Self {
531 Self {
532 builder: self.builder.property("focusable", focusable),
533 }
534 }
535
536 /// How to distribute horizontal space if widget gets extra space.
537 pub fn halign(self, halign: Align) -> Self {
538 Self {
539 builder: self.builder.property("halign", halign),
540 }
541 }
542
543 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
544 /// signal on @widget.
545 ///
546 /// A true value indicates that @widget can have a tooltip, in this case
547 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
548 /// determine whether it will provide a tooltip or not.
549 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
550 Self {
551 builder: self.builder.property("has-tooltip", has_tooltip),
552 }
553 }
554
555 /// Overrides for height request of the widget.
556 ///
557 /// If this is -1, the natural request will be used.
558 pub fn height_request(self, height_request: i32) -> Self {
559 Self {
560 builder: self.builder.property("height-request", height_request),
561 }
562 }
563
564 /// Whether to expand horizontally.
565 pub fn hexpand(self, hexpand: bool) -> Self {
566 Self {
567 builder: self.builder.property("hexpand", hexpand),
568 }
569 }
570
571 /// Whether to use the `hexpand` property.
572 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
573 Self {
574 builder: self.builder.property("hexpand-set", hexpand_set),
575 }
576 }
577
578 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
579 /// the preferred size of the widget, and allocate its children.
580 ///
581 /// This property is meant to be set by widget implementations,
582 /// typically in their instance init function.
583 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
584 Self {
585 builder: self
586 .builder
587 .property("layout-manager", layout_manager.clone().upcast()),
588 }
589 }
590
591 /// Makes this widget act like a modal dialog, with respect to
592 /// event delivery.
593 ///
594 /// Global event controllers will not handle events with targets
595 /// inside the widget, unless they are set up to ignore propagation
596 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
597 #[cfg(feature = "v4_18")]
598 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
599 pub fn limit_events(self, limit_events: bool) -> Self {
600 Self {
601 builder: self.builder.property("limit-events", limit_events),
602 }
603 }
604
605 /// Margin on bottom side of widget.
606 ///
607 /// This property adds margin outside of the widget's normal size
608 /// request, the margin will be added in addition to the size from
609 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
610 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
611 Self {
612 builder: self.builder.property("margin-bottom", margin_bottom),
613 }
614 }
615
616 /// Margin on end of widget, horizontally.
617 ///
618 /// This property supports left-to-right and right-to-left text
619 /// directions.
620 ///
621 /// This property adds margin outside of the widget's normal size
622 /// request, the margin will be added in addition to the size from
623 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
624 pub fn margin_end(self, margin_end: i32) -> Self {
625 Self {
626 builder: self.builder.property("margin-end", margin_end),
627 }
628 }
629
630 /// Margin on start of widget, horizontally.
631 ///
632 /// This property supports left-to-right and right-to-left text
633 /// directions.
634 ///
635 /// This property adds margin outside of the widget's normal size
636 /// request, the margin will be added in addition to the size from
637 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
638 pub fn margin_start(self, margin_start: i32) -> Self {
639 Self {
640 builder: self.builder.property("margin-start", margin_start),
641 }
642 }
643
644 /// Margin on top side of widget.
645 ///
646 /// This property adds margin outside of the widget's normal size
647 /// request, the margin will be added in addition to the size from
648 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
649 pub fn margin_top(self, margin_top: i32) -> Self {
650 Self {
651 builder: self.builder.property("margin-top", margin_top),
652 }
653 }
654
655 /// The name of the widget.
656 pub fn name(self, name: impl Into<glib::GString>) -> Self {
657 Self {
658 builder: self.builder.property("name", name.into()),
659 }
660 }
661
662 /// The requested opacity of the widget.
663 pub fn opacity(self, opacity: f64) -> Self {
664 Self {
665 builder: self.builder.property("opacity", opacity),
666 }
667 }
668
669 /// How content outside the widget's content area is treated.
670 ///
671 /// This property is meant to be set by widget implementations,
672 /// typically in their instance init function.
673 pub fn overflow(self, overflow: Overflow) -> Self {
674 Self {
675 builder: self.builder.property("overflow", overflow),
676 }
677 }
678
679 /// Whether the widget will receive the default action when it is focused.
680 pub fn receives_default(self, receives_default: bool) -> Self {
681 Self {
682 builder: self.builder.property("receives-default", receives_default),
683 }
684 }
685
686 /// Whether the widget responds to input.
687 pub fn sensitive(self, sensitive: bool) -> Self {
688 Self {
689 builder: self.builder.property("sensitive", sensitive),
690 }
691 }
692
693 /// Sets the text of tooltip to be the given string, which is marked up
694 /// with Pango markup.
695 ///
696 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
697 ///
698 /// This is a convenience property which will take care of getting the
699 /// tooltip shown if the given string is not `NULL`:
700 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
701 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
702 /// the default signal handler.
703 ///
704 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
705 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
706 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
707 Self {
708 builder: self
709 .builder
710 .property("tooltip-markup", tooltip_markup.into()),
711 }
712 }
713
714 /// Sets the text of tooltip to be the given string.
715 ///
716 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
717 ///
718 /// This is a convenience property which will take care of getting the
719 /// tooltip shown if the given string is not `NULL`:
720 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
721 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
722 /// the default signal handler.
723 ///
724 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
725 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
726 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
727 Self {
728 builder: self.builder.property("tooltip-text", tooltip_text.into()),
729 }
730 }
731
732 /// How to distribute vertical space if widget gets extra space.
733 pub fn valign(self, valign: Align) -> Self {
734 Self {
735 builder: self.builder.property("valign", valign),
736 }
737 }
738
739 /// Whether to expand vertically.
740 pub fn vexpand(self, vexpand: bool) -> Self {
741 Self {
742 builder: self.builder.property("vexpand", vexpand),
743 }
744 }
745
746 /// Whether to use the `vexpand` property.
747 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
748 Self {
749 builder: self.builder.property("vexpand-set", vexpand_set),
750 }
751 }
752
753 /// Whether the widget is visible.
754 pub fn visible(self, visible: bool) -> Self {
755 Self {
756 builder: self.builder.property("visible", visible),
757 }
758 }
759
760 /// Overrides for width request of the widget.
761 ///
762 /// If this is -1, the natural request will be used.
763 pub fn width_request(self, width_request: i32) -> Self {
764 Self {
765 builder: self.builder.property("width-request", width_request),
766 }
767 }
768
769 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
770 ///
771 /// The accessible role cannot be changed once set.
772 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
773 Self {
774 builder: self.builder.property("accessible-role", accessible_role),
775 }
776 }
777
778 // rustdoc-stripper-ignore-next
779 /// Build the [`Spinner`].
780 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
781 pub fn build(self) -> Spinner {
782 assert_initialized_main_thread!();
783 self.builder.build()
784 }
785}