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