1use crate::{Align, Buildable, Container, ResizeMode, StackTransitionType, Widget};
6use glib::{
7 prelude::*,
8 signal::{connect_raw, SignalHandlerId},
9 translate::*,
10};
11use std::{boxed::Box as Box_, fmt, mem::transmute};
12
13glib::wrapper! {
14 #[doc(alias = "GtkStack")]
15 pub struct Stack(Object<ffi::GtkStack, ffi::GtkStackClass>) @extends Container, Widget, @implements Buildable;
16
17 match fn {
18 type_ => || ffi::gtk_stack_get_type(),
19 }
20}
21
22impl Stack {
23 pub const NONE: Option<&'static Stack> = None;
24
25 #[doc(alias = "gtk_stack_new")]
26 pub fn new() -> Stack {
27 assert_initialized_main_thread!();
28 unsafe { Widget::from_glib_none(ffi::gtk_stack_new()).unsafe_cast() }
29 }
30
31 pub fn builder() -> StackBuilder {
36 StackBuilder::new()
37 }
38}
39
40impl Default for Stack {
41 fn default() -> Self {
42 Self::new()
43 }
44}
45
46#[must_use = "The builder must be built to be used"]
51pub struct StackBuilder {
52 builder: glib::object::ObjectBuilder<'static, Stack>,
53}
54
55impl StackBuilder {
56 fn new() -> Self {
57 Self {
58 builder: glib::object::Object::builder(),
59 }
60 }
61
62 pub fn hhomogeneous(self, hhomogeneous: bool) -> Self {
63 Self {
64 builder: self.builder.property("hhomogeneous", hhomogeneous),
65 }
66 }
67
68 pub fn homogeneous(self, homogeneous: bool) -> Self {
69 Self {
70 builder: self.builder.property("homogeneous", homogeneous),
71 }
72 }
73
74 pub fn interpolate_size(self, interpolate_size: bool) -> Self {
75 Self {
76 builder: self.builder.property("interpolate-size", interpolate_size),
77 }
78 }
79
80 pub fn transition_duration(self, transition_duration: u32) -> Self {
81 Self {
82 builder: self
83 .builder
84 .property("transition-duration", transition_duration),
85 }
86 }
87
88 pub fn transition_type(self, transition_type: StackTransitionType) -> Self {
89 Self {
90 builder: self.builder.property("transition-type", transition_type),
91 }
92 }
93
94 pub fn vhomogeneous(self, vhomogeneous: bool) -> Self {
95 Self {
96 builder: self.builder.property("vhomogeneous", vhomogeneous),
97 }
98 }
99
100 pub fn visible_child(self, visible_child: &impl IsA<Widget>) -> Self {
101 Self {
102 builder: self
103 .builder
104 .property("visible-child", visible_child.clone().upcast()),
105 }
106 }
107
108 pub fn visible_child_name(self, visible_child_name: impl Into<glib::GString>) -> Self {
109 Self {
110 builder: self
111 .builder
112 .property("visible-child-name", visible_child_name.into()),
113 }
114 }
115
116 pub fn border_width(self, border_width: u32) -> Self {
117 Self {
118 builder: self.builder.property("border-width", border_width),
119 }
120 }
121
122 pub fn child(self, child: &impl IsA<Widget>) -> Self {
123 Self {
124 builder: self.builder.property("child", child.clone().upcast()),
125 }
126 }
127
128 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
129 Self {
130 builder: self.builder.property("resize-mode", resize_mode),
131 }
132 }
133
134 pub fn app_paintable(self, app_paintable: bool) -> Self {
135 Self {
136 builder: self.builder.property("app-paintable", app_paintable),
137 }
138 }
139
140 pub fn can_default(self, can_default: bool) -> Self {
141 Self {
142 builder: self.builder.property("can-default", can_default),
143 }
144 }
145
146 pub fn can_focus(self, can_focus: bool) -> Self {
147 Self {
148 builder: self.builder.property("can-focus", can_focus),
149 }
150 }
151
152 pub fn events(self, events: gdk::EventMask) -> Self {
153 Self {
154 builder: self.builder.property("events", events),
155 }
156 }
157
158 pub fn expand(self, expand: bool) -> Self {
159 Self {
160 builder: self.builder.property("expand", expand),
161 }
162 }
163
164 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
165 Self {
166 builder: self.builder.property("focus-on-click", focus_on_click),
167 }
168 }
169
170 pub fn halign(self, halign: Align) -> Self {
171 Self {
172 builder: self.builder.property("halign", halign),
173 }
174 }
175
176 pub fn has_default(self, has_default: bool) -> Self {
177 Self {
178 builder: self.builder.property("has-default", has_default),
179 }
180 }
181
182 pub fn has_focus(self, has_focus: bool) -> Self {
183 Self {
184 builder: self.builder.property("has-focus", has_focus),
185 }
186 }
187
188 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
189 Self {
190 builder: self.builder.property("has-tooltip", has_tooltip),
191 }
192 }
193
194 pub fn height_request(self, height_request: i32) -> Self {
195 Self {
196 builder: self.builder.property("height-request", height_request),
197 }
198 }
199
200 pub fn hexpand(self, hexpand: bool) -> Self {
201 Self {
202 builder: self.builder.property("hexpand", hexpand),
203 }
204 }
205
206 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
207 Self {
208 builder: self.builder.property("hexpand-set", hexpand_set),
209 }
210 }
211
212 pub fn is_focus(self, is_focus: bool) -> Self {
213 Self {
214 builder: self.builder.property("is-focus", is_focus),
215 }
216 }
217
218 pub fn margin(self, margin: i32) -> Self {
219 Self {
220 builder: self.builder.property("margin", margin),
221 }
222 }
223
224 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
225 Self {
226 builder: self.builder.property("margin-bottom", margin_bottom),
227 }
228 }
229
230 pub fn margin_end(self, margin_end: i32) -> Self {
231 Self {
232 builder: self.builder.property("margin-end", margin_end),
233 }
234 }
235
236 pub fn margin_start(self, margin_start: i32) -> Self {
237 Self {
238 builder: self.builder.property("margin-start", margin_start),
239 }
240 }
241
242 pub fn margin_top(self, margin_top: i32) -> Self {
243 Self {
244 builder: self.builder.property("margin-top", margin_top),
245 }
246 }
247
248 pub fn name(self, name: impl Into<glib::GString>) -> Self {
249 Self {
250 builder: self.builder.property("name", name.into()),
251 }
252 }
253
254 pub fn no_show_all(self, no_show_all: bool) -> Self {
255 Self {
256 builder: self.builder.property("no-show-all", no_show_all),
257 }
258 }
259
260 pub fn opacity(self, opacity: f64) -> Self {
261 Self {
262 builder: self.builder.property("opacity", opacity),
263 }
264 }
265
266 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
267 Self {
268 builder: self.builder.property("parent", parent.clone().upcast()),
269 }
270 }
271
272 pub fn receives_default(self, receives_default: bool) -> Self {
273 Self {
274 builder: self.builder.property("receives-default", receives_default),
275 }
276 }
277
278 pub fn sensitive(self, sensitive: bool) -> Self {
279 Self {
280 builder: self.builder.property("sensitive", sensitive),
281 }
282 }
283
284 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
285 Self {
286 builder: self
287 .builder
288 .property("tooltip-markup", tooltip_markup.into()),
289 }
290 }
291
292 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
293 Self {
294 builder: self.builder.property("tooltip-text", tooltip_text.into()),
295 }
296 }
297
298 pub fn valign(self, valign: Align) -> Self {
299 Self {
300 builder: self.builder.property("valign", valign),
301 }
302 }
303
304 pub fn vexpand(self, vexpand: bool) -> Self {
305 Self {
306 builder: self.builder.property("vexpand", vexpand),
307 }
308 }
309
310 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
311 Self {
312 builder: self.builder.property("vexpand-set", vexpand_set),
313 }
314 }
315
316 pub fn visible(self, visible: bool) -> Self {
317 Self {
318 builder: self.builder.property("visible", visible),
319 }
320 }
321
322 pub fn width_request(self, width_request: i32) -> Self {
323 Self {
324 builder: self.builder.property("width-request", width_request),
325 }
326 }
327
328 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
331 pub fn build(self) -> Stack {
332 self.builder.build()
333 }
334}
335
336mod sealed {
337 pub trait Sealed {}
338 impl<T: super::IsA<super::Stack>> Sealed for T {}
339}
340
341pub trait StackExt: IsA<Stack> + sealed::Sealed + 'static {
342 #[doc(alias = "gtk_stack_add_named")]
343 fn add_named(&self, child: &impl IsA<Widget>, name: &str) {
344 unsafe {
345 ffi::gtk_stack_add_named(
346 self.as_ref().to_glib_none().0,
347 child.as_ref().to_glib_none().0,
348 name.to_glib_none().0,
349 );
350 }
351 }
352
353 #[doc(alias = "gtk_stack_add_titled")]
354 fn add_titled(&self, child: &impl IsA<Widget>, name: &str, title: &str) {
355 unsafe {
356 ffi::gtk_stack_add_titled(
357 self.as_ref().to_glib_none().0,
358 child.as_ref().to_glib_none().0,
359 name.to_glib_none().0,
360 title.to_glib_none().0,
361 );
362 }
363 }
364
365 #[doc(alias = "gtk_stack_get_child_by_name")]
366 #[doc(alias = "get_child_by_name")]
367 fn child_by_name(&self, name: &str) -> Option<Widget> {
368 unsafe {
369 from_glib_none(ffi::gtk_stack_get_child_by_name(
370 self.as_ref().to_glib_none().0,
371 name.to_glib_none().0,
372 ))
373 }
374 }
375
376 #[doc(alias = "gtk_stack_get_hhomogeneous")]
377 #[doc(alias = "get_hhomogeneous")]
378 fn is_hhomogeneous(&self) -> bool {
379 unsafe {
380 from_glib(ffi::gtk_stack_get_hhomogeneous(
381 self.as_ref().to_glib_none().0,
382 ))
383 }
384 }
385
386 #[doc(alias = "gtk_stack_get_homogeneous")]
387 #[doc(alias = "get_homogeneous")]
388 fn is_homogeneous(&self) -> bool {
389 unsafe {
390 from_glib(ffi::gtk_stack_get_homogeneous(
391 self.as_ref().to_glib_none().0,
392 ))
393 }
394 }
395
396 #[doc(alias = "gtk_stack_get_interpolate_size")]
397 #[doc(alias = "get_interpolate_size")]
398 fn interpolates_size(&self) -> bool {
399 unsafe {
400 from_glib(ffi::gtk_stack_get_interpolate_size(
401 self.as_ref().to_glib_none().0,
402 ))
403 }
404 }
405
406 #[doc(alias = "gtk_stack_get_transition_duration")]
407 #[doc(alias = "get_transition_duration")]
408 fn transition_duration(&self) -> u32 {
409 unsafe { ffi::gtk_stack_get_transition_duration(self.as_ref().to_glib_none().0) }
410 }
411
412 #[doc(alias = "gtk_stack_get_transition_running")]
413 #[doc(alias = "get_transition_running")]
414 fn is_transition_running(&self) -> bool {
415 unsafe {
416 from_glib(ffi::gtk_stack_get_transition_running(
417 self.as_ref().to_glib_none().0,
418 ))
419 }
420 }
421
422 #[doc(alias = "gtk_stack_get_transition_type")]
423 #[doc(alias = "get_transition_type")]
424 fn transition_type(&self) -> StackTransitionType {
425 unsafe {
426 from_glib(ffi::gtk_stack_get_transition_type(
427 self.as_ref().to_glib_none().0,
428 ))
429 }
430 }
431
432 #[doc(alias = "gtk_stack_get_vhomogeneous")]
433 #[doc(alias = "get_vhomogeneous")]
434 fn is_vhomogeneous(&self) -> bool {
435 unsafe {
436 from_glib(ffi::gtk_stack_get_vhomogeneous(
437 self.as_ref().to_glib_none().0,
438 ))
439 }
440 }
441
442 #[doc(alias = "gtk_stack_get_visible_child")]
443 #[doc(alias = "get_visible_child")]
444 fn visible_child(&self) -> Option<Widget> {
445 unsafe {
446 from_glib_none(ffi::gtk_stack_get_visible_child(
447 self.as_ref().to_glib_none().0,
448 ))
449 }
450 }
451
452 #[doc(alias = "gtk_stack_get_visible_child_name")]
453 #[doc(alias = "get_visible_child_name")]
454 fn visible_child_name(&self) -> Option<glib::GString> {
455 unsafe {
456 from_glib_none(ffi::gtk_stack_get_visible_child_name(
457 self.as_ref().to_glib_none().0,
458 ))
459 }
460 }
461
462 #[doc(alias = "gtk_stack_set_hhomogeneous")]
463 fn set_hhomogeneous(&self, hhomogeneous: bool) {
464 unsafe {
465 ffi::gtk_stack_set_hhomogeneous(
466 self.as_ref().to_glib_none().0,
467 hhomogeneous.into_glib(),
468 );
469 }
470 }
471
472 #[doc(alias = "gtk_stack_set_homogeneous")]
473 fn set_homogeneous(&self, homogeneous: bool) {
474 unsafe {
475 ffi::gtk_stack_set_homogeneous(self.as_ref().to_glib_none().0, homogeneous.into_glib());
476 }
477 }
478
479 #[doc(alias = "gtk_stack_set_interpolate_size")]
480 fn set_interpolate_size(&self, interpolate_size: bool) {
481 unsafe {
482 ffi::gtk_stack_set_interpolate_size(
483 self.as_ref().to_glib_none().0,
484 interpolate_size.into_glib(),
485 );
486 }
487 }
488
489 #[doc(alias = "gtk_stack_set_transition_duration")]
490 fn set_transition_duration(&self, duration: u32) {
491 unsafe {
492 ffi::gtk_stack_set_transition_duration(self.as_ref().to_glib_none().0, duration);
493 }
494 }
495
496 #[doc(alias = "gtk_stack_set_transition_type")]
497 fn set_transition_type(&self, transition: StackTransitionType) {
498 unsafe {
499 ffi::gtk_stack_set_transition_type(
500 self.as_ref().to_glib_none().0,
501 transition.into_glib(),
502 );
503 }
504 }
505
506 #[doc(alias = "gtk_stack_set_vhomogeneous")]
507 fn set_vhomogeneous(&self, vhomogeneous: bool) {
508 unsafe {
509 ffi::gtk_stack_set_vhomogeneous(
510 self.as_ref().to_glib_none().0,
511 vhomogeneous.into_glib(),
512 );
513 }
514 }
515
516 #[doc(alias = "gtk_stack_set_visible_child")]
517 fn set_visible_child(&self, child: &impl IsA<Widget>) {
518 unsafe {
519 ffi::gtk_stack_set_visible_child(
520 self.as_ref().to_glib_none().0,
521 child.as_ref().to_glib_none().0,
522 );
523 }
524 }
525
526 #[doc(alias = "gtk_stack_set_visible_child_full")]
527 fn set_visible_child_full(&self, name: &str, transition: StackTransitionType) {
528 unsafe {
529 ffi::gtk_stack_set_visible_child_full(
530 self.as_ref().to_glib_none().0,
531 name.to_glib_none().0,
532 transition.into_glib(),
533 );
534 }
535 }
536
537 #[doc(alias = "gtk_stack_set_visible_child_name")]
538 fn set_visible_child_name(&self, name: &str) {
539 unsafe {
540 ffi::gtk_stack_set_visible_child_name(
541 self.as_ref().to_glib_none().0,
542 name.to_glib_none().0,
543 );
544 }
545 }
546
547 #[doc(alias = "child.icon-name")]
548 fn child_icon_name<T: IsA<crate::Widget>>(&self, item: &T) -> Option<glib::GString> {
549 crate::prelude::ContainerExtManual::child_property(
550 self.as_ref(),
551 &item.clone().upcast(),
552 "icon-name",
553 )
554 }
555
556 #[doc(alias = "child.icon-name")]
557 fn set_child_icon_name<T: IsA<crate::Widget>>(&self, item: &T, icon_name: Option<&str>) {
558 crate::prelude::ContainerExtManual::child_set_property(
559 self.as_ref(),
560 &item.clone().upcast(),
561 "icon-name",
562 &icon_name,
563 )
564 }
565
566 fn child_name<T: IsA<crate::Widget>>(&self, item: &T) -> Option<glib::GString> {
567 crate::prelude::ContainerExtManual::child_property(
568 self.as_ref(),
569 &item.clone().upcast(),
570 "name",
571 )
572 }
573
574 fn set_child_name<T: IsA<crate::Widget>>(&self, item: &T, name: Option<&str>) {
575 crate::prelude::ContainerExtManual::child_set_property(
576 self.as_ref(),
577 &item.clone().upcast(),
578 "name",
579 &name,
580 )
581 }
582
583 #[doc(alias = "child.needs-attention")]
584 fn child_needs_attention<T: IsA<crate::Widget>>(&self, item: &T) -> bool {
585 crate::prelude::ContainerExtManual::child_property(
586 self.as_ref(),
587 &item.clone().upcast(),
588 "needs-attention",
589 )
590 }
591
592 #[doc(alias = "child.needs-attention")]
593 fn set_child_needs_attention<T: IsA<crate::Widget>>(&self, item: &T, needs_attention: bool) {
594 crate::prelude::ContainerExtManual::child_set_property(
595 self.as_ref(),
596 &item.clone().upcast(),
597 "needs-attention",
598 &needs_attention,
599 )
600 }
601
602 fn child_position<T: IsA<crate::Widget>>(&self, item: &T) -> i32 {
603 crate::prelude::ContainerExtManual::child_property(
604 self.as_ref(),
605 &item.clone().upcast(),
606 "position",
607 )
608 }
609
610 fn set_child_position<T: IsA<crate::Widget>>(&self, item: &T, position: i32) {
611 crate::prelude::ContainerExtManual::child_set_property(
612 self.as_ref(),
613 &item.clone().upcast(),
614 "position",
615 &position,
616 )
617 }
618
619 fn child_title<T: IsA<crate::Widget>>(&self, item: &T) -> Option<glib::GString> {
620 crate::prelude::ContainerExtManual::child_property(
621 self.as_ref(),
622 &item.clone().upcast(),
623 "title",
624 )
625 }
626
627 fn set_child_title<T: IsA<crate::Widget>>(&self, item: &T, title: Option<&str>) {
628 crate::prelude::ContainerExtManual::child_set_property(
629 self.as_ref(),
630 &item.clone().upcast(),
631 "title",
632 &title,
633 )
634 }
635
636 #[doc(alias = "hhomogeneous")]
637 fn connect_hhomogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
638 unsafe extern "C" fn notify_hhomogeneous_trampoline<P: IsA<Stack>, F: Fn(&P) + 'static>(
639 this: *mut ffi::GtkStack,
640 _param_spec: glib::ffi::gpointer,
641 f: glib::ffi::gpointer,
642 ) {
643 let f: &F = &*(f as *const F);
644 f(Stack::from_glib_borrow(this).unsafe_cast_ref())
645 }
646 unsafe {
647 let f: Box_<F> = Box_::new(f);
648 connect_raw(
649 self.as_ptr() as *mut _,
650 b"notify::hhomogeneous\0".as_ptr() as *const _,
651 Some(transmute::<_, unsafe extern "C" fn()>(
652 notify_hhomogeneous_trampoline::<Self, F> as *const (),
653 )),
654 Box_::into_raw(f),
655 )
656 }
657 }
658
659 #[doc(alias = "homogeneous")]
660 fn connect_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
661 unsafe extern "C" fn notify_homogeneous_trampoline<P: IsA<Stack>, F: Fn(&P) + 'static>(
662 this: *mut ffi::GtkStack,
663 _param_spec: glib::ffi::gpointer,
664 f: glib::ffi::gpointer,
665 ) {
666 let f: &F = &*(f as *const F);
667 f(Stack::from_glib_borrow(this).unsafe_cast_ref())
668 }
669 unsafe {
670 let f: Box_<F> = Box_::new(f);
671 connect_raw(
672 self.as_ptr() as *mut _,
673 b"notify::homogeneous\0".as_ptr() as *const _,
674 Some(transmute::<_, unsafe extern "C" fn()>(
675 notify_homogeneous_trampoline::<Self, F> as *const (),
676 )),
677 Box_::into_raw(f),
678 )
679 }
680 }
681
682 #[doc(alias = "interpolate-size")]
683 fn connect_interpolate_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
684 unsafe extern "C" fn notify_interpolate_size_trampoline<
685 P: IsA<Stack>,
686 F: Fn(&P) + 'static,
687 >(
688 this: *mut ffi::GtkStack,
689 _param_spec: glib::ffi::gpointer,
690 f: glib::ffi::gpointer,
691 ) {
692 let f: &F = &*(f as *const F);
693 f(Stack::from_glib_borrow(this).unsafe_cast_ref())
694 }
695 unsafe {
696 let f: Box_<F> = Box_::new(f);
697 connect_raw(
698 self.as_ptr() as *mut _,
699 b"notify::interpolate-size\0".as_ptr() as *const _,
700 Some(transmute::<_, unsafe extern "C" fn()>(
701 notify_interpolate_size_trampoline::<Self, F> as *const (),
702 )),
703 Box_::into_raw(f),
704 )
705 }
706 }
707
708 #[doc(alias = "transition-duration")]
709 fn connect_transition_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
710 unsafe extern "C" fn notify_transition_duration_trampoline<
711 P: IsA<Stack>,
712 F: Fn(&P) + 'static,
713 >(
714 this: *mut ffi::GtkStack,
715 _param_spec: glib::ffi::gpointer,
716 f: glib::ffi::gpointer,
717 ) {
718 let f: &F = &*(f as *const F);
719 f(Stack::from_glib_borrow(this).unsafe_cast_ref())
720 }
721 unsafe {
722 let f: Box_<F> = Box_::new(f);
723 connect_raw(
724 self.as_ptr() as *mut _,
725 b"notify::transition-duration\0".as_ptr() as *const _,
726 Some(transmute::<_, unsafe extern "C" fn()>(
727 notify_transition_duration_trampoline::<Self, F> as *const (),
728 )),
729 Box_::into_raw(f),
730 )
731 }
732 }
733
734 #[doc(alias = "transition-running")]
735 fn connect_transition_running_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
736 unsafe extern "C" fn notify_transition_running_trampoline<
737 P: IsA<Stack>,
738 F: Fn(&P) + 'static,
739 >(
740 this: *mut ffi::GtkStack,
741 _param_spec: glib::ffi::gpointer,
742 f: glib::ffi::gpointer,
743 ) {
744 let f: &F = &*(f as *const F);
745 f(Stack::from_glib_borrow(this).unsafe_cast_ref())
746 }
747 unsafe {
748 let f: Box_<F> = Box_::new(f);
749 connect_raw(
750 self.as_ptr() as *mut _,
751 b"notify::transition-running\0".as_ptr() as *const _,
752 Some(transmute::<_, unsafe extern "C" fn()>(
753 notify_transition_running_trampoline::<Self, F> as *const (),
754 )),
755 Box_::into_raw(f),
756 )
757 }
758 }
759
760 #[doc(alias = "transition-type")]
761 fn connect_transition_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
762 unsafe extern "C" fn notify_transition_type_trampoline<
763 P: IsA<Stack>,
764 F: Fn(&P) + 'static,
765 >(
766 this: *mut ffi::GtkStack,
767 _param_spec: glib::ffi::gpointer,
768 f: glib::ffi::gpointer,
769 ) {
770 let f: &F = &*(f as *const F);
771 f(Stack::from_glib_borrow(this).unsafe_cast_ref())
772 }
773 unsafe {
774 let f: Box_<F> = Box_::new(f);
775 connect_raw(
776 self.as_ptr() as *mut _,
777 b"notify::transition-type\0".as_ptr() as *const _,
778 Some(transmute::<_, unsafe extern "C" fn()>(
779 notify_transition_type_trampoline::<Self, F> as *const (),
780 )),
781 Box_::into_raw(f),
782 )
783 }
784 }
785
786 #[doc(alias = "vhomogeneous")]
787 fn connect_vhomogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
788 unsafe extern "C" fn notify_vhomogeneous_trampoline<P: IsA<Stack>, F: Fn(&P) + 'static>(
789 this: *mut ffi::GtkStack,
790 _param_spec: glib::ffi::gpointer,
791 f: glib::ffi::gpointer,
792 ) {
793 let f: &F = &*(f as *const F);
794 f(Stack::from_glib_borrow(this).unsafe_cast_ref())
795 }
796 unsafe {
797 let f: Box_<F> = Box_::new(f);
798 connect_raw(
799 self.as_ptr() as *mut _,
800 b"notify::vhomogeneous\0".as_ptr() as *const _,
801 Some(transmute::<_, unsafe extern "C" fn()>(
802 notify_vhomogeneous_trampoline::<Self, F> as *const (),
803 )),
804 Box_::into_raw(f),
805 )
806 }
807 }
808
809 #[doc(alias = "visible-child")]
810 fn connect_visible_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
811 unsafe extern "C" fn notify_visible_child_trampoline<P: IsA<Stack>, F: Fn(&P) + 'static>(
812 this: *mut ffi::GtkStack,
813 _param_spec: glib::ffi::gpointer,
814 f: glib::ffi::gpointer,
815 ) {
816 let f: &F = &*(f as *const F);
817 f(Stack::from_glib_borrow(this).unsafe_cast_ref())
818 }
819 unsafe {
820 let f: Box_<F> = Box_::new(f);
821 connect_raw(
822 self.as_ptr() as *mut _,
823 b"notify::visible-child\0".as_ptr() as *const _,
824 Some(transmute::<_, unsafe extern "C" fn()>(
825 notify_visible_child_trampoline::<Self, F> as *const (),
826 )),
827 Box_::into_raw(f),
828 )
829 }
830 }
831
832 #[doc(alias = "visible-child-name")]
833 fn connect_visible_child_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
834 unsafe extern "C" fn notify_visible_child_name_trampoline<
835 P: IsA<Stack>,
836 F: Fn(&P) + 'static,
837 >(
838 this: *mut ffi::GtkStack,
839 _param_spec: glib::ffi::gpointer,
840 f: glib::ffi::gpointer,
841 ) {
842 let f: &F = &*(f as *const F);
843 f(Stack::from_glib_borrow(this).unsafe_cast_ref())
844 }
845 unsafe {
846 let f: Box_<F> = Box_::new(f);
847 connect_raw(
848 self.as_ptr() as *mut _,
849 b"notify::visible-child-name\0".as_ptr() as *const _,
850 Some(transmute::<_, unsafe extern "C" fn()>(
851 notify_visible_child_name_trampoline::<Self, F> as *const (),
852 )),
853 Box_::into_raw(f),
854 )
855 }
856 }
857}
858
859impl<O: IsA<Stack>> StackExt for O {}
860
861impl fmt::Display for Stack {
862 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
863 f.write_str("Stack")
864 }
865}