Skip to main content

libadwaita/auto/
view_switcher.rs

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