Skip to main content

libadwaita/auto/
overlay_split_view.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::{LengthUnit, Swipeable, ffi};
7use glib::{
8    prelude::*,
9    signal::{SignalHandlerId, connect_raw},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    /// A widget presenting sidebar and content side by side or as an overlay.
16    ///
17    /// <picture>
18    ///   <source srcset="overlay-split-view-dark.png" media="(prefers-color-scheme: dark)">
19    ///   <img src="overlay-split-view.png" alt="overlay-split-view">
20    /// </picture>
21    /// <picture>
22    ///   <source srcset="overlay-split-view-collapsed-dark.png" media="(prefers-color-scheme: dark)">
23    ///   <img src="overlay-split-view-collapsed.png" alt="overlay-split-view-collapsed">
24    /// </picture>
25    ///
26    /// [`OverlaySplitView`][crate::OverlaySplitView] has two children: sidebar and content, and displays
27    /// them side by side.
28    ///
29    /// When [`collapsed`][struct@crate::OverlaySplitView#collapsed] is set to `TRUE`, the sidebar is
30    /// instead shown as an overlay above the content widget.
31    ///
32    /// The sidebar can be hidden or shown using the
33    /// [`show-sidebar`][struct@crate::OverlaySplitView#show-sidebar] property.
34    ///
35    /// Sidebar can be displayed before or after the content, this can be controlled
36    /// with the [`sidebar-position`][struct@crate::OverlaySplitView#sidebar-position] property.
37    ///
38    /// Collapsing the split view automatically hides the sidebar widget, and
39    /// uncollapsing it shows the sidebar. If this behavior is not desired, the
40    /// [`pin-sidebar`][struct@crate::OverlaySplitView#pin-sidebar] property can be used to override it.
41    ///
42    /// [`OverlaySplitView`][crate::OverlaySplitView] supports an edge swipe gesture for showing the sidebar,
43    /// and a swipe from the sidebar for hiding it. Gestures are only supported on
44    /// touchscreen, but not touchpad. Gestures can be controlled with the
45    /// [`enable-show-gesture`][struct@crate::OverlaySplitView#enable-show-gesture] and
46    /// [`enable-hide-gesture`][struct@crate::OverlaySplitView#enable-hide-gesture] properties.
47    ///
48    /// See also [`NavigationSplitView`][crate::NavigationSplitView].
49    ///
50    /// [`OverlaySplitView`][crate::OverlaySplitView] is typically used together with an [`Breakpoint`][crate::Breakpoint]
51    /// setting the `collapsed` property to `TRUE` on small widths, as follows:
52    ///
53    /// ```xml
54    /// <object class="AdwWindow">
55    ///   <property name="default-width">800</property>
56    ///   <property name="default-height">800</property>
57    ///   <child>
58    ///     <object class="AdwBreakpoint">
59    ///       <condition>max-width: 400sp</condition>
60    ///       <setter object="split_view" property="collapsed">True</setter>
61    ///     </object>
62    ///   </child>
63    ///   <property name="content">
64    ///     <object class="AdwOverlaySplitView" id="split_view">
65    ///       <property name="sidebar">
66    ///         <!-- ... -->
67    ///       </property>
68    ///       <property name="content">
69    ///         <!-- ... -->
70    ///       </property>
71    ///     </object>
72    ///   </property>
73    /// </object>
74    /// ```
75    ///
76    /// [`OverlaySplitView`][crate::OverlaySplitView] is often used for implementing the
77    /// [utility pane](https://developer.gnome.org/hig/patterns/containers/utility-panes.html)
78    /// pattern.
79    ///
80    /// ## Sizing
81    ///
82    /// When not collapsed, [`OverlaySplitView`][crate::OverlaySplitView] changes the sidebar width
83    /// depending on its own width.
84    ///
85    /// If possible, it tries to allocate a fraction of the total width, controlled
86    /// with the [`sidebar-width-fraction`][struct@crate::OverlaySplitView#sidebar-width-fraction] property.
87    ///
88    /// The sidebar also has minimum and maximum sizes, controlled with the
89    /// [`min-sidebar-width`][struct@crate::OverlaySplitView#min-sidebar-width] and
90    /// [`max-sidebar-width`][struct@crate::OverlaySplitView#max-sidebar-width] properties.
91    ///
92    /// The minimum and maximum sizes are using the length unit specified with the
93    /// [`sidebar-width-unit`][struct@crate::OverlaySplitView#sidebar-width-unit].
94    ///
95    /// By default, sidebar is using 25% of the total width, with 180sp as the
96    /// minimum size and 280sp as the maximum size.
97    ///
98    /// When collapsed, the preferred width fraction is ignored and the sidebar uses
99    /// [`max-sidebar-width`][struct@crate::OverlaySplitView#max-sidebar-width] when possible.
100    ///
101    /// ## Header Bar Integration
102    ///
103    /// When used inside [`OverlaySplitView`][crate::OverlaySplitView], [`HeaderBar`][crate::HeaderBar] will automatically
104    /// hide the window buttons in the middle.
105    ///
106    /// ## [`OverlaySplitView`][crate::OverlaySplitView] as [`gtk::Buildable`][crate::gtk::Buildable]
107    ///
108    /// The [`OverlaySplitView`][crate::OverlaySplitView] implementation of the [`gtk::Buildable`][crate::gtk::Buildable]
109    /// interface supports setting the sidebar widget by specifying “sidebar” as the
110    /// “type” attribute of a `<child>` element, Specifying “content” child type or
111    /// omitting it results in setting the content widget.
112    ///
113    /// ## CSS nodes
114    ///
115    /// [`OverlaySplitView`][crate::OverlaySplitView] has a single CSS node with the name
116    /// `overlay-split-view`.
117    ///
118    /// It contains two nodes with the name `widget`, containing the sidebar and
119    /// content children.
120    ///
121    /// When not collapsed, they have the `.sidebar-view` and `.content-view` style
122    /// classes respectively.
123    ///
124    /// ```text
125    /// overlay-split-view
126    /// ├── widget.sidebar-pane
127    /// │   ╰── [sidebar child]
128    /// ╰── widget.content-pane
129    ///     ╰── [content child]
130    /// ```
131    ///
132    /// When collapsed, the one containing the sidebar child has the `.background`
133    /// style class and the other one has no style classes.
134    ///
135    /// ```text
136    /// overlay-split-view
137    /// ├── widget.background
138    /// │   ╰── [sidebar child]
139    /// ╰── widget
140    ///     ╰── [content child]
141    /// ```
142    ///
143    /// ## Accessibility
144    ///
145    /// [`OverlaySplitView`][crate::OverlaySplitView] uses the [enum@Gtk.AccessibleRole.group] role.
146    ///
147    /// ## Properties
148    ///
149    ///
150    /// #### `collapsed`
151    ///  Whether the split view is collapsed.
152    ///
153    /// When collapsed, the sidebar widget is presented as an overlay above the
154    /// content widget, otherwise they are displayed side by side.
155    ///
156    /// Readable | Writeable
157    ///
158    ///
159    /// #### `content`
160    ///  The content widget.
161    ///
162    /// Readable | Writeable
163    ///
164    ///
165    /// #### `enable-hide-gesture`
166    ///  Whether the sidebar can be closed with a swipe gesture.
167    ///
168    /// Only touchscreen swipes are supported.
169    ///
170    /// Readable | Writeable
171    ///
172    ///
173    /// #### `enable-show-gesture`
174    ///  Whether the sidebar can be opened with an edge swipe gesture.
175    ///
176    /// Only touchscreen swipes are supported.
177    ///
178    /// Readable | Writeable
179    ///
180    ///
181    /// #### `max-sidebar-width`
182    ///  The maximum sidebar width.
183    ///
184    /// Maximum width is affected by
185    /// [`sidebar-width-unit`][struct@crate::OverlaySplitView#sidebar-width-unit].
186    ///
187    /// The sidebar widget can still be allocated with larger width if its own
188    /// minimum width exceeds it.
189    ///
190    /// Readable | Writeable
191    ///
192    ///
193    /// #### `min-sidebar-width`
194    ///  The minimum sidebar width.
195    ///
196    /// Minimum width is affected by
197    /// [`sidebar-width-unit`][struct@crate::OverlaySplitView#sidebar-width-unit].
198    ///
199    /// The sidebar widget can still be allocated with larger width if its own
200    /// minimum width exceeds it.
201    ///
202    /// Readable | Writeable
203    ///
204    ///
205    /// #### `pin-sidebar`
206    ///  Whether the sidebar widget is pinned.
207    ///
208    /// By default, collapsing @self_ automatically hides the sidebar widget, and
209    /// uncollapsing it shows the sidebar. If set to `TRUE`, sidebar visibility
210    /// never changes on its own.
211    ///
212    /// Readable | Writeable
213    ///
214    ///
215    /// #### `show-sidebar`
216    ///  Whether the sidebar widget is shown.
217    ///
218    /// Readable | Writeable
219    ///
220    ///
221    /// #### `sidebar`
222    ///  The sidebar widget.
223    ///
224    /// Readable | Writeable
225    ///
226    ///
227    /// #### `sidebar-position`
228    ///  The sidebar position.
229    ///
230    /// If it's set to [enum@Gtk.PackType.start], the sidebar is displayed before
231    /// the content; if [enum@Gtk.PackType.end], it's displayed after the content.
232    ///
233    /// Readable | Writeable
234    ///
235    ///
236    /// #### `sidebar-width-fraction`
237    ///  The preferred sidebar width as a fraction of the total width.
238    ///
239    /// The preferred width is additionally limited by
240    /// [`min-sidebar-width`][struct@crate::OverlaySplitView#min-sidebar-width] and
241    /// [`max-sidebar-width`][struct@crate::OverlaySplitView#max-sidebar-width].
242    ///
243    /// The sidebar widget can be allocated with larger width if its own minimum
244    /// width exceeds the preferred width.
245    ///
246    /// Readable | Writeable
247    ///
248    ///
249    /// #### `sidebar-width-unit`
250    ///  The length unit for minimum and maximum sidebar widths.
251    ///
252    /// See [`min-sidebar-width`][struct@crate::OverlaySplitView#min-sidebar-width] and
253    /// [`max-sidebar-width`][struct@crate::OverlaySplitView#max-sidebar-width].
254    ///
255    /// Readable | Writeable
256    /// <details><summary><h4>Widget</h4></summary>
257    ///
258    ///
259    /// #### `can-focus`
260    ///  Whether the widget or any of its descendents can accept
261    /// the input focus.
262    ///
263    /// This property is meant to be set by widget implementations,
264    /// typically in their instance init function.
265    ///
266    /// Readable | Writeable
267    ///
268    ///
269    /// #### `can-target`
270    ///  Whether the widget can receive pointer events.
271    ///
272    /// Readable | Writeable
273    ///
274    ///
275    /// #### `css-classes`
276    ///  A list of css classes applied to this widget.
277    ///
278    /// Readable | Writeable
279    ///
280    ///
281    /// #### `css-name`
282    ///  The name of this widget in the CSS tree.
283    ///
284    /// This property is meant to be set by widget implementations,
285    /// typically in their instance init function.
286    ///
287    /// Readable | Writeable | Construct Only
288    ///
289    ///
290    /// #### `cursor`
291    ///  The cursor used by @widget.
292    ///
293    /// Readable | Writeable
294    ///
295    ///
296    /// #### `focus-on-click`
297    ///  Whether the widget should grab focus when it is clicked with the mouse.
298    ///
299    /// This property is only relevant for widgets that can take focus.
300    ///
301    /// Readable | Writeable
302    ///
303    ///
304    /// #### `focusable`
305    ///  Whether this widget itself will accept the input focus.
306    ///
307    /// Readable | Writeable
308    ///
309    ///
310    /// #### `halign`
311    ///  How to distribute horizontal space if widget gets extra space.
312    ///
313    /// Readable | Writeable
314    ///
315    ///
316    /// #### `has-default`
317    ///  Whether the widget is the default widget.
318    ///
319    /// Readable
320    ///
321    ///
322    /// #### `has-focus`
323    ///  Whether the widget has the input focus.
324    ///
325    /// Readable
326    ///
327    ///
328    /// #### `has-tooltip`
329    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
330    /// signal on @widget.
331    ///
332    /// A true value indicates that @widget can have a tooltip, in this case
333    /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
334    /// determine whether it will provide a tooltip or not.
335    ///
336    /// Readable | Writeable
337    ///
338    ///
339    /// #### `height-request`
340    ///  Overrides for height request of the widget.
341    ///
342    /// If this is -1, the natural request will be used.
343    ///
344    /// Readable | Writeable
345    ///
346    ///
347    /// #### `hexpand`
348    ///  Whether to expand horizontally.
349    ///
350    /// Readable | Writeable
351    ///
352    ///
353    /// #### `hexpand-set`
354    ///  Whether to use the `hexpand` property.
355    ///
356    /// Readable | Writeable
357    ///
358    ///
359    /// #### `layout-manager`
360    ///  The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
361    /// the preferred size of the widget, and allocate its children.
362    ///
363    /// This property is meant to be set by widget implementations,
364    /// typically in their instance init function.
365    ///
366    /// Readable | Writeable
367    ///
368    ///
369    /// #### `limit-events`
370    ///  Makes this widget act like a modal dialog, with respect to
371    /// event delivery.
372    ///
373    /// Global event controllers will not handle events with targets
374    /// inside the widget, unless they are set up to ignore propagation
375    /// limits. See `Gtk::EventController::set_propagation_limit()`.
376    ///
377    /// Readable | Writeable
378    ///
379    ///
380    /// #### `margin-bottom`
381    ///  Margin on bottom side of widget.
382    ///
383    /// This property adds margin outside of the widget's normal size
384    /// request, the margin will be added in addition to the size from
385    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
386    ///
387    /// Readable | Writeable
388    ///
389    ///
390    /// #### `margin-end`
391    ///  Margin on end of widget, horizontally.
392    ///
393    /// This property supports left-to-right and right-to-left text
394    /// directions.
395    ///
396    /// This property adds margin outside of the widget's normal size
397    /// request, the margin will be added in addition to the size from
398    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
399    ///
400    /// Readable | Writeable
401    ///
402    ///
403    /// #### `margin-start`
404    ///  Margin on start of widget, horizontally.
405    ///
406    /// This property supports left-to-right and right-to-left text
407    /// directions.
408    ///
409    /// This property adds margin outside of the widget's normal size
410    /// request, the margin will be added in addition to the size from
411    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
412    ///
413    /// Readable | Writeable
414    ///
415    ///
416    /// #### `margin-top`
417    ///  Margin on top side of widget.
418    ///
419    /// This property adds margin outside of the widget's normal size
420    /// request, the margin will be added in addition to the size from
421    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
422    ///
423    /// Readable | Writeable
424    ///
425    ///
426    /// #### `name`
427    ///  The name of the widget.
428    ///
429    /// Readable | Writeable
430    ///
431    ///
432    /// #### `opacity`
433    ///  The requested opacity of the widget.
434    ///
435    /// Readable | Writeable
436    ///
437    ///
438    /// #### `overflow`
439    ///  How content outside the widget's content area is treated.
440    ///
441    /// This property is meant to be set by widget implementations,
442    /// typically in their instance init function.
443    ///
444    /// Readable | Writeable
445    ///
446    ///
447    /// #### `parent`
448    ///  The parent widget of this widget.
449    ///
450    /// Readable
451    ///
452    ///
453    /// #### `receives-default`
454    ///  Whether the widget will receive the default action when it is focused.
455    ///
456    /// Readable | Writeable
457    ///
458    ///
459    /// #### `root`
460    ///  The [`gtk::Root`][crate::gtk::Root] widget of the widget tree containing this widget.
461    ///
462    /// This will be `NULL` if the widget is not contained in a root widget.
463    ///
464    /// Readable
465    ///
466    ///
467    /// #### `scale-factor`
468    ///  The scale factor of the widget.
469    ///
470    /// Readable
471    ///
472    ///
473    /// #### `sensitive`
474    ///  Whether the widget responds to input.
475    ///
476    /// Readable | Writeable
477    ///
478    ///
479    /// #### `tooltip-markup`
480    ///  Sets the text of tooltip to be the given string, which is marked up
481    /// with Pango markup.
482    ///
483    /// Also see `Gtk::Tooltip::set_markup()`.
484    ///
485    /// This is a convenience property which will take care of getting the
486    /// tooltip shown if the given string is not `NULL`:
487    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
488    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
489    /// the default signal handler.
490    ///
491    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
492    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
493    ///
494    /// Readable | Writeable
495    ///
496    ///
497    /// #### `tooltip-text`
498    ///  Sets the text of tooltip to be the given string.
499    ///
500    /// Also see `Gtk::Tooltip::set_text()`.
501    ///
502    /// This is a convenience property which will take care of getting the
503    /// tooltip shown if the given string is not `NULL`:
504    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
505    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
506    /// the default signal handler.
507    ///
508    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
509    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
510    ///
511    /// Readable | Writeable
512    ///
513    ///
514    /// #### `valign`
515    ///  How to distribute vertical space if widget gets extra space.
516    ///
517    /// Readable | Writeable
518    ///
519    ///
520    /// #### `vexpand`
521    ///  Whether to expand vertically.
522    ///
523    /// Readable | Writeable
524    ///
525    ///
526    /// #### `vexpand-set`
527    ///  Whether to use the `vexpand` property.
528    ///
529    /// Readable | Writeable
530    ///
531    ///
532    /// #### `visible`
533    ///  Whether the widget is visible.
534    ///
535    /// Readable | Writeable
536    ///
537    ///
538    /// #### `width-request`
539    ///  Overrides for width request of the widget.
540    ///
541    /// If this is -1, the natural request will be used.
542    ///
543    /// Readable | Writeable
544    /// </details>
545    /// <details><summary><h4>Accessible</h4></summary>
546    ///
547    ///
548    /// #### `accessible-role`
549    ///  The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
550    ///
551    /// The accessible role cannot be changed once set.
552    ///
553    /// Readable | Writeable
554    /// </details>
555    ///
556    /// # Implements
557    ///
558    /// [`trait@gtk::prelude::WidgetExt`], [`trait@glib::ObjectExt`], [`trait@gtk::prelude::AccessibleExt`], [`trait@gtk::prelude::BuildableExt`], [`trait@gtk::prelude::ConstraintTargetExt`], [`SwipeableExt`][trait@crate::prelude::SwipeableExt]
559    #[doc(alias = "AdwOverlaySplitView")]
560    pub struct OverlaySplitView(Object<ffi::AdwOverlaySplitView, ffi::AdwOverlaySplitViewClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, Swipeable;
561
562    match fn {
563        type_ => || ffi::adw_overlay_split_view_get_type(),
564    }
565}
566
567impl OverlaySplitView {
568    /// Creates a new [`OverlaySplitView`][crate::OverlaySplitView].
569    ///
570    /// # Returns
571    ///
572    /// the newly created [`OverlaySplitView`][crate::OverlaySplitView]
573    #[doc(alias = "adw_overlay_split_view_new")]
574    pub fn new() -> OverlaySplitView {
575        assert_initialized_main_thread!();
576        unsafe { gtk::Widget::from_glib_none(ffi::adw_overlay_split_view_new()).unsafe_cast() }
577    }
578
579    // rustdoc-stripper-ignore-next
580    /// Creates a new builder-pattern struct instance to construct [`OverlaySplitView`] objects.
581    ///
582    /// This method returns an instance of [`OverlaySplitViewBuilder`](crate::builders::OverlaySplitViewBuilder) which can be used to create [`OverlaySplitView`] objects.
583    pub fn builder() -> OverlaySplitViewBuilder {
584        OverlaySplitViewBuilder::new()
585    }
586
587    /// Gets whether @self is collapsed.
588    ///
589    /// # Returns
590    ///
591    /// whether @self is collapsed
592    #[doc(alias = "adw_overlay_split_view_get_collapsed")]
593    #[doc(alias = "get_collapsed")]
594    #[doc(alias = "collapsed")]
595    pub fn is_collapsed(&self) -> bool {
596        unsafe {
597            from_glib(ffi::adw_overlay_split_view_get_collapsed(
598                self.to_glib_none().0,
599            ))
600        }
601    }
602
603    /// Gets the content widget for @self.
604    ///
605    /// # Returns
606    ///
607    /// the content widget for @self
608    #[doc(alias = "adw_overlay_split_view_get_content")]
609    #[doc(alias = "get_content")]
610    pub fn content(&self) -> Option<gtk::Widget> {
611        unsafe {
612            from_glib_none(ffi::adw_overlay_split_view_get_content(
613                self.to_glib_none().0,
614            ))
615        }
616    }
617
618    /// Gets whether @self can be closed with a swipe gesture.
619    ///
620    /// # Returns
621    ///
622    /// `TRUE` if @self can be closed with a swipe gesture
623    #[doc(alias = "adw_overlay_split_view_get_enable_hide_gesture")]
624    #[doc(alias = "get_enable_hide_gesture")]
625    #[doc(alias = "enable-hide-gesture")]
626    pub fn enables_hide_gesture(&self) -> bool {
627        unsafe {
628            from_glib(ffi::adw_overlay_split_view_get_enable_hide_gesture(
629                self.to_glib_none().0,
630            ))
631        }
632    }
633
634    /// Gets whether @self can be opened with an edge swipe gesture.
635    ///
636    /// # Returns
637    ///
638    /// `TRUE` if @self can be opened with a swipe gesture
639    #[doc(alias = "adw_overlay_split_view_get_enable_show_gesture")]
640    #[doc(alias = "get_enable_show_gesture")]
641    #[doc(alias = "enable-show-gesture")]
642    pub fn enables_show_gesture(&self) -> bool {
643        unsafe {
644            from_glib(ffi::adw_overlay_split_view_get_enable_show_gesture(
645                self.to_glib_none().0,
646            ))
647        }
648    }
649
650    /// Gets the maximum sidebar width for @self.
651    ///
652    /// # Returns
653    ///
654    /// the maximum width
655    #[doc(alias = "adw_overlay_split_view_get_max_sidebar_width")]
656    #[doc(alias = "get_max_sidebar_width")]
657    #[doc(alias = "max-sidebar-width")]
658    pub fn max_sidebar_width(&self) -> f64 {
659        unsafe { ffi::adw_overlay_split_view_get_max_sidebar_width(self.to_glib_none().0) }
660    }
661
662    /// Gets the minimum sidebar width for @self.
663    ///
664    /// # Returns
665    ///
666    /// the minimum width
667    #[doc(alias = "adw_overlay_split_view_get_min_sidebar_width")]
668    #[doc(alias = "get_min_sidebar_width")]
669    #[doc(alias = "min-sidebar-width")]
670    pub fn min_sidebar_width(&self) -> f64 {
671        unsafe { ffi::adw_overlay_split_view_get_min_sidebar_width(self.to_glib_none().0) }
672    }
673
674    /// Gets whether the sidebar widget is pinned for @self.
675    ///
676    /// # Returns
677    ///
678    /// whether if the sidebar widget is pinned
679    #[doc(alias = "adw_overlay_split_view_get_pin_sidebar")]
680    #[doc(alias = "get_pin_sidebar")]
681    #[doc(alias = "pin-sidebar")]
682    pub fn is_pin_sidebar(&self) -> bool {
683        unsafe {
684            from_glib(ffi::adw_overlay_split_view_get_pin_sidebar(
685                self.to_glib_none().0,
686            ))
687        }
688    }
689
690    /// Gets whether the sidebar widget is shown for @self.
691    ///
692    /// # Returns
693    ///
694    /// `TRUE` if the sidebar widget is shown
695    #[doc(alias = "adw_overlay_split_view_get_show_sidebar")]
696    #[doc(alias = "get_show_sidebar")]
697    #[doc(alias = "show-sidebar")]
698    pub fn shows_sidebar(&self) -> bool {
699        unsafe {
700            from_glib(ffi::adw_overlay_split_view_get_show_sidebar(
701                self.to_glib_none().0,
702            ))
703        }
704    }
705
706    /// Gets the sidebar widget for @self.
707    ///
708    /// # Returns
709    ///
710    /// the sidebar widget for @self
711    #[doc(alias = "adw_overlay_split_view_get_sidebar")]
712    #[doc(alias = "get_sidebar")]
713    pub fn sidebar(&self) -> Option<gtk::Widget> {
714        unsafe {
715            from_glib_none(ffi::adw_overlay_split_view_get_sidebar(
716                self.to_glib_none().0,
717            ))
718        }
719    }
720
721    /// Gets the sidebar position for @self.
722    ///
723    /// # Returns
724    ///
725    /// the sidebar position for @self
726    #[doc(alias = "adw_overlay_split_view_get_sidebar_position")]
727    #[doc(alias = "get_sidebar_position")]
728    #[doc(alias = "sidebar-position")]
729    pub fn sidebar_position(&self) -> gtk::PackType {
730        unsafe {
731            from_glib(ffi::adw_overlay_split_view_get_sidebar_position(
732                self.to_glib_none().0,
733            ))
734        }
735    }
736
737    /// Gets the preferred sidebar width fraction for @self.
738    ///
739    /// # Returns
740    ///
741    /// the preferred width fraction
742    #[doc(alias = "adw_overlay_split_view_get_sidebar_width_fraction")]
743    #[doc(alias = "get_sidebar_width_fraction")]
744    #[doc(alias = "sidebar-width-fraction")]
745    pub fn sidebar_width_fraction(&self) -> f64 {
746        unsafe { ffi::adw_overlay_split_view_get_sidebar_width_fraction(self.to_glib_none().0) }
747    }
748
749    /// Gets the length unit for minimum and maximum sidebar widths.
750    ///
751    /// # Returns
752    ///
753    /// the length unit
754    #[doc(alias = "adw_overlay_split_view_get_sidebar_width_unit")]
755    #[doc(alias = "get_sidebar_width_unit")]
756    #[doc(alias = "sidebar-width-unit")]
757    pub fn sidebar_width_unit(&self) -> LengthUnit {
758        unsafe {
759            from_glib(ffi::adw_overlay_split_view_get_sidebar_width_unit(
760                self.to_glib_none().0,
761            ))
762        }
763    }
764
765    /// Sets whether @self view is collapsed.
766    ///
767    /// When collapsed, the sidebar widget is presented as an overlay above the
768    /// content widget, otherwise they are displayed side by side.
769    /// ## `collapsed`
770    /// whether @self is collapsed
771    #[doc(alias = "adw_overlay_split_view_set_collapsed")]
772    #[doc(alias = "collapsed")]
773    pub fn set_collapsed(&self, collapsed: bool) {
774        unsafe {
775            ffi::adw_overlay_split_view_set_collapsed(self.to_glib_none().0, collapsed.into_glib());
776        }
777    }
778
779    /// Sets the content widget for @self.
780    /// ## `content`
781    /// the content widget
782    #[doc(alias = "adw_overlay_split_view_set_content")]
783    #[doc(alias = "content")]
784    pub fn set_content(&self, content: Option<&impl IsA<gtk::Widget>>) {
785        unsafe {
786            ffi::adw_overlay_split_view_set_content(
787                self.to_glib_none().0,
788                content.map(|p| p.as_ref()).to_glib_none().0,
789            );
790        }
791    }
792
793    /// Sets whether @self can be closed with a swipe gesture.
794    ///
795    /// Only touchscreen swipes are supported.
796    /// ## `enable_hide_gesture`
797    /// whether @self can be closed with a swipe gesture
798    #[doc(alias = "adw_overlay_split_view_set_enable_hide_gesture")]
799    #[doc(alias = "enable-hide-gesture")]
800    pub fn set_enable_hide_gesture(&self, enable_hide_gesture: bool) {
801        unsafe {
802            ffi::adw_overlay_split_view_set_enable_hide_gesture(
803                self.to_glib_none().0,
804                enable_hide_gesture.into_glib(),
805            );
806        }
807    }
808
809    /// Sets whether @self can be opened with an edge swipe gesture.
810    ///
811    /// Only touchscreen swipes are supported.
812    /// ## `enable_show_gesture`
813    /// whether @self can be opened with a swipe gesture
814    #[doc(alias = "adw_overlay_split_view_set_enable_show_gesture")]
815    #[doc(alias = "enable-show-gesture")]
816    pub fn set_enable_show_gesture(&self, enable_show_gesture: bool) {
817        unsafe {
818            ffi::adw_overlay_split_view_set_enable_show_gesture(
819                self.to_glib_none().0,
820                enable_show_gesture.into_glib(),
821            );
822        }
823    }
824
825    /// Sets the maximum sidebar width for @self.
826    ///
827    /// Maximum width is affected by [`sidebar-width-unit`][struct@crate::OverlaySplitView#sidebar-width-unit].
828    ///
829    /// The sidebar widget can still be allocated with larger width if its own
830    /// minimum width exceeds it.
831    /// ## `width`
832    /// the maximum width
833    #[doc(alias = "adw_overlay_split_view_set_max_sidebar_width")]
834    #[doc(alias = "max-sidebar-width")]
835    pub fn set_max_sidebar_width(&self, width: f64) {
836        unsafe {
837            ffi::adw_overlay_split_view_set_max_sidebar_width(self.to_glib_none().0, width);
838        }
839    }
840
841    /// Sets the minimum sidebar width for @self.
842    ///
843    /// Minimum width is affected by [`sidebar-width-unit`][struct@crate::OverlaySplitView#sidebar-width-unit].
844    ///
845    /// The sidebar widget can still be allocated with larger width if its own
846    /// minimum width exceeds it.
847    /// ## `width`
848    /// the minimum width
849    #[doc(alias = "adw_overlay_split_view_set_min_sidebar_width")]
850    #[doc(alias = "min-sidebar-width")]
851    pub fn set_min_sidebar_width(&self, width: f64) {
852        unsafe {
853            ffi::adw_overlay_split_view_set_min_sidebar_width(self.to_glib_none().0, width);
854        }
855    }
856
857    /// Sets whether the sidebar widget is pinned for @self.
858    ///
859    /// By default, collapsing @self automatically hides the sidebar widget, and
860    /// uncollapsing it shows the sidebar. If set to `TRUE`, sidebar visibility never
861    /// changes on its own.
862    /// ## `pin_sidebar`
863    /// whether to pin the sidebar widget
864    #[doc(alias = "adw_overlay_split_view_set_pin_sidebar")]
865    #[doc(alias = "pin-sidebar")]
866    pub fn set_pin_sidebar(&self, pin_sidebar: bool) {
867        unsafe {
868            ffi::adw_overlay_split_view_set_pin_sidebar(
869                self.to_glib_none().0,
870                pin_sidebar.into_glib(),
871            );
872        }
873    }
874
875    /// Sets whether the sidebar widget is shown for @self.
876    /// ## `show_sidebar`
877    /// whether to show the sidebar widget
878    #[doc(alias = "adw_overlay_split_view_set_show_sidebar")]
879    #[doc(alias = "show-sidebar")]
880    pub fn set_show_sidebar(&self, show_sidebar: bool) {
881        unsafe {
882            ffi::adw_overlay_split_view_set_show_sidebar(
883                self.to_glib_none().0,
884                show_sidebar.into_glib(),
885            );
886        }
887    }
888
889    /// Sets the sidebar widget for @self.
890    /// ## `sidebar`
891    /// the sidebar widget
892    #[doc(alias = "adw_overlay_split_view_set_sidebar")]
893    #[doc(alias = "sidebar")]
894    pub fn set_sidebar(&self, sidebar: Option<&impl IsA<gtk::Widget>>) {
895        unsafe {
896            ffi::adw_overlay_split_view_set_sidebar(
897                self.to_glib_none().0,
898                sidebar.map(|p| p.as_ref()).to_glib_none().0,
899            );
900        }
901    }
902
903    /// Sets the sidebar position for @self.
904    ///
905    /// If it's set to [enum@Gtk.PackType.start], the sidebar is displayed before the
906    /// content; if [enum@Gtk.PackType.end], it's displayed after the content.
907    /// ## `position`
908    /// the new position
909    #[doc(alias = "adw_overlay_split_view_set_sidebar_position")]
910    #[doc(alias = "sidebar-position")]
911    pub fn set_sidebar_position(&self, position: gtk::PackType) {
912        unsafe {
913            ffi::adw_overlay_split_view_set_sidebar_position(
914                self.to_glib_none().0,
915                position.into_glib(),
916            );
917        }
918    }
919
920    /// Sets the preferred sidebar width as a fraction of the total width of @self.
921    ///
922    /// The preferred width is additionally limited by
923    /// [`min-sidebar-width`][struct@crate::OverlaySplitView#min-sidebar-width] and
924    /// [`max-sidebar-width`][struct@crate::OverlaySplitView#max-sidebar-width].
925    ///
926    /// The sidebar widget can be allocated with larger width if its own minimum
927    /// width exceeds the preferred width.
928    /// ## `fraction`
929    /// the preferred width fraction
930    #[doc(alias = "adw_overlay_split_view_set_sidebar_width_fraction")]
931    #[doc(alias = "sidebar-width-fraction")]
932    pub fn set_sidebar_width_fraction(&self, fraction: f64) {
933        unsafe {
934            ffi::adw_overlay_split_view_set_sidebar_width_fraction(self.to_glib_none().0, fraction);
935        }
936    }
937
938    /// Sets the length unit for minimum and maximum sidebar widths.
939    ///
940    /// See [`min-sidebar-width`][struct@crate::OverlaySplitView#min-sidebar-width] and
941    /// [`max-sidebar-width`][struct@crate::OverlaySplitView#max-sidebar-width].
942    /// ## `unit`
943    /// the length unit
944    #[doc(alias = "adw_overlay_split_view_set_sidebar_width_unit")]
945    #[doc(alias = "sidebar-width-unit")]
946    pub fn set_sidebar_width_unit(&self, unit: LengthUnit) {
947        unsafe {
948            ffi::adw_overlay_split_view_set_sidebar_width_unit(
949                self.to_glib_none().0,
950                unit.into_glib(),
951            );
952        }
953    }
954
955    #[cfg(feature = "v1_4")]
956    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
957    #[doc(alias = "collapsed")]
958    pub fn connect_collapsed_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
959        unsafe extern "C" fn notify_collapsed_trampoline<F: Fn(&OverlaySplitView) + 'static>(
960            this: *mut ffi::AdwOverlaySplitView,
961            _param_spec: glib::ffi::gpointer,
962            f: glib::ffi::gpointer,
963        ) {
964            unsafe {
965                let f: &F = &*(f as *const F);
966                f(&from_glib_borrow(this))
967            }
968        }
969        unsafe {
970            let f: Box_<F> = Box_::new(f);
971            connect_raw(
972                self.as_ptr() as *mut _,
973                c"notify::collapsed".as_ptr(),
974                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
975                    notify_collapsed_trampoline::<F> as *const (),
976                )),
977                Box_::into_raw(f),
978            )
979        }
980    }
981
982    #[cfg(feature = "v1_4")]
983    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
984    #[doc(alias = "content")]
985    pub fn connect_content_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
986        unsafe extern "C" fn notify_content_trampoline<F: Fn(&OverlaySplitView) + 'static>(
987            this: *mut ffi::AdwOverlaySplitView,
988            _param_spec: glib::ffi::gpointer,
989            f: glib::ffi::gpointer,
990        ) {
991            unsafe {
992                let f: &F = &*(f as *const F);
993                f(&from_glib_borrow(this))
994            }
995        }
996        unsafe {
997            let f: Box_<F> = Box_::new(f);
998            connect_raw(
999                self.as_ptr() as *mut _,
1000                c"notify::content".as_ptr(),
1001                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1002                    notify_content_trampoline::<F> as *const (),
1003                )),
1004                Box_::into_raw(f),
1005            )
1006        }
1007    }
1008
1009    #[cfg(feature = "v1_4")]
1010    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1011    #[doc(alias = "enable-hide-gesture")]
1012    pub fn connect_enable_hide_gesture_notify<F: Fn(&Self) + 'static>(
1013        &self,
1014        f: F,
1015    ) -> SignalHandlerId {
1016        unsafe extern "C" fn notify_enable_hide_gesture_trampoline<
1017            F: Fn(&OverlaySplitView) + 'static,
1018        >(
1019            this: *mut ffi::AdwOverlaySplitView,
1020            _param_spec: glib::ffi::gpointer,
1021            f: glib::ffi::gpointer,
1022        ) {
1023            unsafe {
1024                let f: &F = &*(f as *const F);
1025                f(&from_glib_borrow(this))
1026            }
1027        }
1028        unsafe {
1029            let f: Box_<F> = Box_::new(f);
1030            connect_raw(
1031                self.as_ptr() as *mut _,
1032                c"notify::enable-hide-gesture".as_ptr(),
1033                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1034                    notify_enable_hide_gesture_trampoline::<F> as *const (),
1035                )),
1036                Box_::into_raw(f),
1037            )
1038        }
1039    }
1040
1041    #[cfg(feature = "v1_4")]
1042    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1043    #[doc(alias = "enable-show-gesture")]
1044    pub fn connect_enable_show_gesture_notify<F: Fn(&Self) + 'static>(
1045        &self,
1046        f: F,
1047    ) -> SignalHandlerId {
1048        unsafe extern "C" fn notify_enable_show_gesture_trampoline<
1049            F: Fn(&OverlaySplitView) + 'static,
1050        >(
1051            this: *mut ffi::AdwOverlaySplitView,
1052            _param_spec: glib::ffi::gpointer,
1053            f: glib::ffi::gpointer,
1054        ) {
1055            unsafe {
1056                let f: &F = &*(f as *const F);
1057                f(&from_glib_borrow(this))
1058            }
1059        }
1060        unsafe {
1061            let f: Box_<F> = Box_::new(f);
1062            connect_raw(
1063                self.as_ptr() as *mut _,
1064                c"notify::enable-show-gesture".as_ptr(),
1065                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1066                    notify_enable_show_gesture_trampoline::<F> as *const (),
1067                )),
1068                Box_::into_raw(f),
1069            )
1070        }
1071    }
1072
1073    #[cfg(feature = "v1_4")]
1074    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1075    #[doc(alias = "max-sidebar-width")]
1076    pub fn connect_max_sidebar_width_notify<F: Fn(&Self) + 'static>(
1077        &self,
1078        f: F,
1079    ) -> SignalHandlerId {
1080        unsafe extern "C" fn notify_max_sidebar_width_trampoline<
1081            F: Fn(&OverlaySplitView) + 'static,
1082        >(
1083            this: *mut ffi::AdwOverlaySplitView,
1084            _param_spec: glib::ffi::gpointer,
1085            f: glib::ffi::gpointer,
1086        ) {
1087            unsafe {
1088                let f: &F = &*(f as *const F);
1089                f(&from_glib_borrow(this))
1090            }
1091        }
1092        unsafe {
1093            let f: Box_<F> = Box_::new(f);
1094            connect_raw(
1095                self.as_ptr() as *mut _,
1096                c"notify::max-sidebar-width".as_ptr(),
1097                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1098                    notify_max_sidebar_width_trampoline::<F> as *const (),
1099                )),
1100                Box_::into_raw(f),
1101            )
1102        }
1103    }
1104
1105    #[cfg(feature = "v1_4")]
1106    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1107    #[doc(alias = "min-sidebar-width")]
1108    pub fn connect_min_sidebar_width_notify<F: Fn(&Self) + 'static>(
1109        &self,
1110        f: F,
1111    ) -> SignalHandlerId {
1112        unsafe extern "C" fn notify_min_sidebar_width_trampoline<
1113            F: Fn(&OverlaySplitView) + 'static,
1114        >(
1115            this: *mut ffi::AdwOverlaySplitView,
1116            _param_spec: glib::ffi::gpointer,
1117            f: glib::ffi::gpointer,
1118        ) {
1119            unsafe {
1120                let f: &F = &*(f as *const F);
1121                f(&from_glib_borrow(this))
1122            }
1123        }
1124        unsafe {
1125            let f: Box_<F> = Box_::new(f);
1126            connect_raw(
1127                self.as_ptr() as *mut _,
1128                c"notify::min-sidebar-width".as_ptr(),
1129                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1130                    notify_min_sidebar_width_trampoline::<F> as *const (),
1131                )),
1132                Box_::into_raw(f),
1133            )
1134        }
1135    }
1136
1137    #[cfg(feature = "v1_4")]
1138    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1139    #[doc(alias = "pin-sidebar")]
1140    pub fn connect_pin_sidebar_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1141        unsafe extern "C" fn notify_pin_sidebar_trampoline<F: Fn(&OverlaySplitView) + 'static>(
1142            this: *mut ffi::AdwOverlaySplitView,
1143            _param_spec: glib::ffi::gpointer,
1144            f: glib::ffi::gpointer,
1145        ) {
1146            unsafe {
1147                let f: &F = &*(f as *const F);
1148                f(&from_glib_borrow(this))
1149            }
1150        }
1151        unsafe {
1152            let f: Box_<F> = Box_::new(f);
1153            connect_raw(
1154                self.as_ptr() as *mut _,
1155                c"notify::pin-sidebar".as_ptr(),
1156                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1157                    notify_pin_sidebar_trampoline::<F> as *const (),
1158                )),
1159                Box_::into_raw(f),
1160            )
1161        }
1162    }
1163
1164    #[cfg(feature = "v1_4")]
1165    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1166    #[doc(alias = "show-sidebar")]
1167    pub fn connect_show_sidebar_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1168        unsafe extern "C" fn notify_show_sidebar_trampoline<F: Fn(&OverlaySplitView) + 'static>(
1169            this: *mut ffi::AdwOverlaySplitView,
1170            _param_spec: glib::ffi::gpointer,
1171            f: glib::ffi::gpointer,
1172        ) {
1173            unsafe {
1174                let f: &F = &*(f as *const F);
1175                f(&from_glib_borrow(this))
1176            }
1177        }
1178        unsafe {
1179            let f: Box_<F> = Box_::new(f);
1180            connect_raw(
1181                self.as_ptr() as *mut _,
1182                c"notify::show-sidebar".as_ptr(),
1183                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1184                    notify_show_sidebar_trampoline::<F> as *const (),
1185                )),
1186                Box_::into_raw(f),
1187            )
1188        }
1189    }
1190
1191    #[cfg(feature = "v1_4")]
1192    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1193    #[doc(alias = "sidebar")]
1194    pub fn connect_sidebar_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1195        unsafe extern "C" fn notify_sidebar_trampoline<F: Fn(&OverlaySplitView) + 'static>(
1196            this: *mut ffi::AdwOverlaySplitView,
1197            _param_spec: glib::ffi::gpointer,
1198            f: glib::ffi::gpointer,
1199        ) {
1200            unsafe {
1201                let f: &F = &*(f as *const F);
1202                f(&from_glib_borrow(this))
1203            }
1204        }
1205        unsafe {
1206            let f: Box_<F> = Box_::new(f);
1207            connect_raw(
1208                self.as_ptr() as *mut _,
1209                c"notify::sidebar".as_ptr(),
1210                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1211                    notify_sidebar_trampoline::<F> as *const (),
1212                )),
1213                Box_::into_raw(f),
1214            )
1215        }
1216    }
1217
1218    #[cfg(feature = "v1_4")]
1219    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1220    #[doc(alias = "sidebar-position")]
1221    pub fn connect_sidebar_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1222        unsafe extern "C" fn notify_sidebar_position_trampoline<
1223            F: Fn(&OverlaySplitView) + 'static,
1224        >(
1225            this: *mut ffi::AdwOverlaySplitView,
1226            _param_spec: glib::ffi::gpointer,
1227            f: glib::ffi::gpointer,
1228        ) {
1229            unsafe {
1230                let f: &F = &*(f as *const F);
1231                f(&from_glib_borrow(this))
1232            }
1233        }
1234        unsafe {
1235            let f: Box_<F> = Box_::new(f);
1236            connect_raw(
1237                self.as_ptr() as *mut _,
1238                c"notify::sidebar-position".as_ptr(),
1239                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1240                    notify_sidebar_position_trampoline::<F> as *const (),
1241                )),
1242                Box_::into_raw(f),
1243            )
1244        }
1245    }
1246
1247    #[cfg(feature = "v1_4")]
1248    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1249    #[doc(alias = "sidebar-width-fraction")]
1250    pub fn connect_sidebar_width_fraction_notify<F: Fn(&Self) + 'static>(
1251        &self,
1252        f: F,
1253    ) -> SignalHandlerId {
1254        unsafe extern "C" fn notify_sidebar_width_fraction_trampoline<
1255            F: Fn(&OverlaySplitView) + 'static,
1256        >(
1257            this: *mut ffi::AdwOverlaySplitView,
1258            _param_spec: glib::ffi::gpointer,
1259            f: glib::ffi::gpointer,
1260        ) {
1261            unsafe {
1262                let f: &F = &*(f as *const F);
1263                f(&from_glib_borrow(this))
1264            }
1265        }
1266        unsafe {
1267            let f: Box_<F> = Box_::new(f);
1268            connect_raw(
1269                self.as_ptr() as *mut _,
1270                c"notify::sidebar-width-fraction".as_ptr(),
1271                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1272                    notify_sidebar_width_fraction_trampoline::<F> as *const (),
1273                )),
1274                Box_::into_raw(f),
1275            )
1276        }
1277    }
1278
1279    #[cfg(feature = "v1_4")]
1280    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1281    #[doc(alias = "sidebar-width-unit")]
1282    pub fn connect_sidebar_width_unit_notify<F: Fn(&Self) + 'static>(
1283        &self,
1284        f: F,
1285    ) -> SignalHandlerId {
1286        unsafe extern "C" fn notify_sidebar_width_unit_trampoline<
1287            F: Fn(&OverlaySplitView) + 'static,
1288        >(
1289            this: *mut ffi::AdwOverlaySplitView,
1290            _param_spec: glib::ffi::gpointer,
1291            f: glib::ffi::gpointer,
1292        ) {
1293            unsafe {
1294                let f: &F = &*(f as *const F);
1295                f(&from_glib_borrow(this))
1296            }
1297        }
1298        unsafe {
1299            let f: Box_<F> = Box_::new(f);
1300            connect_raw(
1301                self.as_ptr() as *mut _,
1302                c"notify::sidebar-width-unit".as_ptr(),
1303                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1304                    notify_sidebar_width_unit_trampoline::<F> as *const (),
1305                )),
1306                Box_::into_raw(f),
1307            )
1308        }
1309    }
1310}
1311
1312#[cfg(feature = "v1_4")]
1313#[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1314impl Default for OverlaySplitView {
1315    fn default() -> Self {
1316        Self::new()
1317    }
1318}
1319
1320// rustdoc-stripper-ignore-next
1321/// A [builder-pattern] type to construct [`OverlaySplitView`] objects.
1322///
1323/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1324#[must_use = "The builder must be built to be used"]
1325pub struct OverlaySplitViewBuilder {
1326    builder: glib::object::ObjectBuilder<'static, OverlaySplitView>,
1327}
1328
1329impl OverlaySplitViewBuilder {
1330    fn new() -> Self {
1331        Self {
1332            builder: glib::object::Object::builder(),
1333        }
1334    }
1335
1336    /// Whether the split view is collapsed.
1337    ///
1338    /// When collapsed, the sidebar widget is presented as an overlay above the
1339    /// content widget, otherwise they are displayed side by side.
1340    #[cfg(feature = "v1_4")]
1341    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1342    pub fn collapsed(self, collapsed: bool) -> Self {
1343        Self {
1344            builder: self.builder.property("collapsed", collapsed),
1345        }
1346    }
1347
1348    /// The content widget.
1349    #[cfg(feature = "v1_4")]
1350    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1351    pub fn content(self, content: &impl IsA<gtk::Widget>) -> Self {
1352        Self {
1353            builder: self.builder.property("content", content.clone().upcast()),
1354        }
1355    }
1356
1357    /// Whether the sidebar can be closed with a swipe gesture.
1358    ///
1359    /// Only touchscreen swipes are supported.
1360    #[cfg(feature = "v1_4")]
1361    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1362    pub fn enable_hide_gesture(self, enable_hide_gesture: bool) -> Self {
1363        Self {
1364            builder: self
1365                .builder
1366                .property("enable-hide-gesture", enable_hide_gesture),
1367        }
1368    }
1369
1370    /// Whether the sidebar can be opened with an edge swipe gesture.
1371    ///
1372    /// Only touchscreen swipes are supported.
1373    #[cfg(feature = "v1_4")]
1374    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1375    pub fn enable_show_gesture(self, enable_show_gesture: bool) -> Self {
1376        Self {
1377            builder: self
1378                .builder
1379                .property("enable-show-gesture", enable_show_gesture),
1380        }
1381    }
1382
1383    /// The maximum sidebar width.
1384    ///
1385    /// Maximum width is affected by
1386    /// [`sidebar-width-unit`][struct@crate::OverlaySplitView#sidebar-width-unit].
1387    ///
1388    /// The sidebar widget can still be allocated with larger width if its own
1389    /// minimum width exceeds it.
1390    #[cfg(feature = "v1_4")]
1391    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1392    pub fn max_sidebar_width(self, max_sidebar_width: f64) -> Self {
1393        Self {
1394            builder: self
1395                .builder
1396                .property("max-sidebar-width", max_sidebar_width),
1397        }
1398    }
1399
1400    /// The minimum sidebar width.
1401    ///
1402    /// Minimum width is affected by
1403    /// [`sidebar-width-unit`][struct@crate::OverlaySplitView#sidebar-width-unit].
1404    ///
1405    /// The sidebar widget can still be allocated with larger width if its own
1406    /// minimum width exceeds it.
1407    #[cfg(feature = "v1_4")]
1408    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1409    pub fn min_sidebar_width(self, min_sidebar_width: f64) -> Self {
1410        Self {
1411            builder: self
1412                .builder
1413                .property("min-sidebar-width", min_sidebar_width),
1414        }
1415    }
1416
1417    /// Whether the sidebar widget is pinned.
1418    ///
1419    /// By default, collapsing @self_ automatically hides the sidebar widget, and
1420    /// uncollapsing it shows the sidebar. If set to `TRUE`, sidebar visibility
1421    /// never changes on its own.
1422    #[cfg(feature = "v1_4")]
1423    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1424    pub fn pin_sidebar(self, pin_sidebar: bool) -> Self {
1425        Self {
1426            builder: self.builder.property("pin-sidebar", pin_sidebar),
1427        }
1428    }
1429
1430    /// Whether the sidebar widget is shown.
1431    #[cfg(feature = "v1_4")]
1432    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1433    pub fn show_sidebar(self, show_sidebar: bool) -> Self {
1434        Self {
1435            builder: self.builder.property("show-sidebar", show_sidebar),
1436        }
1437    }
1438
1439    /// The sidebar widget.
1440    #[cfg(feature = "v1_4")]
1441    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1442    pub fn sidebar(self, sidebar: &impl IsA<gtk::Widget>) -> Self {
1443        Self {
1444            builder: self.builder.property("sidebar", sidebar.clone().upcast()),
1445        }
1446    }
1447
1448    /// The sidebar position.
1449    ///
1450    /// If it's set to [enum@Gtk.PackType.start], the sidebar is displayed before
1451    /// the content; if [enum@Gtk.PackType.end], it's displayed after the content.
1452    #[cfg(feature = "v1_4")]
1453    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1454    pub fn sidebar_position(self, sidebar_position: gtk::PackType) -> Self {
1455        Self {
1456            builder: self.builder.property("sidebar-position", sidebar_position),
1457        }
1458    }
1459
1460    /// The preferred sidebar width as a fraction of the total width.
1461    ///
1462    /// The preferred width is additionally limited by
1463    /// [`min-sidebar-width`][struct@crate::OverlaySplitView#min-sidebar-width] and
1464    /// [`max-sidebar-width`][struct@crate::OverlaySplitView#max-sidebar-width].
1465    ///
1466    /// The sidebar widget can be allocated with larger width if its own minimum
1467    /// width exceeds the preferred width.
1468    #[cfg(feature = "v1_4")]
1469    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1470    pub fn sidebar_width_fraction(self, sidebar_width_fraction: f64) -> Self {
1471        Self {
1472            builder: self
1473                .builder
1474                .property("sidebar-width-fraction", sidebar_width_fraction),
1475        }
1476    }
1477
1478    /// The length unit for minimum and maximum sidebar widths.
1479    ///
1480    /// See [`min-sidebar-width`][struct@crate::OverlaySplitView#min-sidebar-width] and
1481    /// [`max-sidebar-width`][struct@crate::OverlaySplitView#max-sidebar-width].
1482    #[cfg(feature = "v1_4")]
1483    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1484    pub fn sidebar_width_unit(self, sidebar_width_unit: LengthUnit) -> Self {
1485        Self {
1486            builder: self
1487                .builder
1488                .property("sidebar-width-unit", sidebar_width_unit),
1489        }
1490    }
1491
1492    /// Whether the widget or any of its descendents can accept
1493    /// the input focus.
1494    ///
1495    /// This property is meant to be set by widget implementations,
1496    /// typically in their instance init function.
1497    pub fn can_focus(self, can_focus: bool) -> Self {
1498        Self {
1499            builder: self.builder.property("can-focus", can_focus),
1500        }
1501    }
1502
1503    /// Whether the widget can receive pointer events.
1504    pub fn can_target(self, can_target: bool) -> Self {
1505        Self {
1506            builder: self.builder.property("can-target", can_target),
1507        }
1508    }
1509
1510    /// A list of css classes applied to this widget.
1511    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1512        Self {
1513            builder: self.builder.property("css-classes", css_classes.into()),
1514        }
1515    }
1516
1517    /// The name of this widget in the CSS tree.
1518    ///
1519    /// This property is meant to be set by widget implementations,
1520    /// typically in their instance init function.
1521    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1522        Self {
1523            builder: self.builder.property("css-name", css_name.into()),
1524        }
1525    }
1526
1527    /// The cursor used by @widget.
1528    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1529        Self {
1530            builder: self.builder.property("cursor", cursor.clone()),
1531        }
1532    }
1533
1534    /// Whether the widget should grab focus when it is clicked with the mouse.
1535    ///
1536    /// This property is only relevant for widgets that can take focus.
1537    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1538        Self {
1539            builder: self.builder.property("focus-on-click", focus_on_click),
1540        }
1541    }
1542
1543    /// Whether this widget itself will accept the input focus.
1544    pub fn focusable(self, focusable: bool) -> Self {
1545        Self {
1546            builder: self.builder.property("focusable", focusable),
1547        }
1548    }
1549
1550    /// How to distribute horizontal space if widget gets extra space.
1551    pub fn halign(self, halign: gtk::Align) -> Self {
1552        Self {
1553            builder: self.builder.property("halign", halign),
1554        }
1555    }
1556
1557    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
1558    /// signal on @widget.
1559    ///
1560    /// A true value indicates that @widget can have a tooltip, in this case
1561    /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
1562    /// determine whether it will provide a tooltip or not.
1563    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1564        Self {
1565            builder: self.builder.property("has-tooltip", has_tooltip),
1566        }
1567    }
1568
1569    /// Overrides for height request of the widget.
1570    ///
1571    /// If this is -1, the natural request will be used.
1572    pub fn height_request(self, height_request: i32) -> Self {
1573        Self {
1574            builder: self.builder.property("height-request", height_request),
1575        }
1576    }
1577
1578    /// Whether to expand horizontally.
1579    pub fn hexpand(self, hexpand: bool) -> Self {
1580        Self {
1581            builder: self.builder.property("hexpand", hexpand),
1582        }
1583    }
1584
1585    /// Whether to use the `hexpand` property.
1586    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1587        Self {
1588            builder: self.builder.property("hexpand-set", hexpand_set),
1589        }
1590    }
1591
1592    /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
1593    /// the preferred size of the widget, and allocate its children.
1594    ///
1595    /// This property is meant to be set by widget implementations,
1596    /// typically in their instance init function.
1597    pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
1598        Self {
1599            builder: self
1600                .builder
1601                .property("layout-manager", layout_manager.clone().upcast()),
1602        }
1603    }
1604
1605    /// Makes this widget act like a modal dialog, with respect to
1606    /// event delivery.
1607    ///
1608    /// Global event controllers will not handle events with targets
1609    /// inside the widget, unless they are set up to ignore propagation
1610    /// limits. See `Gtk::EventController::set_propagation_limit()`.
1611    #[cfg(feature = "gtk_v4_18")]
1612    #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
1613    pub fn limit_events(self, limit_events: bool) -> Self {
1614        Self {
1615            builder: self.builder.property("limit-events", limit_events),
1616        }
1617    }
1618
1619    /// Margin on bottom side of widget.
1620    ///
1621    /// This property adds margin outside of the widget's normal size
1622    /// request, the margin will be added in addition to the size from
1623    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1624    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1625        Self {
1626            builder: self.builder.property("margin-bottom", margin_bottom),
1627        }
1628    }
1629
1630    /// Margin on end of widget, horizontally.
1631    ///
1632    /// This property supports left-to-right and right-to-left text
1633    /// directions.
1634    ///
1635    /// This property adds margin outside of the widget's normal size
1636    /// request, the margin will be added in addition to the size from
1637    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1638    pub fn margin_end(self, margin_end: i32) -> Self {
1639        Self {
1640            builder: self.builder.property("margin-end", margin_end),
1641        }
1642    }
1643
1644    /// Margin on start of widget, horizontally.
1645    ///
1646    /// This property supports left-to-right and right-to-left text
1647    /// directions.
1648    ///
1649    /// This property adds margin outside of the widget's normal size
1650    /// request, the margin will be added in addition to the size from
1651    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1652    pub fn margin_start(self, margin_start: i32) -> Self {
1653        Self {
1654            builder: self.builder.property("margin-start", margin_start),
1655        }
1656    }
1657
1658    /// Margin on top side of widget.
1659    ///
1660    /// This property adds margin outside of the widget's normal size
1661    /// request, the margin will be added in addition to the size from
1662    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1663    pub fn margin_top(self, margin_top: i32) -> Self {
1664        Self {
1665            builder: self.builder.property("margin-top", margin_top),
1666        }
1667    }
1668
1669    /// The name of the widget.
1670    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1671        Self {
1672            builder: self.builder.property("name", name.into()),
1673        }
1674    }
1675
1676    /// The requested opacity of the widget.
1677    pub fn opacity(self, opacity: f64) -> Self {
1678        Self {
1679            builder: self.builder.property("opacity", opacity),
1680        }
1681    }
1682
1683    /// How content outside the widget's content area is treated.
1684    ///
1685    /// This property is meant to be set by widget implementations,
1686    /// typically in their instance init function.
1687    pub fn overflow(self, overflow: gtk::Overflow) -> Self {
1688        Self {
1689            builder: self.builder.property("overflow", overflow),
1690        }
1691    }
1692
1693    /// Whether the widget will receive the default action when it is focused.
1694    pub fn receives_default(self, receives_default: bool) -> Self {
1695        Self {
1696            builder: self.builder.property("receives-default", receives_default),
1697        }
1698    }
1699
1700    /// Whether the widget responds to input.
1701    pub fn sensitive(self, sensitive: bool) -> Self {
1702        Self {
1703            builder: self.builder.property("sensitive", sensitive),
1704        }
1705    }
1706
1707    /// Sets the text of tooltip to be the given string, which is marked up
1708    /// with Pango markup.
1709    ///
1710    /// Also see `Gtk::Tooltip::set_markup()`.
1711    ///
1712    /// This is a convenience property which will take care of getting the
1713    /// tooltip shown if the given string is not `NULL`:
1714    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
1715    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
1716    /// the default signal handler.
1717    ///
1718    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
1719    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
1720    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1721        Self {
1722            builder: self
1723                .builder
1724                .property("tooltip-markup", tooltip_markup.into()),
1725        }
1726    }
1727
1728    /// Sets the text of tooltip to be the given string.
1729    ///
1730    /// Also see `Gtk::Tooltip::set_text()`.
1731    ///
1732    /// This is a convenience property which will take care of getting the
1733    /// tooltip shown if the given string is not `NULL`:
1734    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
1735    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
1736    /// the default signal handler.
1737    ///
1738    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
1739    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
1740    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1741        Self {
1742            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1743        }
1744    }
1745
1746    /// How to distribute vertical space if widget gets extra space.
1747    pub fn valign(self, valign: gtk::Align) -> Self {
1748        Self {
1749            builder: self.builder.property("valign", valign),
1750        }
1751    }
1752
1753    /// Whether to expand vertically.
1754    pub fn vexpand(self, vexpand: bool) -> Self {
1755        Self {
1756            builder: self.builder.property("vexpand", vexpand),
1757        }
1758    }
1759
1760    /// Whether to use the `vexpand` property.
1761    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1762        Self {
1763            builder: self.builder.property("vexpand-set", vexpand_set),
1764        }
1765    }
1766
1767    /// Whether the widget is visible.
1768    pub fn visible(self, visible: bool) -> Self {
1769        Self {
1770            builder: self.builder.property("visible", visible),
1771        }
1772    }
1773
1774    /// Overrides for width request of the widget.
1775    ///
1776    /// If this is -1, the natural request will be used.
1777    pub fn width_request(self, width_request: i32) -> Self {
1778        Self {
1779            builder: self.builder.property("width-request", width_request),
1780        }
1781    }
1782
1783    /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
1784    ///
1785    /// The accessible role cannot be changed once set.
1786    pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
1787        Self {
1788            builder: self.builder.property("accessible-role", accessible_role),
1789        }
1790    }
1791
1792    // rustdoc-stripper-ignore-next
1793    /// Build the [`OverlaySplitView`].
1794    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1795    pub fn build(self) -> OverlaySplitView {
1796        assert_initialized_main_thread!();
1797        self.builder.build()
1798    }
1799}