1use crate::{Accessible, Widget, ffi};
6use glib::{
7 prelude::*,
8 signal::{SignalHandlerId, connect_raw},
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 unsafe {
249 let f: &F = &*(f as *const F);
250 f(&from_glib_borrow(this))
251 }
252 }
253 unsafe {
254 let f: Box_<F> = Box_::new(f);
255 connect_raw(
256 self.as_ptr() as *mut _,
257 c"notify::icon-name".as_ptr() as *const _,
258 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
259 notify_icon_name_trampoline::<F> as *const (),
260 )),
261 Box_::into_raw(f),
262 )
263 }
264 }
265
266 #[doc(alias = "name")]
267 pub fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
268 unsafe extern "C" fn notify_name_trampoline<F: Fn(&StackPage) + 'static>(
269 this: *mut ffi::GtkStackPage,
270 _param_spec: glib::ffi::gpointer,
271 f: glib::ffi::gpointer,
272 ) {
273 unsafe {
274 let f: &F = &*(f as *const F);
275 f(&from_glib_borrow(this))
276 }
277 }
278 unsafe {
279 let f: Box_<F> = Box_::new(f);
280 connect_raw(
281 self.as_ptr() as *mut _,
282 c"notify::name".as_ptr() as *const _,
283 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
284 notify_name_trampoline::<F> as *const (),
285 )),
286 Box_::into_raw(f),
287 )
288 }
289 }
290
291 #[doc(alias = "needs-attention")]
292 pub fn connect_needs_attention_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
293 unsafe extern "C" fn notify_needs_attention_trampoline<F: Fn(&StackPage) + 'static>(
294 this: *mut ffi::GtkStackPage,
295 _param_spec: glib::ffi::gpointer,
296 f: glib::ffi::gpointer,
297 ) {
298 unsafe {
299 let f: &F = &*(f as *const F);
300 f(&from_glib_borrow(this))
301 }
302 }
303 unsafe {
304 let f: Box_<F> = Box_::new(f);
305 connect_raw(
306 self.as_ptr() as *mut _,
307 c"notify::needs-attention".as_ptr() as *const _,
308 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
309 notify_needs_attention_trampoline::<F> as *const (),
310 )),
311 Box_::into_raw(f),
312 )
313 }
314 }
315
316 #[doc(alias = "title")]
317 pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
318 unsafe extern "C" fn notify_title_trampoline<F: Fn(&StackPage) + 'static>(
319 this: *mut ffi::GtkStackPage,
320 _param_spec: glib::ffi::gpointer,
321 f: glib::ffi::gpointer,
322 ) {
323 unsafe {
324 let f: &F = &*(f as *const F);
325 f(&from_glib_borrow(this))
326 }
327 }
328 unsafe {
329 let f: Box_<F> = Box_::new(f);
330 connect_raw(
331 self.as_ptr() as *mut _,
332 c"notify::title".as_ptr() as *const _,
333 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
334 notify_title_trampoline::<F> as *const (),
335 )),
336 Box_::into_raw(f),
337 )
338 }
339 }
340
341 #[doc(alias = "use-underline")]
342 pub fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
343 unsafe extern "C" fn notify_use_underline_trampoline<F: Fn(&StackPage) + 'static>(
344 this: *mut ffi::GtkStackPage,
345 _param_spec: glib::ffi::gpointer,
346 f: glib::ffi::gpointer,
347 ) {
348 unsafe {
349 let f: &F = &*(f as *const F);
350 f(&from_glib_borrow(this))
351 }
352 }
353 unsafe {
354 let f: Box_<F> = Box_::new(f);
355 connect_raw(
356 self.as_ptr() as *mut _,
357 c"notify::use-underline".as_ptr() as *const _,
358 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
359 notify_use_underline_trampoline::<F> as *const (),
360 )),
361 Box_::into_raw(f),
362 )
363 }
364 }
365
366 #[doc(alias = "visible")]
367 pub fn connect_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
368 unsafe extern "C" fn notify_visible_trampoline<F: Fn(&StackPage) + 'static>(
369 this: *mut ffi::GtkStackPage,
370 _param_spec: glib::ffi::gpointer,
371 f: glib::ffi::gpointer,
372 ) {
373 unsafe {
374 let f: &F = &*(f as *const F);
375 f(&from_glib_borrow(this))
376 }
377 }
378 unsafe {
379 let f: Box_<F> = Box_::new(f);
380 connect_raw(
381 self.as_ptr() as *mut _,
382 c"notify::visible".as_ptr() as *const _,
383 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
384 notify_visible_trampoline::<F> as *const (),
385 )),
386 Box_::into_raw(f),
387 )
388 }
389 }
390}