Skip to main content

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::{SignalHandlerId, connect_raw},
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            unsafe {
214                let f: &F = &*(f as *const F);
215                f(&from_glib_borrow(this))
216            }
217        }
218        unsafe {
219            let f: Box_<F> = Box_::new(f);
220            connect_raw(
221                self.as_ptr() as *mut _,
222                c"notify::badge-number".as_ptr(),
223                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
224                    notify_badge_number_trampoline::<F> as *const (),
225                )),
226                Box_::into_raw(f),
227            )
228        }
229    }
230
231    #[doc(alias = "icon-name")]
232    pub fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
233        unsafe extern "C" fn notify_icon_name_trampoline<F: Fn(&ViewStackPage) + 'static>(
234            this: *mut ffi::AdwViewStackPage,
235            _param_spec: glib::ffi::gpointer,
236            f: glib::ffi::gpointer,
237        ) {
238            unsafe {
239                let f: &F = &*(f as *const F);
240                f(&from_glib_borrow(this))
241            }
242        }
243        unsafe {
244            let f: Box_<F> = Box_::new(f);
245            connect_raw(
246                self.as_ptr() as *mut _,
247                c"notify::icon-name".as_ptr(),
248                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
249                    notify_icon_name_trampoline::<F> as *const (),
250                )),
251                Box_::into_raw(f),
252            )
253        }
254    }
255
256    #[doc(alias = "name")]
257    pub fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
258        unsafe extern "C" fn notify_name_trampoline<F: Fn(&ViewStackPage) + 'static>(
259            this: *mut ffi::AdwViewStackPage,
260            _param_spec: glib::ffi::gpointer,
261            f: glib::ffi::gpointer,
262        ) {
263            unsafe {
264                let f: &F = &*(f as *const F);
265                f(&from_glib_borrow(this))
266            }
267        }
268        unsafe {
269            let f: Box_<F> = Box_::new(f);
270            connect_raw(
271                self.as_ptr() as *mut _,
272                c"notify::name".as_ptr(),
273                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
274                    notify_name_trampoline::<F> as *const (),
275                )),
276                Box_::into_raw(f),
277            )
278        }
279    }
280
281    #[doc(alias = "needs-attention")]
282    pub fn connect_needs_attention_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
283        unsafe extern "C" fn notify_needs_attention_trampoline<F: Fn(&ViewStackPage) + 'static>(
284            this: *mut ffi::AdwViewStackPage,
285            _param_spec: glib::ffi::gpointer,
286            f: glib::ffi::gpointer,
287        ) {
288            unsafe {
289                let f: &F = &*(f as *const F);
290                f(&from_glib_borrow(this))
291            }
292        }
293        unsafe {
294            let f: Box_<F> = Box_::new(f);
295            connect_raw(
296                self.as_ptr() as *mut _,
297                c"notify::needs-attention".as_ptr(),
298                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
299                    notify_needs_attention_trampoline::<F> as *const (),
300                )),
301                Box_::into_raw(f),
302            )
303        }
304    }
305
306    #[cfg(feature = "v1_9")]
307    #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
308    #[doc(alias = "section-title")]
309    pub fn connect_section_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
310        unsafe extern "C" fn notify_section_title_trampoline<F: Fn(&ViewStackPage) + 'static>(
311            this: *mut ffi::AdwViewStackPage,
312            _param_spec: glib::ffi::gpointer,
313            f: glib::ffi::gpointer,
314        ) {
315            unsafe {
316                let f: &F = &*(f as *const F);
317                f(&from_glib_borrow(this))
318            }
319        }
320        unsafe {
321            let f: Box_<F> = Box_::new(f);
322            connect_raw(
323                self.as_ptr() as *mut _,
324                c"notify::section-title".as_ptr(),
325                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
326                    notify_section_title_trampoline::<F> as *const (),
327                )),
328                Box_::into_raw(f),
329            )
330        }
331    }
332
333    #[cfg(feature = "v1_9")]
334    #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
335    #[doc(alias = "starts-section")]
336    pub fn connect_starts_section_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
337        unsafe extern "C" fn notify_starts_section_trampoline<F: Fn(&ViewStackPage) + 'static>(
338            this: *mut ffi::AdwViewStackPage,
339            _param_spec: glib::ffi::gpointer,
340            f: glib::ffi::gpointer,
341        ) {
342            unsafe {
343                let f: &F = &*(f as *const F);
344                f(&from_glib_borrow(this))
345            }
346        }
347        unsafe {
348            let f: Box_<F> = Box_::new(f);
349            connect_raw(
350                self.as_ptr() as *mut _,
351                c"notify::starts-section".as_ptr(),
352                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
353                    notify_starts_section_trampoline::<F> as *const (),
354                )),
355                Box_::into_raw(f),
356            )
357        }
358    }
359
360    #[doc(alias = "title")]
361    pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
362        unsafe extern "C" fn notify_title_trampoline<F: Fn(&ViewStackPage) + 'static>(
363            this: *mut ffi::AdwViewStackPage,
364            _param_spec: glib::ffi::gpointer,
365            f: glib::ffi::gpointer,
366        ) {
367            unsafe {
368                let f: &F = &*(f as *const F);
369                f(&from_glib_borrow(this))
370            }
371        }
372        unsafe {
373            let f: Box_<F> = Box_::new(f);
374            connect_raw(
375                self.as_ptr() as *mut _,
376                c"notify::title".as_ptr(),
377                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
378                    notify_title_trampoline::<F> as *const (),
379                )),
380                Box_::into_raw(f),
381            )
382        }
383    }
384
385    #[doc(alias = "use-underline")]
386    pub fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
387        unsafe extern "C" fn notify_use_underline_trampoline<F: Fn(&ViewStackPage) + 'static>(
388            this: *mut ffi::AdwViewStackPage,
389            _param_spec: glib::ffi::gpointer,
390            f: glib::ffi::gpointer,
391        ) {
392            unsafe {
393                let f: &F = &*(f as *const F);
394                f(&from_glib_borrow(this))
395            }
396        }
397        unsafe {
398            let f: Box_<F> = Box_::new(f);
399            connect_raw(
400                self.as_ptr() as *mut _,
401                c"notify::use-underline".as_ptr(),
402                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
403                    notify_use_underline_trampoline::<F> as *const (),
404                )),
405                Box_::into_raw(f),
406            )
407        }
408    }
409
410    #[doc(alias = "visible")]
411    pub fn connect_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
412        unsafe extern "C" fn notify_visible_trampoline<F: Fn(&ViewStackPage) + 'static>(
413            this: *mut ffi::AdwViewStackPage,
414            _param_spec: glib::ffi::gpointer,
415            f: glib::ffi::gpointer,
416        ) {
417            unsafe {
418                let f: &F = &*(f as *const F);
419                f(&from_glib_borrow(this))
420            }
421        }
422        unsafe {
423            let f: Box_<F> = Box_::new(f);
424            connect_raw(
425                self.as_ptr() as *mut _,
426                c"notify::visible".as_ptr(),
427                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
428                    notify_visible_trampoline::<F> as *const (),
429                )),
430                Box_::into_raw(f),
431            )
432        }
433    }
434}