gtk4/auto/
assistant_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#![allow(deprecated)]
5
6use crate::{ffi, AssistantPageType, Widget};
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    /// This object will be removed in GTK 5
16    /// [`AssistantPage`][crate::AssistantPage] is an auxiliary object used by [`Assistant`][crate::Assistant].
17    ///
18    /// ## Properties
19    ///
20    ///
21    /// #### `child`
22    ///  The child widget.
23    ///
24    /// Readable | Writeable | Construct Only
25    ///
26    ///
27    /// #### `complete`
28    ///  Whether all required fields are filled in.
29    ///
30    /// GTK uses this information to control the sensitivity
31    /// of the navigation buttons.
32    ///
33    /// Readable | Writeable
34    ///
35    ///
36    /// #### `page-type`
37    ///  The type of the assistant page.
38    ///
39    /// Readable | Writeable
40    ///
41    ///
42    /// #### `title`
43    ///  The title of the page.
44    ///
45    /// Readable | Writeable
46    ///
47    /// # Implements
48    ///
49    /// [`trait@glib::ObjectExt`]
50    #[doc(alias = "GtkAssistantPage")]
51    pub struct AssistantPage(Object<ffi::GtkAssistantPage>);
52
53    match fn {
54        type_ => || ffi::gtk_assistant_page_get_type(),
55    }
56}
57
58impl AssistantPage {
59    /// Returns the child to which @self belongs.
60    ///
61    /// # Deprecated since 4.10
62    ///
63    /// This widget will be removed in GTK 5
64    ///
65    /// # Returns
66    ///
67    /// the child to which @self belongs
68    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
69    #[allow(deprecated)]
70    #[doc(alias = "gtk_assistant_page_get_child")]
71    #[doc(alias = "get_child")]
72    pub fn child(&self) -> Widget {
73        unsafe { from_glib_none(ffi::gtk_assistant_page_get_child(self.to_glib_none().0)) }
74    }
75
76    /// Whether all required fields are filled in.
77    ///
78    /// GTK uses this information to control the sensitivity
79    /// of the navigation buttons.
80    ///
81    /// # Deprecated since 4.10
82    ///
83    /// This object will be removed in GTK 5
84    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
85    pub fn is_complete(&self) -> bool {
86        ObjectExt::property(self, "complete")
87    }
88
89    /// Whether all required fields are filled in.
90    ///
91    /// GTK uses this information to control the sensitivity
92    /// of the navigation buttons.
93    ///
94    /// # Deprecated since 4.10
95    ///
96    /// This object will be removed in GTK 5
97    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
98    pub fn set_complete(&self, complete: bool) {
99        ObjectExt::set_property(self, "complete", complete)
100    }
101
102    /// The type of the assistant page.
103    ///
104    /// # Deprecated since 4.10
105    ///
106    /// This object will be removed in GTK 5
107    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
108    #[doc(alias = "page-type")]
109    pub fn page_type(&self) -> AssistantPageType {
110        ObjectExt::property(self, "page-type")
111    }
112
113    /// The type of the assistant page.
114    ///
115    /// # Deprecated since 4.10
116    ///
117    /// This object will be removed in GTK 5
118    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
119    #[doc(alias = "page-type")]
120    pub fn set_page_type(&self, page_type: AssistantPageType) {
121        ObjectExt::set_property(self, "page-type", page_type)
122    }
123
124    /// The title of the page.
125    ///
126    /// # Deprecated since 4.10
127    ///
128    /// This object will be removed in GTK 5
129    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
130    pub fn title(&self) -> Option<glib::GString> {
131        ObjectExt::property(self, "title")
132    }
133
134    /// The title of the page.
135    ///
136    /// # Deprecated since 4.10
137    ///
138    /// This object will be removed in GTK 5
139    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
140    pub fn set_title(&self, title: Option<&str>) {
141        ObjectExt::set_property(self, "title", title)
142    }
143
144    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
145    #[doc(alias = "complete")]
146    pub fn connect_complete_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
147        unsafe extern "C" fn notify_complete_trampoline<F: Fn(&AssistantPage) + 'static>(
148            this: *mut ffi::GtkAssistantPage,
149            _param_spec: glib::ffi::gpointer,
150            f: glib::ffi::gpointer,
151        ) {
152            let f: &F = &*(f as *const F);
153            f(&from_glib_borrow(this))
154        }
155        unsafe {
156            let f: Box_<F> = Box_::new(f);
157            connect_raw(
158                self.as_ptr() as *mut _,
159                b"notify::complete\0".as_ptr() as *const _,
160                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
161                    notify_complete_trampoline::<F> as *const (),
162                )),
163                Box_::into_raw(f),
164            )
165        }
166    }
167
168    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
169    #[doc(alias = "page-type")]
170    pub fn connect_page_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
171        unsafe extern "C" fn notify_page_type_trampoline<F: Fn(&AssistantPage) + 'static>(
172            this: *mut ffi::GtkAssistantPage,
173            _param_spec: glib::ffi::gpointer,
174            f: glib::ffi::gpointer,
175        ) {
176            let f: &F = &*(f as *const F);
177            f(&from_glib_borrow(this))
178        }
179        unsafe {
180            let f: Box_<F> = Box_::new(f);
181            connect_raw(
182                self.as_ptr() as *mut _,
183                b"notify::page-type\0".as_ptr() as *const _,
184                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
185                    notify_page_type_trampoline::<F> as *const (),
186                )),
187                Box_::into_raw(f),
188            )
189        }
190    }
191
192    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
193    #[doc(alias = "title")]
194    pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
195        unsafe extern "C" fn notify_title_trampoline<F: Fn(&AssistantPage) + 'static>(
196            this: *mut ffi::GtkAssistantPage,
197            _param_spec: glib::ffi::gpointer,
198            f: glib::ffi::gpointer,
199        ) {
200            let f: &F = &*(f as *const F);
201            f(&from_glib_borrow(this))
202        }
203        unsafe {
204            let f: Box_<F> = Box_::new(f);
205            connect_raw(
206                self.as_ptr() as *mut _,
207                b"notify::title\0".as_ptr() as *const _,
208                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
209                    notify_title_trampoline::<F> as *const (),
210                )),
211                Box_::into_raw(f),
212            )
213        }
214    }
215}