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