1use 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")]
111 pub struct ViewStackPage(Object<ffi::AdwViewStackPage, ffi::AdwViewStackPageClass>) @implements gtk::Accessible;
112
113 match fn {
114 type_ => || ffi::adw_view_stack_page_get_type(),
115 }
116}
117
118impl ViewStackPage {
119 #[doc(alias = "adw_view_stack_page_get_badge_number")]
125 #[doc(alias = "get_badge_number")]
126 #[doc(alias = "badge-number")]
127 pub fn badge_number(&self) -> u32 {
128 unsafe { ffi::adw_view_stack_page_get_badge_number(self.to_glib_none().0) }
129 }
130
131 #[doc(alias = "adw_view_stack_page_get_child")]
137 #[doc(alias = "get_child")]
138 pub fn child(&self) -> gtk::Widget {
139 unsafe { from_glib_none(ffi::adw_view_stack_page_get_child(self.to_glib_none().0)) }
140 }
141
142 #[doc(alias = "adw_view_stack_page_get_icon_name")]
148 #[doc(alias = "get_icon_name")]
149 #[doc(alias = "icon-name")]
150 pub fn icon_name(&self) -> Option<glib::GString> {
151 unsafe {
152 from_glib_none(ffi::adw_view_stack_page_get_icon_name(
153 self.to_glib_none().0,
154 ))
155 }
156 }
157
158 #[doc(alias = "adw_view_stack_page_get_name")]
164 #[doc(alias = "get_name")]
165 pub fn name(&self) -> Option<glib::GString> {
166 unsafe { from_glib_none(ffi::adw_view_stack_page_get_name(self.to_glib_none().0)) }
167 }
168
169 #[doc(alias = "adw_view_stack_page_get_needs_attention")]
175 #[doc(alias = "get_needs_attention")]
176 #[doc(alias = "needs-attention")]
177 pub fn needs_attention(&self) -> bool {
178 unsafe {
179 from_glib(ffi::adw_view_stack_page_get_needs_attention(
180 self.to_glib_none().0,
181 ))
182 }
183 }
184
185 #[cfg(feature = "v1_9")]
191 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
192 #[doc(alias = "adw_view_stack_page_get_section_title")]
193 #[doc(alias = "get_section_title")]
194 #[doc(alias = "section-title")]
195 pub fn section_title(&self) -> Option<glib::GString> {
196 unsafe {
197 from_glib_none(ffi::adw_view_stack_page_get_section_title(
198 self.to_glib_none().0,
199 ))
200 }
201 }
202
203 #[cfg(feature = "v1_9")]
209 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
210 #[doc(alias = "adw_view_stack_page_get_starts_section")]
211 #[doc(alias = "get_starts_section")]
212 #[doc(alias = "starts-section")]
213 pub fn is_starts_section(&self) -> bool {
214 unsafe {
215 from_glib(ffi::adw_view_stack_page_get_starts_section(
216 self.to_glib_none().0,
217 ))
218 }
219 }
220
221 #[doc(alias = "adw_view_stack_page_get_title")]
227 #[doc(alias = "get_title")]
228 pub fn title(&self) -> Option<glib::GString> {
229 unsafe { from_glib_none(ffi::adw_view_stack_page_get_title(self.to_glib_none().0)) }
230 }
231
232 #[doc(alias = "adw_view_stack_page_get_use_underline")]
238 #[doc(alias = "get_use_underline")]
239 #[doc(alias = "use-underline")]
240 pub fn uses_underline(&self) -> bool {
241 unsafe {
242 from_glib(ffi::adw_view_stack_page_get_use_underline(
243 self.to_glib_none().0,
244 ))
245 }
246 }
247
248 #[doc(alias = "adw_view_stack_page_get_visible")]
257 #[doc(alias = "get_visible")]
258 #[doc(alias = "visible")]
259 pub fn is_visible(&self) -> bool {
260 unsafe { from_glib(ffi::adw_view_stack_page_get_visible(self.to_glib_none().0)) }
261 }
262
263 #[doc(alias = "adw_view_stack_page_set_badge_number")]
272 #[doc(alias = "badge-number")]
273 pub fn set_badge_number(&self, badge_number: u32) {
274 unsafe {
275 ffi::adw_view_stack_page_set_badge_number(self.to_glib_none().0, badge_number);
276 }
277 }
278
279 #[doc(alias = "adw_view_stack_page_set_icon_name")]
283 #[doc(alias = "icon-name")]
284 pub fn set_icon_name(&self, icon_name: Option<&str>) {
285 unsafe {
286 ffi::adw_view_stack_page_set_icon_name(
287 self.to_glib_none().0,
288 icon_name.to_glib_none().0,
289 );
290 }
291 }
292
293 #[doc(alias = "adw_view_stack_page_set_name")]
297 #[doc(alias = "name")]
298 pub fn set_name(&self, name: Option<&str>) {
299 unsafe {
300 ffi::adw_view_stack_page_set_name(self.to_glib_none().0, name.to_glib_none().0);
301 }
302 }
303
304 #[doc(alias = "adw_view_stack_page_set_needs_attention")]
310 #[doc(alias = "needs-attention")]
311 pub fn set_needs_attention(&self, needs_attention: bool) {
312 unsafe {
313 ffi::adw_view_stack_page_set_needs_attention(
314 self.to_glib_none().0,
315 needs_attention.into_glib(),
316 );
317 }
318 }
319
320 #[cfg(feature = "v1_9")]
326 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
327 #[doc(alias = "adw_view_stack_page_set_section_title")]
328 #[doc(alias = "section-title")]
329 pub fn set_section_title(&self, section_title: Option<&str>) {
330 unsafe {
331 ffi::adw_view_stack_page_set_section_title(
332 self.to_glib_none().0,
333 section_title.to_glib_none().0,
334 );
335 }
336 }
337
338 #[cfg(feature = "v1_9")]
348 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
349 #[doc(alias = "adw_view_stack_page_set_starts_section")]
350 #[doc(alias = "starts-section")]
351 pub fn set_starts_section(&self, starts_section: bool) {
352 unsafe {
353 ffi::adw_view_stack_page_set_starts_section(
354 self.to_glib_none().0,
355 starts_section.into_glib(),
356 );
357 }
358 }
359
360 #[doc(alias = "adw_view_stack_page_set_title")]
364 #[doc(alias = "title")]
365 pub fn set_title(&self, title: Option<&str>) {
366 unsafe {
367 ffi::adw_view_stack_page_set_title(self.to_glib_none().0, title.to_glib_none().0);
368 }
369 }
370
371 #[doc(alias = "adw_view_stack_page_set_use_underline")]
375 #[doc(alias = "use-underline")]
376 pub fn set_use_underline(&self, use_underline: bool) {
377 unsafe {
378 ffi::adw_view_stack_page_set_use_underline(
379 self.to_glib_none().0,
380 use_underline.into_glib(),
381 );
382 }
383 }
384
385 #[doc(alias = "adw_view_stack_page_set_visible")]
392 #[doc(alias = "visible")]
393 pub fn set_visible(&self, visible: bool) {
394 unsafe {
395 ffi::adw_view_stack_page_set_visible(self.to_glib_none().0, visible.into_glib());
396 }
397 }
398
399 #[doc(alias = "badge-number")]
400 pub fn connect_badge_number_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
401 unsafe extern "C" fn notify_badge_number_trampoline<F: Fn(&ViewStackPage) + 'static>(
402 this: *mut ffi::AdwViewStackPage,
403 _param_spec: glib::ffi::gpointer,
404 f: glib::ffi::gpointer,
405 ) {
406 unsafe {
407 let f: &F = &*(f as *const F);
408 f(&from_glib_borrow(this))
409 }
410 }
411 unsafe {
412 let f: Box_<F> = Box_::new(f);
413 connect_raw(
414 self.as_ptr() as *mut _,
415 c"notify::badge-number".as_ptr() as *const _,
416 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
417 notify_badge_number_trampoline::<F> as *const (),
418 )),
419 Box_::into_raw(f),
420 )
421 }
422 }
423
424 #[doc(alias = "icon-name")]
425 pub fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
426 unsafe extern "C" fn notify_icon_name_trampoline<F: Fn(&ViewStackPage) + 'static>(
427 this: *mut ffi::AdwViewStackPage,
428 _param_spec: glib::ffi::gpointer,
429 f: glib::ffi::gpointer,
430 ) {
431 unsafe {
432 let f: &F = &*(f as *const F);
433 f(&from_glib_borrow(this))
434 }
435 }
436 unsafe {
437 let f: Box_<F> = Box_::new(f);
438 connect_raw(
439 self.as_ptr() as *mut _,
440 c"notify::icon-name".as_ptr() as *const _,
441 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
442 notify_icon_name_trampoline::<F> as *const (),
443 )),
444 Box_::into_raw(f),
445 )
446 }
447 }
448
449 #[doc(alias = "name")]
450 pub fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
451 unsafe extern "C" fn notify_name_trampoline<F: Fn(&ViewStackPage) + 'static>(
452 this: *mut ffi::AdwViewStackPage,
453 _param_spec: glib::ffi::gpointer,
454 f: glib::ffi::gpointer,
455 ) {
456 unsafe {
457 let f: &F = &*(f as *const F);
458 f(&from_glib_borrow(this))
459 }
460 }
461 unsafe {
462 let f: Box_<F> = Box_::new(f);
463 connect_raw(
464 self.as_ptr() as *mut _,
465 c"notify::name".as_ptr() as *const _,
466 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
467 notify_name_trampoline::<F> as *const (),
468 )),
469 Box_::into_raw(f),
470 )
471 }
472 }
473
474 #[doc(alias = "needs-attention")]
475 pub fn connect_needs_attention_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
476 unsafe extern "C" fn notify_needs_attention_trampoline<F: Fn(&ViewStackPage) + 'static>(
477 this: *mut ffi::AdwViewStackPage,
478 _param_spec: glib::ffi::gpointer,
479 f: glib::ffi::gpointer,
480 ) {
481 unsafe {
482 let f: &F = &*(f as *const F);
483 f(&from_glib_borrow(this))
484 }
485 }
486 unsafe {
487 let f: Box_<F> = Box_::new(f);
488 connect_raw(
489 self.as_ptr() as *mut _,
490 c"notify::needs-attention".as_ptr() as *const _,
491 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
492 notify_needs_attention_trampoline::<F> as *const (),
493 )),
494 Box_::into_raw(f),
495 )
496 }
497 }
498
499 #[cfg(feature = "v1_9")]
500 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
501 #[doc(alias = "section-title")]
502 pub fn connect_section_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
503 unsafe extern "C" fn notify_section_title_trampoline<F: Fn(&ViewStackPage) + 'static>(
504 this: *mut ffi::AdwViewStackPage,
505 _param_spec: glib::ffi::gpointer,
506 f: glib::ffi::gpointer,
507 ) {
508 unsafe {
509 let f: &F = &*(f as *const F);
510 f(&from_glib_borrow(this))
511 }
512 }
513 unsafe {
514 let f: Box_<F> = Box_::new(f);
515 connect_raw(
516 self.as_ptr() as *mut _,
517 c"notify::section-title".as_ptr() as *const _,
518 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
519 notify_section_title_trampoline::<F> as *const (),
520 )),
521 Box_::into_raw(f),
522 )
523 }
524 }
525
526 #[cfg(feature = "v1_9")]
527 #[cfg_attr(docsrs, doc(cfg(feature = "v1_9")))]
528 #[doc(alias = "starts-section")]
529 pub fn connect_starts_section_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
530 unsafe extern "C" fn notify_starts_section_trampoline<F: Fn(&ViewStackPage) + 'static>(
531 this: *mut ffi::AdwViewStackPage,
532 _param_spec: glib::ffi::gpointer,
533 f: glib::ffi::gpointer,
534 ) {
535 unsafe {
536 let f: &F = &*(f as *const F);
537 f(&from_glib_borrow(this))
538 }
539 }
540 unsafe {
541 let f: Box_<F> = Box_::new(f);
542 connect_raw(
543 self.as_ptr() as *mut _,
544 c"notify::starts-section".as_ptr() as *const _,
545 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
546 notify_starts_section_trampoline::<F> as *const (),
547 )),
548 Box_::into_raw(f),
549 )
550 }
551 }
552
553 #[doc(alias = "title")]
554 pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
555 unsafe extern "C" fn notify_title_trampoline<F: Fn(&ViewStackPage) + 'static>(
556 this: *mut ffi::AdwViewStackPage,
557 _param_spec: glib::ffi::gpointer,
558 f: glib::ffi::gpointer,
559 ) {
560 unsafe {
561 let f: &F = &*(f as *const F);
562 f(&from_glib_borrow(this))
563 }
564 }
565 unsafe {
566 let f: Box_<F> = Box_::new(f);
567 connect_raw(
568 self.as_ptr() as *mut _,
569 c"notify::title".as_ptr() as *const _,
570 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
571 notify_title_trampoline::<F> as *const (),
572 )),
573 Box_::into_raw(f),
574 )
575 }
576 }
577
578 #[doc(alias = "use-underline")]
579 pub fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
580 unsafe extern "C" fn notify_use_underline_trampoline<F: Fn(&ViewStackPage) + 'static>(
581 this: *mut ffi::AdwViewStackPage,
582 _param_spec: glib::ffi::gpointer,
583 f: glib::ffi::gpointer,
584 ) {
585 unsafe {
586 let f: &F = &*(f as *const F);
587 f(&from_glib_borrow(this))
588 }
589 }
590 unsafe {
591 let f: Box_<F> = Box_::new(f);
592 connect_raw(
593 self.as_ptr() as *mut _,
594 c"notify::use-underline".as_ptr() as *const _,
595 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
596 notify_use_underline_trampoline::<F> as *const (),
597 )),
598 Box_::into_raw(f),
599 )
600 }
601 }
602
603 #[doc(alias = "visible")]
604 pub fn connect_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
605 unsafe extern "C" fn notify_visible_trampoline<F: Fn(&ViewStackPage) + 'static>(
606 this: *mut ffi::AdwViewStackPage,
607 _param_spec: glib::ffi::gpointer,
608 f: glib::ffi::gpointer,
609 ) {
610 unsafe {
611 let f: &F = &*(f as *const F);
612 f(&from_glib_borrow(this))
613 }
614 }
615 unsafe {
616 let f: Box_<F> = Box_::new(f);
617 connect_raw(
618 self.as_ptr() as *mut _,
619 c"notify::visible".as_ptr() as *const _,
620 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
621 notify_visible_trampoline::<F> as *const (),
622 )),
623 Box_::into_raw(f),
624 )
625 }
626 }
627}