gtk4/auto/stack_switcher.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, Orientable,
7 Orientation, Overflow, Stack, Widget,
8};
9use glib::{
10 prelude::*,
11 signal::{connect_raw, SignalHandlerId},
12 translate::*,
13};
14use std::boxed::Box as Box_;
15
16glib::wrapper! {
17 /// The [`StackSwitcher`][crate::StackSwitcher] shows a row of buttons to switch between [`Stack`][crate::Stack]
18 /// pages.
19 ///
20 /// 
21 ///
22 /// It acts as a controller for the associated [`Stack`][crate::Stack].
23 ///
24 /// All the content for the buttons comes from the properties of the stacks
25 /// [`StackPage`][crate::StackPage] objects; the button visibility in a [`StackSwitcher`][crate::StackSwitcher]
26 /// widget is controlled by the visibility of the child in the [`Stack`][crate::Stack].
27 ///
28 /// It is possible to associate multiple [`StackSwitcher`][crate::StackSwitcher] widgets
29 /// with the same [`Stack`][crate::Stack] widget.
30 ///
31 /// # CSS nodes
32 ///
33 /// [`StackSwitcher`][crate::StackSwitcher] has a single CSS node named stackswitcher and
34 /// style class .stack-switcher.
35 ///
36 /// When circumstances require it, [`StackSwitcher`][crate::StackSwitcher] adds the
37 /// .needs-attention style class to the widgets representing the
38 /// stack pages.
39 ///
40 /// # Accessibility
41 ///
42 /// [`StackSwitcher`][crate::StackSwitcher] uses the [`AccessibleRole::TabList`][crate::AccessibleRole::TabList] role
43 /// and uses the [`AccessibleRole::Tab`][crate::AccessibleRole::Tab] for its buttons.
44 ///
45 /// # Orientable
46 ///
47 /// Since GTK 4.4, [`StackSwitcher`][crate::StackSwitcher] implements [`Orientable`][crate::Orientable] allowing
48 /// the stack switcher to be made vertical with
49 /// `gtk_orientable_set_orientation()`.
50 ///
51 /// ## Properties
52 ///
53 ///
54 /// #### `stack`
55 /// The stack.
56 ///
57 /// Readable | Writeable | Construct
58 /// <details><summary><h4>Widget</h4></summary>
59 ///
60 ///
61 /// #### `can-focus`
62 /// Whether the widget or any of its descendents can accept
63 /// the input focus.
64 ///
65 /// This property is meant to be set by widget implementations,
66 /// typically in their instance init function.
67 ///
68 /// Readable | Writeable
69 ///
70 ///
71 /// #### `can-target`
72 /// Whether the widget can receive pointer events.
73 ///
74 /// Readable | Writeable
75 ///
76 ///
77 /// #### `css-classes`
78 /// A list of css classes applied to this widget.
79 ///
80 /// Readable | Writeable
81 ///
82 ///
83 /// #### `css-name`
84 /// The name of this widget in the CSS tree.
85 ///
86 /// This property is meant to be set by widget implementations,
87 /// typically in their instance init function.
88 ///
89 /// Readable | Writeable | Construct Only
90 ///
91 ///
92 /// #### `cursor`
93 /// The cursor used by @widget.
94 ///
95 /// Readable | Writeable
96 ///
97 ///
98 /// #### `focus-on-click`
99 /// Whether the widget should grab focus when it is clicked with the mouse.
100 ///
101 /// This property is only relevant for widgets that can take focus.
102 ///
103 /// Readable | Writeable
104 ///
105 ///
106 /// #### `focusable`
107 /// Whether this widget itself will accept the input focus.
108 ///
109 /// Readable | Writeable
110 ///
111 ///
112 /// #### `halign`
113 /// How to distribute horizontal space if widget gets extra space.
114 ///
115 /// Readable | Writeable
116 ///
117 ///
118 /// #### `has-default`
119 /// Whether the widget is the default widget.
120 ///
121 /// Readable
122 ///
123 ///
124 /// #### `has-focus`
125 /// Whether the widget has the input focus.
126 ///
127 /// Readable
128 ///
129 ///
130 /// #### `has-tooltip`
131 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
132 /// signal on @widget.
133 ///
134 /// A true value indicates that @widget can have a tooltip, in this case
135 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
136 /// determine whether it will provide a tooltip or not.
137 ///
138 /// Readable | Writeable
139 ///
140 ///
141 /// #### `height-request`
142 /// Overrides for height request of the widget.
143 ///
144 /// If this is -1, the natural request will be used.
145 ///
146 /// Readable | Writeable
147 ///
148 ///
149 /// #### `hexpand`
150 /// Whether to expand horizontally.
151 ///
152 /// Readable | Writeable
153 ///
154 ///
155 /// #### `hexpand-set`
156 /// Whether to use the `hexpand` property.
157 ///
158 /// Readable | Writeable
159 ///
160 ///
161 /// #### `layout-manager`
162 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
163 /// the preferred size of the widget, and allocate its children.
164 ///
165 /// This property is meant to be set by widget implementations,
166 /// typically in their instance init function.
167 ///
168 /// Readable | Writeable
169 ///
170 ///
171 /// #### `limit-events`
172 /// Makes this widget act like a modal dialog, with respect to
173 /// event delivery.
174 ///
175 /// Global event controllers will not handle events with targets
176 /// inside the widget, unless they are set up to ignore propagation
177 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
178 ///
179 /// Readable | Writeable
180 ///
181 ///
182 /// #### `margin-bottom`
183 /// Margin on bottom side of widget.
184 ///
185 /// This property adds margin outside of the widget's normal size
186 /// request, the margin will be added in addition to the size from
187 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
188 ///
189 /// Readable | Writeable
190 ///
191 ///
192 /// #### `margin-end`
193 /// Margin on end of widget, horizontally.
194 ///
195 /// This property supports left-to-right and right-to-left text
196 /// directions.
197 ///
198 /// This property adds margin outside of the widget's normal size
199 /// request, the margin will be added in addition to the size from
200 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
201 ///
202 /// Readable | Writeable
203 ///
204 ///
205 /// #### `margin-start`
206 /// Margin on start of widget, horizontally.
207 ///
208 /// This property supports left-to-right and right-to-left text
209 /// directions.
210 ///
211 /// This property adds margin outside of the widget's normal size
212 /// request, the margin will be added in addition to the size from
213 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
214 ///
215 /// Readable | Writeable
216 ///
217 ///
218 /// #### `margin-top`
219 /// Margin on top side of widget.
220 ///
221 /// This property adds margin outside of the widget's normal size
222 /// request, the margin will be added in addition to the size from
223 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
224 ///
225 /// Readable | Writeable
226 ///
227 ///
228 /// #### `name`
229 /// The name of the widget.
230 ///
231 /// Readable | Writeable
232 ///
233 ///
234 /// #### `opacity`
235 /// The requested opacity of the widget.
236 ///
237 /// Readable | Writeable
238 ///
239 ///
240 /// #### `overflow`
241 /// How content outside the widget's content area is treated.
242 ///
243 /// This property is meant to be set by widget implementations,
244 /// typically in their instance init function.
245 ///
246 /// Readable | Writeable
247 ///
248 ///
249 /// #### `parent`
250 /// The parent widget of this widget.
251 ///
252 /// Readable
253 ///
254 ///
255 /// #### `receives-default`
256 /// Whether the widget will receive the default action when it is focused.
257 ///
258 /// Readable | Writeable
259 ///
260 ///
261 /// #### `root`
262 /// The [`Root`][crate::Root] widget of the widget tree containing this widget.
263 ///
264 /// This will be `NULL` if the widget is not contained in a root widget.
265 ///
266 /// Readable
267 ///
268 ///
269 /// #### `scale-factor`
270 /// The scale factor of the widget.
271 ///
272 /// Readable
273 ///
274 ///
275 /// #### `sensitive`
276 /// Whether the widget responds to input.
277 ///
278 /// Readable | Writeable
279 ///
280 ///
281 /// #### `tooltip-markup`
282 /// Sets the text of tooltip to be the given string, which is marked up
283 /// with Pango markup.
284 ///
285 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
286 ///
287 /// This is a convenience property which will take care of getting the
288 /// tooltip shown if the given string is not `NULL`:
289 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
290 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
291 /// the default signal handler.
292 ///
293 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
294 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
295 ///
296 /// Readable | Writeable
297 ///
298 ///
299 /// #### `tooltip-text`
300 /// Sets the text of tooltip to be the given string.
301 ///
302 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
303 ///
304 /// This is a convenience property which will take care of getting the
305 /// tooltip shown if the given string is not `NULL`:
306 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
307 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
308 /// the default signal handler.
309 ///
310 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
311 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
312 ///
313 /// Readable | Writeable
314 ///
315 ///
316 /// #### `valign`
317 /// How to distribute vertical space if widget gets extra space.
318 ///
319 /// Readable | Writeable
320 ///
321 ///
322 /// #### `vexpand`
323 /// Whether to expand vertically.
324 ///
325 /// Readable | Writeable
326 ///
327 ///
328 /// #### `vexpand-set`
329 /// Whether to use the `vexpand` property.
330 ///
331 /// Readable | Writeable
332 ///
333 ///
334 /// #### `visible`
335 /// Whether the widget is visible.
336 ///
337 /// Readable | Writeable
338 ///
339 ///
340 /// #### `width-request`
341 /// Overrides for width request of the widget.
342 ///
343 /// If this is -1, the natural request will be used.
344 ///
345 /// Readable | Writeable
346 /// </details>
347 /// <details><summary><h4>Accessible</h4></summary>
348 ///
349 ///
350 /// #### `accessible-role`
351 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
352 ///
353 /// The accessible role cannot be changed once set.
354 ///
355 /// Readable | Writeable
356 /// </details>
357 /// <details><summary><h4>Orientable</h4></summary>
358 ///
359 ///
360 /// #### `orientation`
361 /// The orientation of the orientable.
362 ///
363 /// Readable | Writeable
364 /// </details>
365 ///
366 /// # Implements
367 ///
368 /// [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`OrientableExt`][trait@crate::prelude::OrientableExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
369 #[doc(alias = "GtkStackSwitcher")]
370 pub struct StackSwitcher(Object<ffi::GtkStackSwitcher>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, Orientable;
371
372 match fn {
373 type_ => || ffi::gtk_stack_switcher_get_type(),
374 }
375}
376
377impl StackSwitcher {
378 /// Create a new [`StackSwitcher`][crate::StackSwitcher].
379 ///
380 /// # Returns
381 ///
382 /// a new [`StackSwitcher`][crate::StackSwitcher].
383 #[doc(alias = "gtk_stack_switcher_new")]
384 pub fn new() -> StackSwitcher {
385 assert_initialized_main_thread!();
386 unsafe { Widget::from_glib_none(ffi::gtk_stack_switcher_new()).unsafe_cast() }
387 }
388
389 // rustdoc-stripper-ignore-next
390 /// Creates a new builder-pattern struct instance to construct [`StackSwitcher`] objects.
391 ///
392 /// This method returns an instance of [`StackSwitcherBuilder`](crate::builders::StackSwitcherBuilder) which can be used to create [`StackSwitcher`] objects.
393 pub fn builder() -> StackSwitcherBuilder {
394 StackSwitcherBuilder::new()
395 }
396
397 /// Retrieves the stack.
398 ///
399 /// # Returns
400 ///
401 /// the stack
402 #[doc(alias = "gtk_stack_switcher_get_stack")]
403 #[doc(alias = "get_stack")]
404 pub fn stack(&self) -> Option<Stack> {
405 unsafe { from_glib_none(ffi::gtk_stack_switcher_get_stack(self.to_glib_none().0)) }
406 }
407
408 /// Sets the stack to control.
409 /// ## `stack`
410 /// a [`Stack`][crate::Stack]
411 #[doc(alias = "gtk_stack_switcher_set_stack")]
412 #[doc(alias = "stack")]
413 pub fn set_stack(&self, stack: Option<&Stack>) {
414 unsafe {
415 ffi::gtk_stack_switcher_set_stack(self.to_glib_none().0, stack.to_glib_none().0);
416 }
417 }
418
419 #[doc(alias = "stack")]
420 pub fn connect_stack_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
421 unsafe extern "C" fn notify_stack_trampoline<F: Fn(&StackSwitcher) + 'static>(
422 this: *mut ffi::GtkStackSwitcher,
423 _param_spec: glib::ffi::gpointer,
424 f: glib::ffi::gpointer,
425 ) {
426 let f: &F = &*(f as *const F);
427 f(&from_glib_borrow(this))
428 }
429 unsafe {
430 let f: Box_<F> = Box_::new(f);
431 connect_raw(
432 self.as_ptr() as *mut _,
433 b"notify::stack\0".as_ptr() as *const _,
434 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
435 notify_stack_trampoline::<F> as *const (),
436 )),
437 Box_::into_raw(f),
438 )
439 }
440 }
441}
442
443impl Default for StackSwitcher {
444 fn default() -> Self {
445 Self::new()
446 }
447}
448
449// rustdoc-stripper-ignore-next
450/// A [builder-pattern] type to construct [`StackSwitcher`] 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 StackSwitcherBuilder {
455 builder: glib::object::ObjectBuilder<'static, StackSwitcher>,
456}
457
458impl StackSwitcherBuilder {
459 fn new() -> Self {
460 Self {
461 builder: glib::object::Object::builder(),
462 }
463 }
464
465 /// The stack.
466 pub fn stack(self, stack: &Stack) -> Self {
467 Self {
468 builder: self.builder.property("stack", stack.clone()),
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 /// The orientation of the orientable.
773 pub fn orientation(self, orientation: Orientation) -> Self {
774 Self {
775 builder: self.builder.property("orientation", orientation),
776 }
777 }
778
779 // rustdoc-stripper-ignore-next
780 /// Build the [`StackSwitcher`].
781 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
782 pub fn build(self) -> StackSwitcher {
783 assert_initialized_main_thread!();
784 self.builder.build()
785 }
786}