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::{AssistantPageType, Widget, ffi};
7use glib::{
8    prelude::*,
9    signal::{SignalHandlerId, connect_raw},
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            unsafe {
153                let f: &F = &*(f as *const F);
154                f(&from_glib_borrow(this))
155            }
156        }
157        unsafe {
158            let f: Box_<F> = Box_::new(f);
159            connect_raw(
160                self.as_ptr() as *mut _,
161                c"notify::complete".as_ptr() as *const _,
162                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
163                    notify_complete_trampoline::<F> as *const (),
164                )),
165                Box_::into_raw(f),
166            )
167        }
168    }
169
170    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
171    #[doc(alias = "page-type")]
172    pub fn connect_page_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
173        unsafe extern "C" fn notify_page_type_trampoline<F: Fn(&AssistantPage) + 'static>(
174            this: *mut ffi::GtkAssistantPage,
175            _param_spec: glib::ffi::gpointer,
176            f: glib::ffi::gpointer,
177        ) {
178            unsafe {
179                let f: &F = &*(f as *const F);
180                f(&from_glib_borrow(this))
181            }
182        }
183        unsafe {
184            let f: Box_<F> = Box_::new(f);
185            connect_raw(
186                self.as_ptr() as *mut _,
187                c"notify::page-type".as_ptr() as *const _,
188                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
189                    notify_page_type_trampoline::<F> as *const (),
190                )),
191                Box_::into_raw(f),
192            )
193        }
194    }
195
196    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
197    #[doc(alias = "title")]
198    pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
199        unsafe extern "C" fn notify_title_trampoline<F: Fn(&AssistantPage) + 'static>(
200            this: *mut ffi::GtkAssistantPage,
201            _param_spec: glib::ffi::gpointer,
202            f: glib::ffi::gpointer,
203        ) {
204            unsafe {
205                let f: &F = &*(f as *const F);
206                f(&from_glib_borrow(this))
207            }
208        }
209        unsafe {
210            let f: Box_<F> = Box_::new(f);
211            connect_raw(
212                self.as_ptr() as *mut _,
213                c"notify::title".as_ptr() as *const _,
214                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
215                    notify_title_trampoline::<F> as *const (),
216                )),
217                Box_::into_raw(f),
218            )
219        }
220    }
221}