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    #[cfg(feature = "v1_9")]
66    #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
67    #[doc(alias = "adw_view_stack_page_get_section_title")]
68    #[doc(alias = "get_section_title")]
69    #[doc(alias = "section-title")]
70    pub fn section_title(&self) -> Option<glib::GString> {
71        unsafe {
72            from_glib_none(ffi::adw_view_stack_page_get_section_title(
73                self.to_glib_none().0,
74            ))
75        }
76    }
77
78    #[cfg(feature = "v1_9")]
79    #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
80    #[doc(alias = "adw_view_stack_page_get_starts_section")]
81    #[doc(alias = "get_starts_section")]
82    #[doc(alias = "starts-section")]
83    pub fn is_starts_section(&self) -> bool {
84        unsafe {
85            from_glib(ffi::adw_view_stack_page_get_starts_section(
86                self.to_glib_none().0,
87            ))
88        }
89    }
90
91    #[doc(alias = "adw_view_stack_page_get_title")]
92    #[doc(alias = "get_title")]
93    pub fn title(&self) -> Option<glib::GString> {
94        unsafe { from_glib_none(ffi::adw_view_stack_page_get_title(self.to_glib_none().0)) }
95    }
96
97    #[doc(alias = "adw_view_stack_page_get_use_underline")]
98    #[doc(alias = "get_use_underline")]
99    #[doc(alias = "use-underline")]
100    pub fn uses_underline(&self) -> bool {
101        unsafe {
102            from_glib(ffi::adw_view_stack_page_get_use_underline(
103                self.to_glib_none().0,
104            ))
105        }
106    }
107
108    #[doc(alias = "adw_view_stack_page_get_visible")]
109    #[doc(alias = "get_visible")]
110    #[doc(alias = "visible")]
111    pub fn is_visible(&self) -> bool {
112        unsafe { from_glib(ffi::adw_view_stack_page_get_visible(self.to_glib_none().0)) }
113    }
114
115    #[doc(alias = "adw_view_stack_page_set_badge_number")]
116    #[doc(alias = "badge-number")]
117    pub fn set_badge_number(&self, badge_number: u32) {
118        unsafe {
119            ffi::adw_view_stack_page_set_badge_number(self.to_glib_none().0, badge_number);
120        }
121    }
122
123    #[doc(alias = "adw_view_stack_page_set_icon_name")]
124    #[doc(alias = "icon-name")]
125    pub fn set_icon_name(&self, icon_name: Option<&str>) {
126        unsafe {
127            ffi::adw_view_stack_page_set_icon_name(
128                self.to_glib_none().0,
129                icon_name.to_glib_none().0,
130            );
131        }
132    }
133
134    #[doc(alias = "adw_view_stack_page_set_name")]
135    #[doc(alias = "name")]
136    pub fn set_name(&self, name: Option<&str>) {
137        unsafe {
138            ffi::adw_view_stack_page_set_name(self.to_glib_none().0, name.to_glib_none().0);
139        }
140    }
141
142    #[doc(alias = "adw_view_stack_page_set_needs_attention")]
143    #[doc(alias = "needs-attention")]
144    pub fn set_needs_attention(&self, needs_attention: bool) {
145        unsafe {
146            ffi::adw_view_stack_page_set_needs_attention(
147                self.to_glib_none().0,
148                needs_attention.into_glib(),
149            );
150        }
151    }
152
153    #[cfg(feature = "v1_9")]
154    #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
155    #[doc(alias = "adw_view_stack_page_set_section_title")]
156    #[doc(alias = "section-title")]
157    pub fn set_section_title(&self, section_title: Option<&str>) {
158        unsafe {
159            ffi::adw_view_stack_page_set_section_title(
160                self.to_glib_none().0,
161                section_title.to_glib_none().0,
162            );
163        }
164    }
165
166    #[cfg(feature = "v1_9")]
167    #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
168    #[doc(alias = "adw_view_stack_page_set_starts_section")]
169    #[doc(alias = "starts-section")]
170    pub fn set_starts_section(&self, starts_section: bool) {
171        unsafe {
172            ffi::adw_view_stack_page_set_starts_section(
173                self.to_glib_none().0,
174                starts_section.into_glib(),
175            );
176        }
177    }
178
179    #[doc(alias = "adw_view_stack_page_set_title")]
180    #[doc(alias = "title")]
181    pub fn set_title(&self, title: Option<&str>) {
182        unsafe {
183            ffi::adw_view_stack_page_set_title(self.to_glib_none().0, title.to_glib_none().0);
184        }
185    }
186
187    #[doc(alias = "adw_view_stack_page_set_use_underline")]
188    #[doc(alias = "use-underline")]
189    pub fn set_use_underline(&self, use_underline: bool) {
190        unsafe {
191            ffi::adw_view_stack_page_set_use_underline(
192                self.to_glib_none().0,
193                use_underline.into_glib(),
194            );
195        }
196    }
197
198    #[doc(alias = "adw_view_stack_page_set_visible")]
199    #[doc(alias = "visible")]
200    pub fn set_visible(&self, visible: bool) {
201        unsafe {
202            ffi::adw_view_stack_page_set_visible(self.to_glib_none().0, visible.into_glib());
203        }
204    }
205
206    #[doc(alias = "badge-number")]
207    pub fn connect_badge_number_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
208        unsafe extern "C" fn notify_badge_number_trampoline<F: Fn(&ViewStackPage) + 'static>(
209            this: *mut ffi::AdwViewStackPage,
210            _param_spec: glib::ffi::gpointer,
211            f: glib::ffi::gpointer,
212        ) {
213            let f: &F = &*(f as *const F);
214            f(&from_glib_borrow(this))
215        }
216        unsafe {
217            let f: Box_<F> = Box_::new(f);
218            connect_raw(
219                self.as_ptr() as *mut _,
220                c"notify::badge-number".as_ptr() as *const _,
221                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
222                    notify_badge_number_trampoline::<F> as *const (),
223                )),
224                Box_::into_raw(f),
225            )
226        }
227    }
228
229    #[doc(alias = "icon-name")]
230    pub fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
231        unsafe extern "C" fn notify_icon_name_trampoline<F: Fn(&ViewStackPage) + 'static>(
232            this: *mut ffi::AdwViewStackPage,
233            _param_spec: glib::ffi::gpointer,
234            f: glib::ffi::gpointer,
235        ) {
236            let f: &F = &*(f as *const F);
237            f(&from_glib_borrow(this))
238        }
239        unsafe {
240            let f: Box_<F> = Box_::new(f);
241            connect_raw(
242                self.as_ptr() as *mut _,
243                c"notify::icon-name".as_ptr() as *const _,
244                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
245                    notify_icon_name_trampoline::<F> as *const (),
246                )),
247                Box_::into_raw(f),
248            )
249        }
250    }
251
252    #[doc(alias = "name")]
253    pub fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
254        unsafe extern "C" fn notify_name_trampoline<F: Fn(&ViewStackPage) + 'static>(
255            this: *mut ffi::AdwViewStackPage,
256            _param_spec: glib::ffi::gpointer,
257            f: glib::ffi::gpointer,
258        ) {
259            let f: &F = &*(f as *const F);
260            f(&from_glib_borrow(this))
261        }
262        unsafe {
263            let f: Box_<F> = Box_::new(f);
264            connect_raw(
265                self.as_ptr() as *mut _,
266                c"notify::name".as_ptr() as *const _,
267                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
268                    notify_name_trampoline::<F> as *const (),
269                )),
270                Box_::into_raw(f),
271            )
272        }
273    }
274
275    #[doc(alias = "needs-attention")]
276    pub fn connect_needs_attention_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
277        unsafe extern "C" fn notify_needs_attention_trampoline<F: Fn(&ViewStackPage) + 'static>(
278            this: *mut ffi::AdwViewStackPage,
279            _param_spec: glib::ffi::gpointer,
280            f: glib::ffi::gpointer,
281        ) {
282            let f: &F = &*(f as *const F);
283            f(&from_glib_borrow(this))
284        }
285        unsafe {
286            let f: Box_<F> = Box_::new(f);
287            connect_raw(
288                self.as_ptr() as *mut _,
289                c"notify::needs-attention".as_ptr() as *const _,
290                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
291                    notify_needs_attention_trampoline::<F> as *const (),
292                )),
293                Box_::into_raw(f),
294            )
295        }
296    }
297
298    #[cfg(feature = "v1_9")]
299    #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
300    #[doc(alias = "section-title")]
301    pub fn connect_section_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
302        unsafe extern "C" fn notify_section_title_trampoline<F: Fn(&ViewStackPage) + 'static>(
303            this: *mut ffi::AdwViewStackPage,
304            _param_spec: glib::ffi::gpointer,
305            f: glib::ffi::gpointer,
306        ) {
307            let f: &F = &*(f as *const F);
308            f(&from_glib_borrow(this))
309        }
310        unsafe {
311            let f: Box_<F> = Box_::new(f);
312            connect_raw(
313                self.as_ptr() as *mut _,
314                c"notify::section-title".as_ptr() as *const _,
315                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
316                    notify_section_title_trampoline::<F> as *const (),
317                )),
318                Box_::into_raw(f),
319            )
320        }
321    }
322
323    #[cfg(feature = "v1_9")]
324    #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
325    #[doc(alias = "starts-section")]
326    pub fn connect_starts_section_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
327        unsafe extern "C" fn notify_starts_section_trampoline<F: Fn(&ViewStackPage) + 'static>(
328            this: *mut ffi::AdwViewStackPage,
329            _param_spec: glib::ffi::gpointer,
330            f: glib::ffi::gpointer,
331        ) {
332            let f: &F = &*(f as *const F);
333            f(&from_glib_borrow(this))
334        }
335        unsafe {
336            let f: Box_<F> = Box_::new(f);
337            connect_raw(
338                self.as_ptr() as *mut _,
339                c"notify::starts-section".as_ptr() as *const _,
340                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
341                    notify_starts_section_trampoline::<F> as *const (),
342                )),
343                Box_::into_raw(f),
344            )
345        }
346    }
347
348    #[doc(alias = "title")]
349    pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
350        unsafe extern "C" fn notify_title_trampoline<F: Fn(&ViewStackPage) + 'static>(
351            this: *mut ffi::AdwViewStackPage,
352            _param_spec: glib::ffi::gpointer,
353            f: glib::ffi::gpointer,
354        ) {
355            let f: &F = &*(f as *const F);
356            f(&from_glib_borrow(this))
357        }
358        unsafe {
359            let f: Box_<F> = Box_::new(f);
360            connect_raw(
361                self.as_ptr() as *mut _,
362                c"notify::title".as_ptr() as *const _,
363                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
364                    notify_title_trampoline::<F> as *const (),
365                )),
366                Box_::into_raw(f),
367            )
368        }
369    }
370
371    #[doc(alias = "use-underline")]
372    pub fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
373        unsafe extern "C" fn notify_use_underline_trampoline<F: Fn(&ViewStackPage) + 'static>(
374            this: *mut ffi::AdwViewStackPage,
375            _param_spec: glib::ffi::gpointer,
376            f: glib::ffi::gpointer,
377        ) {
378            let f: &F = &*(f as *const F);
379            f(&from_glib_borrow(this))
380        }
381        unsafe {
382            let f: Box_<F> = Box_::new(f);
383            connect_raw(
384                self.as_ptr() as *mut _,
385                c"notify::use-underline".as_ptr() as *const _,
386                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
387                    notify_use_underline_trampoline::<F> as *const (),
388                )),
389                Box_::into_raw(f),
390            )
391        }
392    }
393
394    #[doc(alias = "visible")]
395    pub fn connect_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
396        unsafe extern "C" fn notify_visible_trampoline<F: Fn(&ViewStackPage) + 'static>(
397            this: *mut ffi::AdwViewStackPage,
398            _param_spec: glib::ffi::gpointer,
399            f: glib::ffi::gpointer,
400        ) {
401            let f: &F = &*(f as *const F);
402            f(&from_glib_borrow(this))
403        }
404        unsafe {
405            let f: Box_<F> = Box_::new(f);
406            connect_raw(
407                self.as_ptr() as *mut _,
408                c"notify::visible".as_ptr() as *const _,
409                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
410                    notify_visible_trampoline::<F> as *const (),
411                )),
412                Box_::into_raw(f),
413            )
414        }
415    }
416}