libadwaita/auto/
view_stack_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
6use crate::ffi;
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    #[doc(alias = "AdwViewStackPage")]
16    pub struct ViewStackPage(Object<ffi::AdwViewStackPage, ffi::AdwViewStackPageClass>) @implements gtk::Accessible;
17
18    match fn {
19        type_ => || ffi::adw_view_stack_page_get_type(),
20    }
21}
22
23impl ViewStackPage {
24    #[doc(alias = "adw_view_stack_page_get_badge_number")]
25    #[doc(alias = "get_badge_number")]
26    #[doc(alias = "badge-number")]
27    pub fn badge_number(&self) -> u32 {
28        unsafe { ffi::adw_view_stack_page_get_badge_number(self.to_glib_none().0) }
29    }
30
31    #[doc(alias = "adw_view_stack_page_get_child")]
32    #[doc(alias = "get_child")]
33    pub fn child(&self) -> gtk::Widget {
34        unsafe { from_glib_none(ffi::adw_view_stack_page_get_child(self.to_glib_none().0)) }
35    }
36
37    #[doc(alias = "adw_view_stack_page_get_icon_name")]
38    #[doc(alias = "get_icon_name")]
39    #[doc(alias = "icon-name")]
40    pub fn icon_name(&self) -> Option<glib::GString> {
41        unsafe {
42            from_glib_none(ffi::adw_view_stack_page_get_icon_name(
43                self.to_glib_none().0,
44            ))
45        }
46    }
47
48    #[doc(alias = "adw_view_stack_page_get_name")]
49    #[doc(alias = "get_name")]
50    pub fn name(&self) -> Option<glib::GString> {
51        unsafe { from_glib_none(ffi::adw_view_stack_page_get_name(self.to_glib_none().0)) }
52    }
53
54    #[doc(alias = "adw_view_stack_page_get_needs_attention")]
55    #[doc(alias = "get_needs_attention")]
56    #[doc(alias = "needs-attention")]
57    pub fn needs_attention(&self) -> bool {
58        unsafe {
59            from_glib(ffi::adw_view_stack_page_get_needs_attention(
60                self.to_glib_none().0,
61            ))
62        }
63    }
64
65    #[doc(alias = "adw_view_stack_page_get_title")]
66    #[doc(alias = "get_title")]
67    pub fn title(&self) -> Option<glib::GString> {
68        unsafe { from_glib_none(ffi::adw_view_stack_page_get_title(self.to_glib_none().0)) }
69    }
70
71    #[doc(alias = "adw_view_stack_page_get_use_underline")]
72    #[doc(alias = "get_use_underline")]
73    #[doc(alias = "use-underline")]
74    pub fn uses_underline(&self) -> bool {
75        unsafe {
76            from_glib(ffi::adw_view_stack_page_get_use_underline(
77                self.to_glib_none().0,
78            ))
79        }
80    }
81
82    #[doc(alias = "adw_view_stack_page_get_visible")]
83    #[doc(alias = "get_visible")]
84    #[doc(alias = "visible")]
85    pub fn is_visible(&self) -> bool {
86        unsafe { from_glib(ffi::adw_view_stack_page_get_visible(self.to_glib_none().0)) }
87    }
88
89    #[doc(alias = "adw_view_stack_page_set_badge_number")]
90    #[doc(alias = "badge-number")]
91    pub fn set_badge_number(&self, badge_number: u32) {
92        unsafe {
93            ffi::adw_view_stack_page_set_badge_number(self.to_glib_none().0, badge_number);
94        }
95    }
96
97    #[doc(alias = "adw_view_stack_page_set_icon_name")]
98    #[doc(alias = "icon-name")]
99    pub fn set_icon_name(&self, icon_name: Option<&str>) {
100        unsafe {
101            ffi::adw_view_stack_page_set_icon_name(
102                self.to_glib_none().0,
103                icon_name.to_glib_none().0,
104            );
105        }
106    }
107
108    #[doc(alias = "adw_view_stack_page_set_name")]
109    #[doc(alias = "name")]
110    pub fn set_name(&self, name: Option<&str>) {
111        unsafe {
112            ffi::adw_view_stack_page_set_name(self.to_glib_none().0, name.to_glib_none().0);
113        }
114    }
115
116    #[doc(alias = "adw_view_stack_page_set_needs_attention")]
117    #[doc(alias = "needs-attention")]
118    pub fn set_needs_attention(&self, needs_attention: bool) {
119        unsafe {
120            ffi::adw_view_stack_page_set_needs_attention(
121                self.to_glib_none().0,
122                needs_attention.into_glib(),
123            );
124        }
125    }
126
127    #[doc(alias = "adw_view_stack_page_set_title")]
128    #[doc(alias = "title")]
129    pub fn set_title(&self, title: Option<&str>) {
130        unsafe {
131            ffi::adw_view_stack_page_set_title(self.to_glib_none().0, title.to_glib_none().0);
132        }
133    }
134
135    #[doc(alias = "adw_view_stack_page_set_use_underline")]
136    #[doc(alias = "use-underline")]
137    pub fn set_use_underline(&self, use_underline: bool) {
138        unsafe {
139            ffi::adw_view_stack_page_set_use_underline(
140                self.to_glib_none().0,
141                use_underline.into_glib(),
142            );
143        }
144    }
145
146    #[doc(alias = "adw_view_stack_page_set_visible")]
147    #[doc(alias = "visible")]
148    pub fn set_visible(&self, visible: bool) {
149        unsafe {
150            ffi::adw_view_stack_page_set_visible(self.to_glib_none().0, visible.into_glib());
151        }
152    }
153
154    #[doc(alias = "badge-number")]
155    pub fn connect_badge_number_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
156        unsafe extern "C" fn notify_badge_number_trampoline<F: Fn(&ViewStackPage) + 'static>(
157            this: *mut ffi::AdwViewStackPage,
158            _param_spec: glib::ffi::gpointer,
159            f: glib::ffi::gpointer,
160        ) {
161            let f: &F = &*(f as *const F);
162            f(&from_glib_borrow(this))
163        }
164        unsafe {
165            let f: Box_<F> = Box_::new(f);
166            connect_raw(
167                self.as_ptr() as *mut _,
168                c"notify::badge-number".as_ptr() as *const _,
169                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
170                    notify_badge_number_trampoline::<F> as *const (),
171                )),
172                Box_::into_raw(f),
173            )
174        }
175    }
176
177    #[doc(alias = "icon-name")]
178    pub fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
179        unsafe extern "C" fn notify_icon_name_trampoline<F: Fn(&ViewStackPage) + 'static>(
180            this: *mut ffi::AdwViewStackPage,
181            _param_spec: glib::ffi::gpointer,
182            f: glib::ffi::gpointer,
183        ) {
184            let f: &F = &*(f as *const F);
185            f(&from_glib_borrow(this))
186        }
187        unsafe {
188            let f: Box_<F> = Box_::new(f);
189            connect_raw(
190                self.as_ptr() as *mut _,
191                c"notify::icon-name".as_ptr() as *const _,
192                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
193                    notify_icon_name_trampoline::<F> as *const (),
194                )),
195                Box_::into_raw(f),
196            )
197        }
198    }
199
200    #[doc(alias = "name")]
201    pub fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
202        unsafe extern "C" fn notify_name_trampoline<F: Fn(&ViewStackPage) + 'static>(
203            this: *mut ffi::AdwViewStackPage,
204            _param_spec: glib::ffi::gpointer,
205            f: glib::ffi::gpointer,
206        ) {
207            let f: &F = &*(f as *const F);
208            f(&from_glib_borrow(this))
209        }
210        unsafe {
211            let f: Box_<F> = Box_::new(f);
212            connect_raw(
213                self.as_ptr() as *mut _,
214                c"notify::name".as_ptr() as *const _,
215                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
216                    notify_name_trampoline::<F> as *const (),
217                )),
218                Box_::into_raw(f),
219            )
220        }
221    }
222
223    #[doc(alias = "needs-attention")]
224    pub fn connect_needs_attention_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
225        unsafe extern "C" fn notify_needs_attention_trampoline<F: Fn(&ViewStackPage) + 'static>(
226            this: *mut ffi::AdwViewStackPage,
227            _param_spec: glib::ffi::gpointer,
228            f: glib::ffi::gpointer,
229        ) {
230            let f: &F = &*(f as *const F);
231            f(&from_glib_borrow(this))
232        }
233        unsafe {
234            let f: Box_<F> = Box_::new(f);
235            connect_raw(
236                self.as_ptr() as *mut _,
237                c"notify::needs-attention".as_ptr() as *const _,
238                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
239                    notify_needs_attention_trampoline::<F> as *const (),
240                )),
241                Box_::into_raw(f),
242            )
243        }
244    }
245
246    #[doc(alias = "title")]
247    pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
248        unsafe extern "C" fn notify_title_trampoline<F: Fn(&ViewStackPage) + 'static>(
249            this: *mut ffi::AdwViewStackPage,
250            _param_spec: glib::ffi::gpointer,
251            f: glib::ffi::gpointer,
252        ) {
253            let f: &F = &*(f as *const F);
254            f(&from_glib_borrow(this))
255        }
256        unsafe {
257            let f: Box_<F> = Box_::new(f);
258            connect_raw(
259                self.as_ptr() as *mut _,
260                c"notify::title".as_ptr() as *const _,
261                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
262                    notify_title_trampoline::<F> as *const (),
263                )),
264                Box_::into_raw(f),
265            )
266        }
267    }
268
269    #[doc(alias = "use-underline")]
270    pub fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
271        unsafe extern "C" fn notify_use_underline_trampoline<F: Fn(&ViewStackPage) + 'static>(
272            this: *mut ffi::AdwViewStackPage,
273            _param_spec: glib::ffi::gpointer,
274            f: glib::ffi::gpointer,
275        ) {
276            let f: &F = &*(f as *const F);
277            f(&from_glib_borrow(this))
278        }
279        unsafe {
280            let f: Box_<F> = Box_::new(f);
281            connect_raw(
282                self.as_ptr() as *mut _,
283                c"notify::use-underline".as_ptr() as *const _,
284                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
285                    notify_use_underline_trampoline::<F> as *const (),
286                )),
287                Box_::into_raw(f),
288            )
289        }
290    }
291
292    #[doc(alias = "visible")]
293    pub fn connect_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
294        unsafe extern "C" fn notify_visible_trampoline<F: Fn(&ViewStackPage) + 'static>(
295            this: *mut ffi::AdwViewStackPage,
296            _param_spec: glib::ffi::gpointer,
297            f: glib::ffi::gpointer,
298        ) {
299            let f: &F = &*(f as *const F);
300            f(&from_glib_borrow(this))
301        }
302        unsafe {
303            let f: Box_<F> = Box_::new(f);
304            connect_raw(
305                self.as_ptr() as *mut _,
306                c"notify::visible".as_ptr() as *const _,
307                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
308                    notify_visible_trampoline::<F> as *const (),
309                )),
310                Box_::into_raw(f),
311            )
312        }
313    }
314}