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