Skip to main content

libadwaita/auto/
leaflet_page.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#![allow(deprecated)]
6
7use crate::ffi;
8use glib::{
9    prelude::*,
10    signal::{SignalHandlerId, connect_raw},
11    translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16    /// See [the migration guide](migrating-to-breakpoints.html#replace-adwleaflet)
17    /// An auxiliary class used by [`Leaflet`][crate::Leaflet].
18    ///
19    /// ## Properties
20    ///
21    ///
22    /// #### `child`
23    ///  The leaflet child to which the page belongs.
24    ///
25    /// Readable | Writeable | Construct Only
26    ///
27    ///
28    /// #### `name`
29    ///  The name of the child page.
30    ///
31    /// Readable | Writeable
32    ///
33    ///
34    /// #### `navigatable`
35    ///  Whether the child can be navigated to when folded.
36    ///
37    /// If `FALSE`, the child will be ignored by
38    /// [`Leaflet::adjacent_child()`][crate::Leaflet::adjacent_child()], [`Leaflet::navigate()`][crate::Leaflet::navigate()], and swipe
39    /// gestures.
40    ///
41    /// This can be used used to prevent switching to widgets like separators.
42    ///
43    /// Readable | Writeable
44    ///
45    /// # Implements
46    ///
47    /// [`trait@glib::ObjectExt`]
48    #[doc(alias = "AdwLeafletPage")]
49    pub struct LeafletPage(Object<ffi::AdwLeafletPage, ffi::AdwLeafletPageClass>);
50
51    match fn {
52        type_ => || ffi::adw_leaflet_page_get_type(),
53    }
54}
55
56impl LeafletPage {
57    /// Gets the leaflet child to which @self belongs.
58    ///
59    /// # Deprecated since 1.4
60    ///
61    /// See [the migration guide](migrating-to-breakpoints.html#replace-adwleaflet)
62    ///
63    /// # Returns
64    ///
65    /// the child to which @self belongs
66    #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
67    #[allow(deprecated)]
68    #[doc(alias = "adw_leaflet_page_get_child")]
69    #[doc(alias = "get_child")]
70    pub fn child(&self) -> gtk::Widget {
71        unsafe { from_glib_none(ffi::adw_leaflet_page_get_child(self.to_glib_none().0)) }
72    }
73
74    /// Gets the name of @self.
75    ///
76    /// # Deprecated since 1.4
77    ///
78    /// See [the migration guide](migrating-to-breakpoints.html#replace-adwleaflet)
79    ///
80    /// # Returns
81    ///
82    /// the name of @self.
83    #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
84    #[allow(deprecated)]
85    #[doc(alias = "adw_leaflet_page_get_name")]
86    #[doc(alias = "get_name")]
87    pub fn name(&self) -> Option<glib::GString> {
88        unsafe { from_glib_none(ffi::adw_leaflet_page_get_name(self.to_glib_none().0)) }
89    }
90
91    /// Gets whether the child can be navigated to when folded.
92    ///
93    /// # Deprecated since 1.4
94    ///
95    /// See [the migration guide](migrating-to-breakpoints.html#replace-adwleaflet)
96    ///
97    /// # Returns
98    ///
99    /// whether @self can be navigated to when folded
100    #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
101    #[allow(deprecated)]
102    #[doc(alias = "adw_leaflet_page_get_navigatable")]
103    #[doc(alias = "get_navigatable")]
104    #[doc(alias = "navigatable")]
105    pub fn is_navigatable(&self) -> bool {
106        unsafe { from_glib(ffi::adw_leaflet_page_get_navigatable(self.to_glib_none().0)) }
107    }
108
109    /// Sets the name of the @self.
110    ///
111    /// # Deprecated since 1.4
112    ///
113    /// See [the migration guide](migrating-to-breakpoints.html#replace-adwleaflet)
114    /// ## `name`
115    /// the new value to set
116    #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
117    #[allow(deprecated)]
118    #[doc(alias = "adw_leaflet_page_set_name")]
119    #[doc(alias = "name")]
120    pub fn set_name(&self, name: Option<&str>) {
121        unsafe {
122            ffi::adw_leaflet_page_set_name(self.to_glib_none().0, name.to_glib_none().0);
123        }
124    }
125
126    /// Sets whether @self can be navigated to when folded.
127    ///
128    /// If `FALSE`, the child will be ignored by [`Leaflet::adjacent_child()`][crate::Leaflet::adjacent_child()],
129    /// [`Leaflet::navigate()`][crate::Leaflet::navigate()], and swipe gestures.
130    ///
131    /// This can be used used to prevent switching to widgets like separators.
132    ///
133    /// # Deprecated since 1.4
134    ///
135    /// See [the migration guide](migrating-to-breakpoints.html#replace-adwleaflet)
136    /// ## `navigatable`
137    /// whether @self can be navigated to when folded
138    #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
139    #[allow(deprecated)]
140    #[doc(alias = "adw_leaflet_page_set_navigatable")]
141    #[doc(alias = "navigatable")]
142    pub fn set_navigatable(&self, navigatable: bool) {
143        unsafe {
144            ffi::adw_leaflet_page_set_navigatable(self.to_glib_none().0, navigatable.into_glib());
145        }
146    }
147
148    #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
149    #[doc(alias = "name")]
150    pub fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
151        unsafe extern "C" fn notify_name_trampoline<F: Fn(&LeafletPage) + 'static>(
152            this: *mut ffi::AdwLeafletPage,
153            _param_spec: glib::ffi::gpointer,
154            f: glib::ffi::gpointer,
155        ) {
156            unsafe {
157                let f: &F = &*(f as *const F);
158                f(&from_glib_borrow(this))
159            }
160        }
161        unsafe {
162            let f: Box_<F> = Box_::new(f);
163            connect_raw(
164                self.as_ptr() as *mut _,
165                c"notify::name".as_ptr(),
166                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
167                    notify_name_trampoline::<F> as *const (),
168                )),
169                Box_::into_raw(f),
170            )
171        }
172    }
173
174    #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
175    #[doc(alias = "navigatable")]
176    pub fn connect_navigatable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
177        unsafe extern "C" fn notify_navigatable_trampoline<F: Fn(&LeafletPage) + 'static>(
178            this: *mut ffi::AdwLeafletPage,
179            _param_spec: glib::ffi::gpointer,
180            f: glib::ffi::gpointer,
181        ) {
182            unsafe {
183                let f: &F = &*(f as *const F);
184                f(&from_glib_borrow(this))
185            }
186        }
187        unsafe {
188            let f: Box_<F> = Box_::new(f);
189            connect_raw(
190                self.as_ptr() as *mut _,
191                c"notify::navigatable".as_ptr(),
192                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
193                    notify_navigatable_trampoline::<F> as *const (),
194                )),
195                Box_::into_raw(f),
196            )
197        }
198    }
199}