gtk4/auto/
stack_page.rs
1use 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")]
78 pub struct StackPage(Object<ffi::GtkStackPage>) @implements Accessible;
79
80 match fn {
81 type_ => || ffi::gtk_stack_page_get_type(),
82 }
83}
84
85impl StackPage {
86 #[doc(alias = "gtk_stack_page_get_child")]
92 #[doc(alias = "get_child")]
93 pub fn child(&self) -> Widget {
94 unsafe { from_glib_none(ffi::gtk_stack_page_get_child(self.to_glib_none().0)) }
95 }
96
97 #[doc(alias = "gtk_stack_page_get_icon_name")]
103 #[doc(alias = "get_icon_name")]
104 #[doc(alias = "icon-name")]
105 pub fn icon_name(&self) -> Option<glib::GString> {
106 unsafe { from_glib_none(ffi::gtk_stack_page_get_icon_name(self.to_glib_none().0)) }
107 }
108
109 #[doc(alias = "gtk_stack_page_get_name")]
115 #[doc(alias = "get_name")]
116 pub fn name(&self) -> Option<glib::GString> {
117 unsafe { from_glib_none(ffi::gtk_stack_page_get_name(self.to_glib_none().0)) }
118 }
119
120 #[doc(alias = "gtk_stack_page_get_needs_attention")]
127 #[doc(alias = "get_needs_attention")]
128 #[doc(alias = "needs-attention")]
129 pub fn needs_attention(&self) -> bool {
130 unsafe {
131 from_glib(ffi::gtk_stack_page_get_needs_attention(
132 self.to_glib_none().0,
133 ))
134 }
135 }
136
137 #[doc(alias = "gtk_stack_page_get_title")]
143 #[doc(alias = "get_title")]
144 pub fn title(&self) -> Option<glib::GString> {
145 unsafe { from_glib_none(ffi::gtk_stack_page_get_title(self.to_glib_none().0)) }
146 }
147
148 #[doc(alias = "gtk_stack_page_get_use_underline")]
154 #[doc(alias = "get_use_underline")]
155 #[doc(alias = "use-underline")]
156 pub fn uses_underline(&self) -> bool {
157 unsafe { from_glib(ffi::gtk_stack_page_get_use_underline(self.to_glib_none().0)) }
158 }
159
160 #[doc(alias = "gtk_stack_page_get_visible")]
169 #[doc(alias = "get_visible")]
170 #[doc(alias = "visible")]
171 pub fn is_visible(&self) -> bool {
172 unsafe { from_glib(ffi::gtk_stack_page_get_visible(self.to_glib_none().0)) }
173 }
174
175 #[doc(alias = "gtk_stack_page_set_icon_name")]
179 #[doc(alias = "icon-name")]
180 pub fn set_icon_name(&self, setting: &str) {
181 unsafe {
182 ffi::gtk_stack_page_set_icon_name(self.to_glib_none().0, setting.to_glib_none().0);
183 }
184 }
185
186 #[doc(alias = "gtk_stack_page_set_name")]
190 #[doc(alias = "name")]
191 pub fn set_name(&self, setting: &str) {
192 unsafe {
193 ffi::gtk_stack_page_set_name(self.to_glib_none().0, setting.to_glib_none().0);
194 }
195 }
196
197 #[doc(alias = "gtk_stack_page_set_needs_attention")]
201 #[doc(alias = "needs-attention")]
202 pub fn set_needs_attention(&self, setting: bool) {
203 unsafe {
204 ffi::gtk_stack_page_set_needs_attention(self.to_glib_none().0, setting.into_glib());
205 }
206 }
207
208 #[doc(alias = "gtk_stack_page_set_title")]
212 #[doc(alias = "title")]
213 pub fn set_title(&self, setting: &str) {
214 unsafe {
215 ffi::gtk_stack_page_set_title(self.to_glib_none().0, setting.to_glib_none().0);
216 }
217 }
218
219 #[doc(alias = "gtk_stack_page_set_use_underline")]
223 #[doc(alias = "use-underline")]
224 pub fn set_use_underline(&self, setting: bool) {
225 unsafe {
226 ffi::gtk_stack_page_set_use_underline(self.to_glib_none().0, setting.into_glib());
227 }
228 }
229
230 #[doc(alias = "gtk_stack_page_set_visible")]
234 #[doc(alias = "visible")]
235 pub fn set_visible(&self, visible: bool) {
236 unsafe {
237 ffi::gtk_stack_page_set_visible(self.to_glib_none().0, visible.into_glib());
238 }
239 }
240
241 #[doc(alias = "icon-name")]
242 pub fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
243 unsafe extern "C" fn notify_icon_name_trampoline<F: Fn(&StackPage) + 'static>(
244 this: *mut ffi::GtkStackPage,
245 _param_spec: glib::ffi::gpointer,
246 f: glib::ffi::gpointer,
247 ) {
248 let f: &F = &*(f as *const F);
249 f(&from_glib_borrow(this))
250 }
251 unsafe {
252 let f: Box_<F> = Box_::new(f);
253 connect_raw(
254 self.as_ptr() as *mut _,
255 b"notify::icon-name\0".as_ptr() as *const _,
256 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
257 notify_icon_name_trampoline::<F> as *const (),
258 )),
259 Box_::into_raw(f),
260 )
261 }
262 }
263
264 #[doc(alias = "name")]
265 pub fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
266 unsafe extern "C" fn notify_name_trampoline<F: Fn(&StackPage) + 'static>(
267 this: *mut ffi::GtkStackPage,
268 _param_spec: glib::ffi::gpointer,
269 f: glib::ffi::gpointer,
270 ) {
271 let f: &F = &*(f as *const F);
272 f(&from_glib_borrow(this))
273 }
274 unsafe {
275 let f: Box_<F> = Box_::new(f);
276 connect_raw(
277 self.as_ptr() as *mut _,
278 b"notify::name\0".as_ptr() as *const _,
279 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
280 notify_name_trampoline::<F> as *const (),
281 )),
282 Box_::into_raw(f),
283 )
284 }
285 }
286
287 #[doc(alias = "needs-attention")]
288 pub fn connect_needs_attention_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
289 unsafe extern "C" fn notify_needs_attention_trampoline<F: Fn(&StackPage) + 'static>(
290 this: *mut ffi::GtkStackPage,
291 _param_spec: glib::ffi::gpointer,
292 f: glib::ffi::gpointer,
293 ) {
294 let f: &F = &*(f as *const F);
295 f(&from_glib_borrow(this))
296 }
297 unsafe {
298 let f: Box_<F> = Box_::new(f);
299 connect_raw(
300 self.as_ptr() as *mut _,
301 b"notify::needs-attention\0".as_ptr() as *const _,
302 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
303 notify_needs_attention_trampoline::<F> as *const (),
304 )),
305 Box_::into_raw(f),
306 )
307 }
308 }
309
310 #[doc(alias = "title")]
311 pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
312 unsafe extern "C" fn notify_title_trampoline<F: Fn(&StackPage) + 'static>(
313 this: *mut ffi::GtkStackPage,
314 _param_spec: glib::ffi::gpointer,
315 f: glib::ffi::gpointer,
316 ) {
317 let f: &F = &*(f as *const F);
318 f(&from_glib_borrow(this))
319 }
320 unsafe {
321 let f: Box_<F> = Box_::new(f);
322 connect_raw(
323 self.as_ptr() as *mut _,
324 b"notify::title\0".as_ptr() as *const _,
325 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
326 notify_title_trampoline::<F> as *const (),
327 )),
328 Box_::into_raw(f),
329 )
330 }
331 }
332
333 #[doc(alias = "use-underline")]
334 pub fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
335 unsafe extern "C" fn notify_use_underline_trampoline<F: Fn(&StackPage) + 'static>(
336 this: *mut ffi::GtkStackPage,
337 _param_spec: glib::ffi::gpointer,
338 f: glib::ffi::gpointer,
339 ) {
340 let f: &F = &*(f as *const F);
341 f(&from_glib_borrow(this))
342 }
343 unsafe {
344 let f: Box_<F> = Box_::new(f);
345 connect_raw(
346 self.as_ptr() as *mut _,
347 b"notify::use-underline\0".as_ptr() as *const _,
348 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
349 notify_use_underline_trampoline::<F> as *const (),
350 )),
351 Box_::into_raw(f),
352 )
353 }
354 }
355
356 #[doc(alias = "visible")]
357 pub fn connect_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
358 unsafe extern "C" fn notify_visible_trampoline<F: Fn(&StackPage) + 'static>(
359 this: *mut ffi::GtkStackPage,
360 _param_spec: glib::ffi::gpointer,
361 f: glib::ffi::gpointer,
362 ) {
363 let f: &F = &*(f as *const F);
364 f(&from_glib_borrow(this))
365 }
366 unsafe {
367 let f: Box_<F> = Box_::new(f);
368 connect_raw(
369 self.as_ptr() as *mut _,
370 b"notify::visible\0".as_ptr() as *const _,
371 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
372 notify_visible_trampoline::<F> as *const (),
373 )),
374 Box_::into_raw(f),
375 )
376 }
377 }
378}