libadwaita/auto/
leaflet_page.rs1#![allow(deprecated)]
6
7use crate::ffi;
8use glib::{
9 prelude::*,
10 signal::{connect_raw, SignalHandlerId},
11 translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16 #[doc(alias = "AdwLeafletPage")]
17 pub struct LeafletPage(Object<ffi::AdwLeafletPage, ffi::AdwLeafletPageClass>);
18
19 match fn {
20 type_ => || ffi::adw_leaflet_page_get_type(),
21 }
22}
23
24impl LeafletPage {
25 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
26 #[allow(deprecated)]
27 #[doc(alias = "adw_leaflet_page_get_child")]
28 #[doc(alias = "get_child")]
29 pub fn child(&self) -> gtk::Widget {
30 unsafe { from_glib_none(ffi::adw_leaflet_page_get_child(self.to_glib_none().0)) }
31 }
32
33 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
34 #[allow(deprecated)]
35 #[doc(alias = "adw_leaflet_page_get_name")]
36 #[doc(alias = "get_name")]
37 pub fn name(&self) -> Option<glib::GString> {
38 unsafe { from_glib_none(ffi::adw_leaflet_page_get_name(self.to_glib_none().0)) }
39 }
40
41 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
42 #[allow(deprecated)]
43 #[doc(alias = "adw_leaflet_page_get_navigatable")]
44 #[doc(alias = "get_navigatable")]
45 #[doc(alias = "navigatable")]
46 pub fn is_navigatable(&self) -> bool {
47 unsafe { from_glib(ffi::adw_leaflet_page_get_navigatable(self.to_glib_none().0)) }
48 }
49
50 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
51 #[allow(deprecated)]
52 #[doc(alias = "adw_leaflet_page_set_name")]
53 #[doc(alias = "name")]
54 pub fn set_name(&self, name: Option<&str>) {
55 unsafe {
56 ffi::adw_leaflet_page_set_name(self.to_glib_none().0, name.to_glib_none().0);
57 }
58 }
59
60 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
61 #[allow(deprecated)]
62 #[doc(alias = "adw_leaflet_page_set_navigatable")]
63 #[doc(alias = "navigatable")]
64 pub fn set_navigatable(&self, navigatable: bool) {
65 unsafe {
66 ffi::adw_leaflet_page_set_navigatable(self.to_glib_none().0, navigatable.into_glib());
67 }
68 }
69
70 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
71 #[doc(alias = "name")]
72 pub fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
73 unsafe extern "C" fn notify_name_trampoline<F: Fn(&LeafletPage) + 'static>(
74 this: *mut ffi::AdwLeafletPage,
75 _param_spec: glib::ffi::gpointer,
76 f: glib::ffi::gpointer,
77 ) {
78 let f: &F = &*(f as *const F);
79 f(&from_glib_borrow(this))
80 }
81 unsafe {
82 let f: Box_<F> = Box_::new(f);
83 connect_raw(
84 self.as_ptr() as *mut _,
85 c"notify::name".as_ptr() as *const _,
86 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
87 notify_name_trampoline::<F> as *const (),
88 )),
89 Box_::into_raw(f),
90 )
91 }
92 }
93
94 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
95 #[doc(alias = "navigatable")]
96 pub fn connect_navigatable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
97 unsafe extern "C" fn notify_navigatable_trampoline<F: Fn(&LeafletPage) + 'static>(
98 this: *mut ffi::AdwLeafletPage,
99 _param_spec: glib::ffi::gpointer,
100 f: glib::ffi::gpointer,
101 ) {
102 let f: &F = &*(f as *const F);
103 f(&from_glib_borrow(this))
104 }
105 unsafe {
106 let f: Box_<F> = Box_::new(f);
107 connect_raw(
108 self.as_ptr() as *mut _,
109 c"notify::navigatable".as_ptr() as *const _,
110 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
111 notify_navigatable_trampoline::<F> as *const (),
112 )),
113 Box_::into_raw(f),
114 )
115 }
116 }
117}