libbismuth/auto/
hugger_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::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
8use std::{boxed::Box as Box_};
9
10glib::wrapper! {
11    #[doc(alias = "BisHuggerPage")]
12    pub struct HuggerPage(Object<ffi::BisHuggerPage, ffi::BisHuggerPageClass>);
13
14    match fn {
15        type_ => || ffi::bis_hugger_page_get_type(),
16    }
17}
18
19impl HuggerPage {
20            // rustdoc-stripper-ignore-next
21            /// Creates a new builder-pattern struct instance to construct [`HuggerPage`] objects.
22            ///
23            /// This method returns an instance of [`HuggerPageBuilder`](crate::builders::HuggerPageBuilder) which can be used to create [`HuggerPage`] objects.
24            pub fn builder() -> HuggerPageBuilder {
25                HuggerPageBuilder::new()
26            }
27        
28
29    #[doc(alias = "bis_hugger_page_get_child")]
30    #[doc(alias = "get_child")]
31    pub fn child(&self) -> gtk::Widget {
32        unsafe {
33            from_glib_none(ffi::bis_hugger_page_get_child(self.to_glib_none().0))
34        }
35    }
36
37    #[doc(alias = "bis_hugger_page_get_enabled")]
38    #[doc(alias = "get_enabled")]
39    #[doc(alias = "enabled")]
40    pub fn is_enabled(&self) -> bool {
41        unsafe {
42            from_glib(ffi::bis_hugger_page_get_enabled(self.to_glib_none().0))
43        }
44    }
45
46    #[doc(alias = "bis_hugger_page_set_enabled")]
47    #[doc(alias = "enabled")]
48    pub fn set_enabled(&self, enabled: bool) {
49        unsafe {
50            ffi::bis_hugger_page_set_enabled(self.to_glib_none().0, enabled.into_glib());
51        }
52    }
53
54    #[doc(alias = "enabled")]
55    pub fn connect_enabled_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
56        unsafe extern "C" fn notify_enabled_trampoline<F: Fn(&HuggerPage) + 'static>(this: *mut ffi::BisHuggerPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
57            let f: &F = &*(f as *const F);
58            f(&from_glib_borrow(this))
59        }
60        unsafe {
61            let f: Box_<F> = Box_::new(f);
62            connect_raw(self.as_ptr() as *mut _, b"notify::enabled\0".as_ptr() as *const _,
63                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_enabled_trampoline::<F> as *const ())), Box_::into_raw(f))
64        }
65    }
66}
67
68// rustdoc-stripper-ignore-next
69        /// A [builder-pattern] type to construct [`HuggerPage`] objects.
70        ///
71        /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
72#[must_use = "The builder must be built to be used"]
73pub struct HuggerPageBuilder {
74            builder: glib::object::ObjectBuilder<'static, HuggerPage>,
75        }
76
77        impl HuggerPageBuilder {
78        fn new() -> Self {
79            Self { builder: glib::object::Object::builder() }
80        }
81
82                            pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
83                            Self { builder: self.builder.property("child", child.clone().upcast()), }
84                        }
85
86                            pub fn enabled(self, enabled: bool) -> Self {
87                            Self { builder: self.builder.property("enabled", enabled), }
88                        }
89
90    // rustdoc-stripper-ignore-next
91    /// Build the [`HuggerPage`].
92    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
93    pub fn build(self) -> HuggerPage {
94    self.builder.build() }
95}