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