[go: up one dir, main page]

gtk4/auto/
stack_page.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{ffi, Accessible, Widget};
6use glib::{
7    prelude::*,
8    signal::{connect_raw, SignalHandlerId},
9    translate::*,
10};
11use std::boxed::Box as Box_;
12
13glib::wrapper! {
14    #[doc(alias = "GtkStackPage")]
15    pub struct StackPage(Object<ffi::GtkStackPage>) @implements Accessible;
16
17    match fn {
18        type_ => || ffi::gtk_stack_page_get_type(),
19    }
20}
21
22impl StackPage {
23    #[doc(alias = "gtk_stack_page_get_child")]
24    #[doc(alias = "get_child")]
25    pub fn child(&self) -> Widget {
26        unsafe { from_glib_none(ffi::gtk_stack_page_get_child(self.to_glib_none().0)) }
27    }
28
29    #[doc(alias = "gtk_stack_page_get_icon_name")]
30    #[doc(alias = "get_icon_name")]
31    #[doc(alias = "icon-name")]
32    pub fn icon_name(&self) -> Option<glib::GString> {
33        unsafe { from_glib_none(ffi::gtk_stack_page_get_icon_name(self.to_glib_none().0)) }
34    }
35
36    #[doc(alias = "gtk_stack_page_get_name")]
37    #[doc(alias = "get_name")]
38    pub fn name(&self) -> Option<glib::GString> {
39        unsafe { from_glib_none(ffi::gtk_stack_page_get_name(self.to_glib_none().0)) }
40    }
41
42    #[doc(alias = "gtk_stack_page_get_needs_attention")]
43    #[doc(alias = "get_needs_attention")]
44    #[doc(alias = "needs-attention")]
45    pub fn needs_attention(&self) -> bool {
46        unsafe {
47            from_glib(ffi::gtk_stack_page_get_needs_attention(
48                self.to_glib_none().0,
49            ))
50        }
51    }
52
53    #[doc(alias = "gtk_stack_page_get_title")]
54    #[doc(alias = "get_title")]
55    pub fn title(&self) -> Option<glib::GString> {
56        unsafe { from_glib_none(ffi::gtk_stack_page_get_title(self.to_glib_none().0)) }
57    }
58
59    #[doc(alias = "gtk_stack_page_get_use_underline")]
60    #[doc(alias = "get_use_underline")]
61    #[doc(alias = "use-underline")]
62    pub fn uses_underline(&self) -> bool {
63        unsafe { from_glib(ffi::gtk_stack_page_get_use_underline(self.to_glib_none().0)) }
64    }
65
66    #[doc(alias = "gtk_stack_page_get_visible")]
67    #[doc(alias = "get_visible")]
68    #[doc(alias = "visible")]
69    pub fn is_visible(&self) -> bool {
70        unsafe { from_glib(ffi::gtk_stack_page_get_visible(self.to_glib_none().0)) }
71    }
72
73    #[doc(alias = "gtk_stack_page_set_icon_name")]
74    #[doc(alias = "icon-name")]
75    pub fn set_icon_name(&self, setting: &str) {
76        unsafe {
77            ffi::gtk_stack_page_set_icon_name(self.to_glib_none().0, setting.to_glib_none().0);
78        }
79    }
80
81    #[doc(alias = "gtk_stack_page_set_name")]
82    #[doc(alias = "name")]
83    pub fn set_name(&self, setting: &str) {
84        unsafe {
85            ffi::gtk_stack_page_set_name(self.to_glib_none().0, setting.to_glib_none().0);
86        }
87    }
88
89    #[doc(alias = "gtk_stack_page_set_needs_attention")]
90    #[doc(alias = "needs-attention")]
91    pub fn set_needs_attention(&self, setting: bool) {
92        unsafe {
93            ffi::gtk_stack_page_set_needs_attention(self.to_glib_none().0, setting.into_glib());
94        }
95    }
96
97    #[doc(alias = "gtk_stack_page_set_title")]
98    #[doc(alias = "title")]
99    pub fn set_title(&self, setting: &str) {
100        unsafe {
101            ffi::gtk_stack_page_set_title(self.to_glib_none().0, setting.to_glib_none().0);
102        }
103    }
104
105    #[doc(alias = "gtk_stack_page_set_use_underline")]
106    #[doc(alias = "use-underline")]
107    pub fn set_use_underline(&self, setting: bool) {
108        unsafe {
109            ffi::gtk_stack_page_set_use_underline(self.to_glib_none().0, setting.into_glib());
110        }
111    }
112
113    #[doc(alias = "gtk_stack_page_set_visible")]
114    #[doc(alias = "visible")]
115    pub fn set_visible(&self, visible: bool) {
116        unsafe {
117            ffi::gtk_stack_page_set_visible(self.to_glib_none().0, visible.into_glib());
118        }
119    }
120
121    #[doc(alias = "icon-name")]
122    pub fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
123        unsafe extern "C" fn notify_icon_name_trampoline<F: Fn(&StackPage) + 'static>(
124            this: *mut ffi::GtkStackPage,
125            _param_spec: glib::ffi::gpointer,
126            f: glib::ffi::gpointer,
127        ) {
128            let f: &F = &*(f as *const F);
129            f(&from_glib_borrow(this))
130        }
131        unsafe {
132            let f: Box_<F> = Box_::new(f);
133            connect_raw(
134                self.as_ptr() as *mut _,
135                c"notify::icon-name".as_ptr() as *const _,
136                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
137                    notify_icon_name_trampoline::<F> as *const (),
138                )),
139                Box_::into_raw(f),
140            )
141        }
142    }
143
144    #[doc(alias = "name")]
145    pub fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
146        unsafe extern "C" fn notify_name_trampoline<F: Fn(&StackPage) + 'static>(
147            this: *mut ffi::GtkStackPage,
148            _param_spec: glib::ffi::gpointer,
149            f: glib::ffi::gpointer,
150        ) {
151            let f: &F = &*(f as *const F);
152            f(&from_glib_borrow(this))
153        }
154        unsafe {
155            let f: Box_<F> = Box_::new(f);
156            connect_raw(
157                self.as_ptr() as *mut _,
158                c"notify::name".as_ptr() as *const _,
159                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
160                    notify_name_trampoline::<F> as *const (),
161                )),
162                Box_::into_raw(f),
163            )
164        }
165    }
166
167    #[doc(alias = "needs-attention")]
168    pub fn connect_needs_attention_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
169        unsafe extern "C" fn notify_needs_attention_trampoline<F: Fn(&StackPage) + 'static>(
170            this: *mut ffi::GtkStackPage,
171            _param_spec: glib::ffi::gpointer,
172            f: glib::ffi::gpointer,
173        ) {
174            let f: &F = &*(f as *const F);
175            f(&from_glib_borrow(this))
176        }
177        unsafe {
178            let f: Box_<F> = Box_::new(f);
179            connect_raw(
180                self.as_ptr() as *mut _,
181                c"notify::needs-attention".as_ptr() as *const _,
182                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
183                    notify_needs_attention_trampoline::<F> as *const (),
184                )),
185                Box_::into_raw(f),
186            )
187        }
188    }
189
190    #[doc(alias = "title")]
191    pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
192        unsafe extern "C" fn notify_title_trampoline<F: Fn(&StackPage) + 'static>(
193            this: *mut ffi::GtkStackPage,
194            _param_spec: glib::ffi::gpointer,
195            f: glib::ffi::gpointer,
196        ) {
197            let f: &F = &*(f as *const F);
198            f(&from_glib_borrow(this))
199        }
200        unsafe {
201            let f: Box_<F> = Box_::new(f);
202            connect_raw(
203                self.as_ptr() as *mut _,
204                c"notify::title".as_ptr() as *const _,
205                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
206                    notify_title_trampoline::<F> as *const (),
207                )),
208                Box_::into_raw(f),
209            )
210        }
211    }
212
213    #[doc(alias = "use-underline")]
214    pub fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
215        unsafe extern "C" fn notify_use_underline_trampoline<F: Fn(&StackPage) + 'static>(
216            this: *mut ffi::GtkStackPage,
217            _param_spec: glib::ffi::gpointer,
218            f: glib::ffi::gpointer,
219        ) {
220            let f: &F = &*(f as *const F);
221            f(&from_glib_borrow(this))
222        }
223        unsafe {
224            let f: Box_<F> = Box_::new(f);
225            connect_raw(
226                self.as_ptr() as *mut _,
227                c"notify::use-underline".as_ptr() as *const _,
228                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
229                    notify_use_underline_trampoline::<F> as *const (),
230                )),
231                Box_::into_raw(f),
232            )
233        }
234    }
235
236    #[doc(alias = "visible")]
237    pub fn connect_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
238        unsafe extern "C" fn notify_visible_trampoline<F: Fn(&StackPage) + 'static>(
239            this: *mut ffi::GtkStackPage,
240            _param_spec: glib::ffi::gpointer,
241            f: glib::ffi::gpointer,
242        ) {
243            let f: &F = &*(f as *const F);
244            f(&from_glib_borrow(this))
245        }
246        unsafe {
247            let f: Box_<F> = Box_::new(f);
248            connect_raw(
249                self.as_ptr() as *mut _,
250                c"notify::visible".as_ptr() as *const _,
251                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
252                    notify_visible_trampoline::<F> as *const (),
253                )),
254                Box_::into_raw(f),
255            )
256        }
257    }
258}