Skip to main content

gtk/auto/
stack.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
5use crate::{Align, Buildable, Container, ResizeMode, StackTransitionType, Widget, ffi};
6use glib::{
7    prelude::*,
8    signal::{SignalHandlerId, connect_raw},
9    translate::*,
10};
11use std::boxed::Box as Box_;
12
13glib::wrapper! {
14    /// The GtkStack widget is a container which only shows
15    /// one of its children at a time. In contrast to GtkNotebook,
16    /// GtkStack does not provide a means for users to change the
17    /// visible child. Instead, the [`StackSwitcher`][crate::StackSwitcher] widget can be
18    /// used with GtkStack to provide this functionality.
19    ///
20    /// Transitions between pages can be animated as slides or
21    /// fades. This can be controlled with [`StackExt::set_transition_type()`][crate::prelude::StackExt::set_transition_type()].
22    /// These animations respect the [`gtk-enable-animations`][struct@crate::Settings#gtk-enable-animations]
23    /// setting.
24    ///
25    /// The GtkStack widget was added in GTK+ 3.10.
26    ///
27    /// # CSS nodes
28    ///
29    /// GtkStack has a single CSS node named stack.
30    ///
31    /// ## Properties
32    ///
33    ///
34    /// #### `hhomogeneous`
35    ///  [`true`] if the stack allocates the same width for all children.
36    ///
37    /// Readable | Writable
38    ///
39    ///
40    /// #### `homogeneous`
41    ///  Readable | Writable
42    ///
43    ///
44    /// #### `interpolate-size`
45    ///  Readable | Writable
46    ///
47    ///
48    /// #### `transition-duration`
49    ///  Readable | Writable
50    ///
51    ///
52    /// #### `transition-running`
53    ///  Readable
54    ///
55    ///
56    /// #### `transition-type`
57    ///  Readable | Writable
58    ///
59    ///
60    /// #### `vhomogeneous`
61    ///  [`true`] if the stack allocates the same height for all children.
62    ///
63    /// Readable | Writable
64    ///
65    ///
66    /// #### `visible-child`
67    ///  Readable | Writable
68    ///
69    ///
70    /// #### `visible-child-name`
71    ///  Readable | Writable
72    /// <details><summary><h4>Container</h4></summary>
73    ///
74    ///
75    /// #### `border-width`
76    ///  Readable | Writable
77    ///
78    ///
79    /// #### `child`
80    ///  Writable
81    ///
82    ///
83    /// #### `resize-mode`
84    ///  Readable | Writable
85    /// </details>
86    /// <details><summary><h4>Widget</h4></summary>
87    ///
88    ///
89    /// #### `app-paintable`
90    ///  Readable | Writable
91    ///
92    ///
93    /// #### `can-default`
94    ///  Readable | Writable
95    ///
96    ///
97    /// #### `can-focus`
98    ///  Readable | Writable
99    ///
100    ///
101    /// #### `composite-child`
102    ///  Readable
103    ///
104    ///
105    /// #### `double-buffered`
106    ///  Whether the widget is double buffered.
107    ///
108    /// Readable | Writable
109    ///
110    ///
111    /// #### `events`
112    ///  Readable | Writable
113    ///
114    ///
115    /// #### `expand`
116    ///  Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
117    ///
118    /// Readable | Writable
119    ///
120    ///
121    /// #### `focus-on-click`
122    ///  Whether the widget should grab focus when it is clicked with the mouse.
123    ///
124    /// This property is only relevant for widgets that can take focus.
125    ///
126    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
127    /// GtkComboBox) implemented this property individually.
128    ///
129    /// Readable | Writable
130    ///
131    ///
132    /// #### `halign`
133    ///  How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
134    ///
135    /// Readable | Writable
136    ///
137    ///
138    /// #### `has-default`
139    ///  Readable | Writable
140    ///
141    ///
142    /// #### `has-focus`
143    ///  Readable | Writable
144    ///
145    ///
146    /// #### `has-tooltip`
147    ///  Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
148    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
149    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
150    /// whether it will provide a tooltip or not.
151    ///
152    /// Note that setting this property to [`true`] for the first time will change
153    /// the event masks of the GdkWindows of this widget to include leave-notify
154    /// and motion-notify events. This cannot and will not be undone when the
155    /// property is set to [`false`] again.
156    ///
157    /// Readable | Writable
158    ///
159    ///
160    /// #### `height-request`
161    ///  Readable | Writable
162    ///
163    ///
164    /// #### `hexpand`
165    ///  Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
166    ///
167    /// Readable | Writable
168    ///
169    ///
170    /// #### `hexpand-set`
171    ///  Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
172    ///
173    /// Readable | Writable
174    ///
175    ///
176    /// #### `is-focus`
177    ///  Readable | Writable
178    ///
179    ///
180    /// #### `margin`
181    ///  Sets all four sides' margin at once. If read, returns max
182    /// margin on any side.
183    ///
184    /// Readable | Writable
185    ///
186    ///
187    /// #### `margin-bottom`
188    ///  Margin on bottom side of widget.
189    ///
190    /// This property adds margin outside of the widget's normal size
191    /// request, the margin will be added in addition to the size from
192    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
193    ///
194    /// Readable | Writable
195    ///
196    ///
197    /// #### `margin-end`
198    ///  Margin on end of widget, horizontally. This property supports
199    /// left-to-right and right-to-left text directions.
200    ///
201    /// This property adds margin outside of the widget's normal size
202    /// request, the margin will be added in addition to the size from
203    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
204    ///
205    /// Readable | Writable
206    ///
207    ///
208    /// #### `margin-left`
209    ///  Margin on left side of widget.
210    ///
211    /// This property adds margin outside of the widget's normal size
212    /// request, the margin will be added in addition to the size from
213    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
214    ///
215    /// Readable | Writable
216    ///
217    ///
218    /// #### `margin-right`
219    ///  Margin on right side of widget.
220    ///
221    /// This property adds margin outside of the widget's normal size
222    /// request, the margin will be added in addition to the size from
223    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
224    ///
225    /// Readable | Writable
226    ///
227    ///
228    /// #### `margin-start`
229    ///  Margin on start of widget, horizontally. This property supports
230    /// left-to-right and right-to-left text directions.
231    ///
232    /// This property adds margin outside of the widget's normal size
233    /// request, the margin will be added in addition to the size from
234    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
235    ///
236    /// Readable | Writable
237    ///
238    ///
239    /// #### `margin-top`
240    ///  Margin on top side of widget.
241    ///
242    /// This property adds margin outside of the widget's normal size
243    /// request, the margin will be added in addition to the size from
244    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
245    ///
246    /// Readable | Writable
247    ///
248    ///
249    /// #### `name`
250    ///  Readable | Writable
251    ///
252    ///
253    /// #### `no-show-all`
254    ///  Readable | Writable
255    ///
256    ///
257    /// #### `opacity`
258    ///  The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
259    /// more details about window opacity.
260    ///
261    /// Before 3.8 this was only available in GtkWindow
262    ///
263    /// Readable | Writable
264    ///
265    ///
266    /// #### `parent`
267    ///  Readable | Writable
268    ///
269    ///
270    /// #### `receives-default`
271    ///  Readable | Writable
272    ///
273    ///
274    /// #### `scale-factor`
275    ///  The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
276    /// more details about widget scaling.
277    ///
278    /// Readable
279    ///
280    ///
281    /// #### `sensitive`
282    ///  Readable | Writable
283    ///
284    ///
285    /// #### `style`
286    ///  The style of the widget, which contains information about how it will look (colors, etc).
287    ///
288    /// Readable | Writable
289    ///
290    ///
291    /// #### `tooltip-markup`
292    ///  Sets the text of tooltip to be the given string, which is marked up
293    /// with the [Pango text markup language][PangoMarkupFormat].
294    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
295    ///
296    /// This is a convenience property which will take care of getting the
297    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
298    /// will automatically be set to [`true`] and there will be taken care of
299    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
300    ///
301    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
302    /// are set, the last one wins.
303    ///
304    /// Readable | Writable
305    ///
306    ///
307    /// #### `tooltip-text`
308    ///  Sets the text of tooltip to be the given string.
309    ///
310    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
311    ///
312    /// This is a convenience property which will take care of getting the
313    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
314    /// will automatically be set to [`true`] and there will be taken care of
315    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
316    ///
317    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
318    /// are set, the last one wins.
319    ///
320    /// Readable | Writable
321    ///
322    ///
323    /// #### `valign`
324    ///  How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
325    ///
326    /// Readable | Writable
327    ///
328    ///
329    /// #### `vexpand`
330    ///  Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
331    ///
332    /// Readable | Writable
333    ///
334    ///
335    /// #### `vexpand-set`
336    ///  Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
337    ///
338    /// Readable | Writable
339    ///
340    ///
341    /// #### `visible`
342    ///  Readable | Writable
343    ///
344    ///
345    /// #### `width-request`
346    ///  Readable | Writable
347    ///
348    ///
349    /// #### `window`
350    ///  The widget's window if it is realized, [`None`] otherwise.
351    ///
352    /// Readable
353    /// </details>
354    ///
355    /// # Implements
356    ///
357    /// [`StackExt`][trait@crate::prelude::StackExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
358    #[doc(alias = "GtkStack")]
359    pub struct Stack(Object<ffi::GtkStack, ffi::GtkStackClass>) @extends Container, Widget, @implements Buildable;
360
361    match fn {
362        type_ => || ffi::gtk_stack_get_type(),
363    }
364}
365
366impl Stack {
367    pub const NONE: Option<&'static Stack> = None;
368
369    /// Creates a new [`Stack`][crate::Stack] container.
370    ///
371    /// # Returns
372    ///
373    /// a new [`Stack`][crate::Stack]
374    #[doc(alias = "gtk_stack_new")]
375    pub fn new() -> Stack {
376        assert_initialized_main_thread!();
377        unsafe { Widget::from_glib_none(ffi::gtk_stack_new()).unsafe_cast() }
378    }
379
380    // rustdoc-stripper-ignore-next
381    /// Creates a new builder-pattern struct instance to construct [`Stack`] objects.
382    ///
383    /// This method returns an instance of [`StackBuilder`](crate::builders::StackBuilder) which can be used to create [`Stack`] objects.
384    pub fn builder() -> StackBuilder {
385        StackBuilder::new()
386    }
387}
388
389impl Default for Stack {
390    fn default() -> Self {
391        Self::new()
392    }
393}
394
395// rustdoc-stripper-ignore-next
396/// A [builder-pattern] type to construct [`Stack`] objects.
397///
398/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
399#[must_use = "The builder must be built to be used"]
400pub struct StackBuilder {
401    builder: glib::object::ObjectBuilder<'static, Stack>,
402}
403
404impl StackBuilder {
405    fn new() -> Self {
406        Self {
407            builder: glib::object::Object::builder(),
408        }
409    }
410
411    /// [`true`] if the stack allocates the same width for all children.
412    pub fn hhomogeneous(self, hhomogeneous: bool) -> Self {
413        Self {
414            builder: self.builder.property("hhomogeneous", hhomogeneous),
415        }
416    }
417
418    pub fn homogeneous(self, homogeneous: bool) -> Self {
419        Self {
420            builder: self.builder.property("homogeneous", homogeneous),
421        }
422    }
423
424    pub fn interpolate_size(self, interpolate_size: bool) -> Self {
425        Self {
426            builder: self.builder.property("interpolate-size", interpolate_size),
427        }
428    }
429
430    pub fn transition_duration(self, transition_duration: u32) -> Self {
431        Self {
432            builder: self
433                .builder
434                .property("transition-duration", transition_duration),
435        }
436    }
437
438    pub fn transition_type(self, transition_type: StackTransitionType) -> Self {
439        Self {
440            builder: self.builder.property("transition-type", transition_type),
441        }
442    }
443
444    /// [`true`] if the stack allocates the same height for all children.
445    pub fn vhomogeneous(self, vhomogeneous: bool) -> Self {
446        Self {
447            builder: self.builder.property("vhomogeneous", vhomogeneous),
448        }
449    }
450
451    pub fn visible_child(self, visible_child: &impl IsA<Widget>) -> Self {
452        Self {
453            builder: self
454                .builder
455                .property("visible-child", visible_child.clone().upcast()),
456        }
457    }
458
459    pub fn visible_child_name(self, visible_child_name: impl Into<glib::GString>) -> Self {
460        Self {
461            builder: self
462                .builder
463                .property("visible-child-name", visible_child_name.into()),
464        }
465    }
466
467    pub fn border_width(self, border_width: u32) -> Self {
468        Self {
469            builder: self.builder.property("border-width", border_width),
470        }
471    }
472
473    pub fn child(self, child: &impl IsA<Widget>) -> Self {
474        Self {
475            builder: self.builder.property("child", child.clone().upcast()),
476        }
477    }
478
479    pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
480        Self {
481            builder: self.builder.property("resize-mode", resize_mode),
482        }
483    }
484
485    pub fn app_paintable(self, app_paintable: bool) -> Self {
486        Self {
487            builder: self.builder.property("app-paintable", app_paintable),
488        }
489    }
490
491    pub fn can_default(self, can_default: bool) -> Self {
492        Self {
493            builder: self.builder.property("can-default", can_default),
494        }
495    }
496
497    pub fn can_focus(self, can_focus: bool) -> Self {
498        Self {
499            builder: self.builder.property("can-focus", can_focus),
500        }
501    }
502
503    pub fn events(self, events: gdk::EventMask) -> Self {
504        Self {
505            builder: self.builder.property("events", events),
506        }
507    }
508
509    /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
510    pub fn expand(self, expand: bool) -> Self {
511        Self {
512            builder: self.builder.property("expand", expand),
513        }
514    }
515
516    /// Whether the widget should grab focus when it is clicked with the mouse.
517    ///
518    /// This property is only relevant for widgets that can take focus.
519    ///
520    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
521    /// GtkComboBox) implemented this property individually.
522    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
523        Self {
524            builder: self.builder.property("focus-on-click", focus_on_click),
525        }
526    }
527
528    /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
529    pub fn halign(self, halign: Align) -> Self {
530        Self {
531            builder: self.builder.property("halign", halign),
532        }
533    }
534
535    pub fn has_default(self, has_default: bool) -> Self {
536        Self {
537            builder: self.builder.property("has-default", has_default),
538        }
539    }
540
541    pub fn has_focus(self, has_focus: bool) -> Self {
542        Self {
543            builder: self.builder.property("has-focus", has_focus),
544        }
545    }
546
547    /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
548    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
549    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
550    /// whether it will provide a tooltip or not.
551    ///
552    /// Note that setting this property to [`true`] for the first time will change
553    /// the event masks of the GdkWindows of this widget to include leave-notify
554    /// and motion-notify events. This cannot and will not be undone when the
555    /// property is set to [`false`] again.
556    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
557        Self {
558            builder: self.builder.property("has-tooltip", has_tooltip),
559        }
560    }
561
562    pub fn height_request(self, height_request: i32) -> Self {
563        Self {
564            builder: self.builder.property("height-request", height_request),
565        }
566    }
567
568    /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
569    pub fn hexpand(self, hexpand: bool) -> Self {
570        Self {
571            builder: self.builder.property("hexpand", hexpand),
572        }
573    }
574
575    /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
576    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
577        Self {
578            builder: self.builder.property("hexpand-set", hexpand_set),
579        }
580    }
581
582    pub fn is_focus(self, is_focus: bool) -> Self {
583        Self {
584            builder: self.builder.property("is-focus", is_focus),
585        }
586    }
587
588    /// Sets all four sides' margin at once. If read, returns max
589    /// margin on any side.
590    pub fn margin(self, margin: i32) -> Self {
591        Self {
592            builder: self.builder.property("margin", margin),
593        }
594    }
595
596    /// Margin on bottom side of widget.
597    ///
598    /// This property adds margin outside of the widget's normal size
599    /// request, the margin will be added in addition to the size from
600    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
601    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
602        Self {
603            builder: self.builder.property("margin-bottom", margin_bottom),
604        }
605    }
606
607    /// Margin on end of widget, horizontally. This property supports
608    /// left-to-right and right-to-left text directions.
609    ///
610    /// This property adds margin outside of the widget's normal size
611    /// request, the margin will be added in addition to the size from
612    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
613    pub fn margin_end(self, margin_end: i32) -> Self {
614        Self {
615            builder: self.builder.property("margin-end", margin_end),
616        }
617    }
618
619    /// Margin on start of widget, horizontally. This property supports
620    /// left-to-right and right-to-left text directions.
621    ///
622    /// This property adds margin outside of the widget's normal size
623    /// request, the margin will be added in addition to the size from
624    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
625    pub fn margin_start(self, margin_start: i32) -> Self {
626        Self {
627            builder: self.builder.property("margin-start", margin_start),
628        }
629    }
630
631    /// Margin on top side of widget.
632    ///
633    /// This property adds margin outside of the widget's normal size
634    /// request, the margin will be added in addition to the size from
635    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
636    pub fn margin_top(self, margin_top: i32) -> Self {
637        Self {
638            builder: self.builder.property("margin-top", margin_top),
639        }
640    }
641
642    pub fn name(self, name: impl Into<glib::GString>) -> Self {
643        Self {
644            builder: self.builder.property("name", name.into()),
645        }
646    }
647
648    pub fn no_show_all(self, no_show_all: bool) -> Self {
649        Self {
650            builder: self.builder.property("no-show-all", no_show_all),
651        }
652    }
653
654    /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
655    /// more details about window opacity.
656    ///
657    /// Before 3.8 this was only available in GtkWindow
658    pub fn opacity(self, opacity: f64) -> Self {
659        Self {
660            builder: self.builder.property("opacity", opacity),
661        }
662    }
663
664    pub fn parent(self, parent: &impl IsA<Container>) -> Self {
665        Self {
666            builder: self.builder.property("parent", parent.clone().upcast()),
667        }
668    }
669
670    pub fn receives_default(self, receives_default: bool) -> Self {
671        Self {
672            builder: self.builder.property("receives-default", receives_default),
673        }
674    }
675
676    pub fn sensitive(self, sensitive: bool) -> Self {
677        Self {
678            builder: self.builder.property("sensitive", sensitive),
679        }
680    }
681
682    /// Sets the text of tooltip to be the given string, which is marked up
683    /// with the [Pango text markup language][PangoMarkupFormat].
684    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
685    ///
686    /// This is a convenience property which will take care of getting the
687    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
688    /// will automatically be set to [`true`] and there will be taken care of
689    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
690    ///
691    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
692    /// are set, the last one wins.
693    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
694        Self {
695            builder: self
696                .builder
697                .property("tooltip-markup", tooltip_markup.into()),
698        }
699    }
700
701    /// Sets the text of tooltip to be the given string.
702    ///
703    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
704    ///
705    /// This is a convenience property which will take care of getting the
706    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
707    /// will automatically be set to [`true`] and there will be taken care of
708    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
709    ///
710    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
711    /// are set, the last one wins.
712    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
713        Self {
714            builder: self.builder.property("tooltip-text", tooltip_text.into()),
715        }
716    }
717
718    /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
719    pub fn valign(self, valign: Align) -> Self {
720        Self {
721            builder: self.builder.property("valign", valign),
722        }
723    }
724
725    /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
726    pub fn vexpand(self, vexpand: bool) -> Self {
727        Self {
728            builder: self.builder.property("vexpand", vexpand),
729        }
730    }
731
732    /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
733    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
734        Self {
735            builder: self.builder.property("vexpand-set", vexpand_set),
736        }
737    }
738
739    pub fn visible(self, visible: bool) -> Self {
740        Self {
741            builder: self.builder.property("visible", visible),
742        }
743    }
744
745    pub fn width_request(self, width_request: i32) -> Self {
746        Self {
747            builder: self.builder.property("width-request", width_request),
748        }
749    }
750
751    // rustdoc-stripper-ignore-next
752    /// Build the [`Stack`].
753    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
754    pub fn build(self) -> Stack {
755        assert_initialized_main_thread!();
756        self.builder.build()
757    }
758}
759
760/// Trait containing all [`struct@Stack`] methods.
761///
762/// # Implementors
763///
764/// [`Stack`][struct@crate::Stack]
765pub trait StackExt: IsA<Stack> + 'static {
766    /// Adds a child to `self`.
767    /// The child is identified by the `name`.
768    /// ## `child`
769    /// the widget to add
770    /// ## `name`
771    /// the name for `child`
772    #[doc(alias = "gtk_stack_add_named")]
773    fn add_named(&self, child: &impl IsA<Widget>, name: &str) {
774        unsafe {
775            ffi::gtk_stack_add_named(
776                self.as_ref().to_glib_none().0,
777                child.as_ref().to_glib_none().0,
778                name.to_glib_none().0,
779            );
780        }
781    }
782
783    /// Adds a child to `self`.
784    /// The child is identified by the `name`. The `title`
785    /// will be used by [`StackSwitcher`][crate::StackSwitcher] to represent
786    /// `child` in a tab bar, so it should be short.
787    /// ## `child`
788    /// the widget to add
789    /// ## `name`
790    /// the name for `child`
791    /// ## `title`
792    /// a human-readable title for `child`
793    #[doc(alias = "gtk_stack_add_titled")]
794    fn add_titled(&self, child: &impl IsA<Widget>, name: &str, title: &str) {
795        unsafe {
796            ffi::gtk_stack_add_titled(
797                self.as_ref().to_glib_none().0,
798                child.as_ref().to_glib_none().0,
799                name.to_glib_none().0,
800                title.to_glib_none().0,
801            );
802        }
803    }
804
805    /// Finds the child of the [`Stack`][crate::Stack] with the name given as
806    /// the argument. Returns [`None`] if there is no child with this
807    /// name.
808    /// ## `name`
809    /// the name of the child to find
810    ///
811    /// # Returns
812    ///
813    /// the requested child of the [`Stack`][crate::Stack]
814    #[doc(alias = "gtk_stack_get_child_by_name")]
815    #[doc(alias = "get_child_by_name")]
816    fn child_by_name(&self, name: &str) -> Option<Widget> {
817        unsafe {
818            from_glib_none(ffi::gtk_stack_get_child_by_name(
819                self.as_ref().to_glib_none().0,
820                name.to_glib_none().0,
821            ))
822        }
823    }
824
825    /// Gets whether `self` is horizontally homogeneous.
826    /// See [`set_hhomogeneous()`][Self::set_hhomogeneous()].
827    ///
828    /// # Returns
829    ///
830    /// whether `self` is horizontally homogeneous.
831    #[doc(alias = "gtk_stack_get_hhomogeneous")]
832    #[doc(alias = "get_hhomogeneous")]
833    #[doc(alias = "hhomogeneous")]
834    fn is_hhomogeneous(&self) -> bool {
835        unsafe {
836            from_glib(ffi::gtk_stack_get_hhomogeneous(
837                self.as_ref().to_glib_none().0,
838            ))
839        }
840    }
841
842    /// Gets whether `self` is homogeneous.
843    /// See [`set_homogeneous()`][Self::set_homogeneous()].
844    ///
845    /// # Returns
846    ///
847    /// whether `self` is homogeneous.
848    #[doc(alias = "gtk_stack_get_homogeneous")]
849    #[doc(alias = "get_homogeneous")]
850    #[doc(alias = "homogeneous")]
851    fn is_homogeneous(&self) -> bool {
852        unsafe {
853            from_glib(ffi::gtk_stack_get_homogeneous(
854                self.as_ref().to_glib_none().0,
855            ))
856        }
857    }
858
859    /// Returns wether the [`Stack`][crate::Stack] is set up to interpolate between
860    /// the sizes of children on page switch.
861    ///
862    /// # Returns
863    ///
864    /// [`true`] if child sizes are interpolated
865    #[doc(alias = "gtk_stack_get_interpolate_size")]
866    #[doc(alias = "get_interpolate_size")]
867    #[doc(alias = "interpolate-size")]
868    fn interpolates_size(&self) -> bool {
869        unsafe {
870            from_glib(ffi::gtk_stack_get_interpolate_size(
871                self.as_ref().to_glib_none().0,
872            ))
873        }
874    }
875
876    /// Returns the amount of time (in milliseconds) that
877    /// transitions between pages in `self` will take.
878    ///
879    /// # Returns
880    ///
881    /// the transition duration
882    #[doc(alias = "gtk_stack_get_transition_duration")]
883    #[doc(alias = "get_transition_duration")]
884    #[doc(alias = "transition-duration")]
885    fn transition_duration(&self) -> u32 {
886        unsafe { ffi::gtk_stack_get_transition_duration(self.as_ref().to_glib_none().0) }
887    }
888
889    /// Returns whether the `self` is currently in a transition from one page to
890    /// another.
891    ///
892    /// # Returns
893    ///
894    /// [`true`] if the transition is currently running, [`false`] otherwise.
895    #[doc(alias = "gtk_stack_get_transition_running")]
896    #[doc(alias = "get_transition_running")]
897    #[doc(alias = "transition-running")]
898    fn is_transition_running(&self) -> bool {
899        unsafe {
900            from_glib(ffi::gtk_stack_get_transition_running(
901                self.as_ref().to_glib_none().0,
902            ))
903        }
904    }
905
906    /// Gets the type of animation that will be used
907    /// for transitions between pages in `self`.
908    ///
909    /// # Returns
910    ///
911    /// the current transition type of `self`
912    #[doc(alias = "gtk_stack_get_transition_type")]
913    #[doc(alias = "get_transition_type")]
914    #[doc(alias = "transition-type")]
915    fn transition_type(&self) -> StackTransitionType {
916        unsafe {
917            from_glib(ffi::gtk_stack_get_transition_type(
918                self.as_ref().to_glib_none().0,
919            ))
920        }
921    }
922
923    /// Gets whether `self` is vertically homogeneous.
924    /// See [`set_vhomogeneous()`][Self::set_vhomogeneous()].
925    ///
926    /// # Returns
927    ///
928    /// whether `self` is vertically homogeneous.
929    #[doc(alias = "gtk_stack_get_vhomogeneous")]
930    #[doc(alias = "get_vhomogeneous")]
931    #[doc(alias = "vhomogeneous")]
932    fn is_vhomogeneous(&self) -> bool {
933        unsafe {
934            from_glib(ffi::gtk_stack_get_vhomogeneous(
935                self.as_ref().to_glib_none().0,
936            ))
937        }
938    }
939
940    /// Gets the currently visible child of `self`, or [`None`] if
941    /// there are no visible children.
942    ///
943    /// # Returns
944    ///
945    /// the visible child of the [`Stack`][crate::Stack]
946    #[doc(alias = "gtk_stack_get_visible_child")]
947    #[doc(alias = "get_visible_child")]
948    #[doc(alias = "visible-child")]
949    fn visible_child(&self) -> Option<Widget> {
950        unsafe {
951            from_glib_none(ffi::gtk_stack_get_visible_child(
952                self.as_ref().to_glib_none().0,
953            ))
954        }
955    }
956
957    /// Returns the name of the currently visible child of `self`, or
958    /// [`None`] if there is no visible child.
959    ///
960    /// # Returns
961    ///
962    /// the name of the visible child of the [`Stack`][crate::Stack]
963    #[doc(alias = "gtk_stack_get_visible_child_name")]
964    #[doc(alias = "get_visible_child_name")]
965    #[doc(alias = "visible-child-name")]
966    fn visible_child_name(&self) -> Option<glib::GString> {
967        unsafe {
968            from_glib_none(ffi::gtk_stack_get_visible_child_name(
969                self.as_ref().to_glib_none().0,
970            ))
971        }
972    }
973
974    /// Sets the [`Stack`][crate::Stack] to be horizontally homogeneous or not.
975    /// If it is homogeneous, the [`Stack`][crate::Stack] will request the same
976    /// width for all its children. If it isn't, the stack
977    /// may change width when a different child becomes visible.
978    /// ## `hhomogeneous`
979    /// [`true`] to make `self` horizontally homogeneous
980    #[doc(alias = "gtk_stack_set_hhomogeneous")]
981    #[doc(alias = "hhomogeneous")]
982    fn set_hhomogeneous(&self, hhomogeneous: bool) {
983        unsafe {
984            ffi::gtk_stack_set_hhomogeneous(
985                self.as_ref().to_glib_none().0,
986                hhomogeneous.into_glib(),
987            );
988        }
989    }
990
991    /// Sets the [`Stack`][crate::Stack] to be homogeneous or not. If it
992    /// is homogeneous, the [`Stack`][crate::Stack] will request the same
993    /// size for all its children. If it isn't, the stack
994    /// may change size when a different child becomes visible.
995    ///
996    /// Since 3.16, homogeneity can be controlled separately
997    /// for horizontal and vertical size, with the
998    /// [`hhomogeneous`][struct@crate::Stack#hhomogeneous] and [`vhomogeneous`][struct@crate::Stack#vhomogeneous].
999    /// ## `homogeneous`
1000    /// [`true`] to make `self` homogeneous
1001    #[doc(alias = "gtk_stack_set_homogeneous")]
1002    #[doc(alias = "homogeneous")]
1003    fn set_homogeneous(&self, homogeneous: bool) {
1004        unsafe {
1005            ffi::gtk_stack_set_homogeneous(self.as_ref().to_glib_none().0, homogeneous.into_glib());
1006        }
1007    }
1008
1009    /// Sets whether or not `self` will interpolate its size when
1010    /// changing the visible child. If the [`interpolate-size`][struct@crate::Stack#interpolate-size]
1011    /// property is set to [`true`], `self` will interpolate its size between
1012    /// the current one and the one it'll take after changing the
1013    /// visible child, according to the set transition duration.
1014    /// ## `interpolate_size`
1015    /// the new value
1016    #[doc(alias = "gtk_stack_set_interpolate_size")]
1017    #[doc(alias = "interpolate-size")]
1018    fn set_interpolate_size(&self, interpolate_size: bool) {
1019        unsafe {
1020            ffi::gtk_stack_set_interpolate_size(
1021                self.as_ref().to_glib_none().0,
1022                interpolate_size.into_glib(),
1023            );
1024        }
1025    }
1026
1027    /// Sets the duration that transitions between pages in `self`
1028    /// will take.
1029    /// ## `duration`
1030    /// the new duration, in milliseconds
1031    #[doc(alias = "gtk_stack_set_transition_duration")]
1032    #[doc(alias = "transition-duration")]
1033    fn set_transition_duration(&self, duration: u32) {
1034        unsafe {
1035            ffi::gtk_stack_set_transition_duration(self.as_ref().to_glib_none().0, duration);
1036        }
1037    }
1038
1039    /// Sets the type of animation that will be used for
1040    /// transitions between pages in `self`. Available
1041    /// types include various kinds of fades and slides.
1042    ///
1043    /// The transition type can be changed without problems
1044    /// at runtime, so it is possible to change the animation
1045    /// based on the page that is about to become current.
1046    /// ## `transition`
1047    /// the new transition type
1048    #[doc(alias = "gtk_stack_set_transition_type")]
1049    #[doc(alias = "transition-type")]
1050    fn set_transition_type(&self, transition: StackTransitionType) {
1051        unsafe {
1052            ffi::gtk_stack_set_transition_type(
1053                self.as_ref().to_glib_none().0,
1054                transition.into_glib(),
1055            );
1056        }
1057    }
1058
1059    /// Sets the [`Stack`][crate::Stack] to be vertically homogeneous or not.
1060    /// If it is homogeneous, the [`Stack`][crate::Stack] will request the same
1061    /// height for all its children. If it isn't, the stack
1062    /// may change height when a different child becomes visible.
1063    /// ## `vhomogeneous`
1064    /// [`true`] to make `self` vertically homogeneous
1065    #[doc(alias = "gtk_stack_set_vhomogeneous")]
1066    #[doc(alias = "vhomogeneous")]
1067    fn set_vhomogeneous(&self, vhomogeneous: bool) {
1068        unsafe {
1069            ffi::gtk_stack_set_vhomogeneous(
1070                self.as_ref().to_glib_none().0,
1071                vhomogeneous.into_glib(),
1072            );
1073        }
1074    }
1075
1076    /// Makes `child` the visible child of `self`.
1077    ///
1078    /// If `child` is different from the currently
1079    /// visible child, the transition between the
1080    /// two will be animated with the current
1081    /// transition type of `self`.
1082    ///
1083    /// Note that the `child` widget has to be visible itself
1084    /// (see [`WidgetExt::show()`][crate::prelude::WidgetExt::show()]) in order to become the visible
1085    /// child of `self`.
1086    /// ## `child`
1087    /// a child of `self`
1088    #[doc(alias = "gtk_stack_set_visible_child")]
1089    #[doc(alias = "visible-child")]
1090    fn set_visible_child(&self, child: &impl IsA<Widget>) {
1091        unsafe {
1092            ffi::gtk_stack_set_visible_child(
1093                self.as_ref().to_glib_none().0,
1094                child.as_ref().to_glib_none().0,
1095            );
1096        }
1097    }
1098
1099    /// Makes the child with the given name visible.
1100    ///
1101    /// Note that the child widget has to be visible itself
1102    /// (see [`WidgetExt::show()`][crate::prelude::WidgetExt::show()]) in order to become the visible
1103    /// child of `self`.
1104    /// ## `name`
1105    /// the name of the child to make visible
1106    /// ## `transition`
1107    /// the transition type to use
1108    #[doc(alias = "gtk_stack_set_visible_child_full")]
1109    fn set_visible_child_full(&self, name: &str, transition: StackTransitionType) {
1110        unsafe {
1111            ffi::gtk_stack_set_visible_child_full(
1112                self.as_ref().to_glib_none().0,
1113                name.to_glib_none().0,
1114                transition.into_glib(),
1115            );
1116        }
1117    }
1118
1119    /// Makes the child with the given name visible.
1120    ///
1121    /// If `child` is different from the currently
1122    /// visible child, the transition between the
1123    /// two will be animated with the current
1124    /// transition type of `self`.
1125    ///
1126    /// Note that the child widget has to be visible itself
1127    /// (see [`WidgetExt::show()`][crate::prelude::WidgetExt::show()]) in order to become the visible
1128    /// child of `self`.
1129    /// ## `name`
1130    /// the name of the child to make visible
1131    #[doc(alias = "gtk_stack_set_visible_child_name")]
1132    #[doc(alias = "visible-child-name")]
1133    fn set_visible_child_name(&self, name: &str) {
1134        unsafe {
1135            ffi::gtk_stack_set_visible_child_name(
1136                self.as_ref().to_glib_none().0,
1137                name.to_glib_none().0,
1138            );
1139        }
1140    }
1141
1142    #[doc(alias = "child.icon-name")]
1143    fn child_icon_name<T: IsA<crate::Widget>>(&self, item: &T) -> Option<glib::GString> {
1144        crate::prelude::ContainerExtManual::child_property(
1145            self.as_ref(),
1146            &item.clone().upcast(),
1147            "icon-name",
1148        )
1149    }
1150
1151    #[doc(alias = "child.icon-name")]
1152    fn set_child_icon_name<T: IsA<crate::Widget>>(&self, item: &T, icon_name: Option<&str>) {
1153        crate::prelude::ContainerExtManual::child_set_property(
1154            self.as_ref(),
1155            &item.clone().upcast(),
1156            "icon-name",
1157            &icon_name,
1158        )
1159    }
1160
1161    fn child_name<T: IsA<crate::Widget>>(&self, item: &T) -> Option<glib::GString> {
1162        crate::prelude::ContainerExtManual::child_property(
1163            self.as_ref(),
1164            &item.clone().upcast(),
1165            "name",
1166        )
1167    }
1168
1169    fn set_child_name<T: IsA<crate::Widget>>(&self, item: &T, name: Option<&str>) {
1170        crate::prelude::ContainerExtManual::child_set_property(
1171            self.as_ref(),
1172            &item.clone().upcast(),
1173            "name",
1174            &name,
1175        )
1176    }
1177
1178    #[doc(alias = "child.needs-attention")]
1179    fn child_needs_attention<T: IsA<crate::Widget>>(&self, item: &T) -> bool {
1180        crate::prelude::ContainerExtManual::child_property(
1181            self.as_ref(),
1182            &item.clone().upcast(),
1183            "needs-attention",
1184        )
1185    }
1186
1187    #[doc(alias = "child.needs-attention")]
1188    fn set_child_needs_attention<T: IsA<crate::Widget>>(&self, item: &T, needs_attention: bool) {
1189        crate::prelude::ContainerExtManual::child_set_property(
1190            self.as_ref(),
1191            &item.clone().upcast(),
1192            "needs-attention",
1193            &needs_attention,
1194        )
1195    }
1196
1197    fn child_position<T: IsA<crate::Widget>>(&self, item: &T) -> i32 {
1198        crate::prelude::ContainerExtManual::child_property(
1199            self.as_ref(),
1200            &item.clone().upcast(),
1201            "position",
1202        )
1203    }
1204
1205    fn set_child_position<T: IsA<crate::Widget>>(&self, item: &T, position: i32) {
1206        crate::prelude::ContainerExtManual::child_set_property(
1207            self.as_ref(),
1208            &item.clone().upcast(),
1209            "position",
1210            &position,
1211        )
1212    }
1213
1214    fn child_title<T: IsA<crate::Widget>>(&self, item: &T) -> Option<glib::GString> {
1215        crate::prelude::ContainerExtManual::child_property(
1216            self.as_ref(),
1217            &item.clone().upcast(),
1218            "title",
1219        )
1220    }
1221
1222    fn set_child_title<T: IsA<crate::Widget>>(&self, item: &T, title: Option<&str>) {
1223        crate::prelude::ContainerExtManual::child_set_property(
1224            self.as_ref(),
1225            &item.clone().upcast(),
1226            "title",
1227            &title,
1228        )
1229    }
1230
1231    #[doc(alias = "hhomogeneous")]
1232    fn connect_hhomogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1233        unsafe extern "C" fn notify_hhomogeneous_trampoline<P: IsA<Stack>, F: Fn(&P) + 'static>(
1234            this: *mut ffi::GtkStack,
1235            _param_spec: glib::ffi::gpointer,
1236            f: glib::ffi::gpointer,
1237        ) {
1238            unsafe {
1239                let f: &F = &*(f as *const F);
1240                f(Stack::from_glib_borrow(this).unsafe_cast_ref())
1241            }
1242        }
1243        unsafe {
1244            let f: Box_<F> = Box_::new(f);
1245            connect_raw(
1246                self.as_ptr() as *mut _,
1247                c"notify::hhomogeneous".as_ptr(),
1248                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1249                    notify_hhomogeneous_trampoline::<Self, F> as *const (),
1250                )),
1251                Box_::into_raw(f),
1252            )
1253        }
1254    }
1255
1256    #[doc(alias = "homogeneous")]
1257    fn connect_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1258        unsafe extern "C" fn notify_homogeneous_trampoline<P: IsA<Stack>, F: Fn(&P) + 'static>(
1259            this: *mut ffi::GtkStack,
1260            _param_spec: glib::ffi::gpointer,
1261            f: glib::ffi::gpointer,
1262        ) {
1263            unsafe {
1264                let f: &F = &*(f as *const F);
1265                f(Stack::from_glib_borrow(this).unsafe_cast_ref())
1266            }
1267        }
1268        unsafe {
1269            let f: Box_<F> = Box_::new(f);
1270            connect_raw(
1271                self.as_ptr() as *mut _,
1272                c"notify::homogeneous".as_ptr(),
1273                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1274                    notify_homogeneous_trampoline::<Self, F> as *const (),
1275                )),
1276                Box_::into_raw(f),
1277            )
1278        }
1279    }
1280
1281    #[doc(alias = "interpolate-size")]
1282    fn connect_interpolate_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1283        unsafe extern "C" fn notify_interpolate_size_trampoline<
1284            P: IsA<Stack>,
1285            F: Fn(&P) + 'static,
1286        >(
1287            this: *mut ffi::GtkStack,
1288            _param_spec: glib::ffi::gpointer,
1289            f: glib::ffi::gpointer,
1290        ) {
1291            unsafe {
1292                let f: &F = &*(f as *const F);
1293                f(Stack::from_glib_borrow(this).unsafe_cast_ref())
1294            }
1295        }
1296        unsafe {
1297            let f: Box_<F> = Box_::new(f);
1298            connect_raw(
1299                self.as_ptr() as *mut _,
1300                c"notify::interpolate-size".as_ptr(),
1301                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1302                    notify_interpolate_size_trampoline::<Self, F> as *const (),
1303                )),
1304                Box_::into_raw(f),
1305            )
1306        }
1307    }
1308
1309    #[doc(alias = "transition-duration")]
1310    fn connect_transition_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1311        unsafe extern "C" fn notify_transition_duration_trampoline<
1312            P: IsA<Stack>,
1313            F: Fn(&P) + 'static,
1314        >(
1315            this: *mut ffi::GtkStack,
1316            _param_spec: glib::ffi::gpointer,
1317            f: glib::ffi::gpointer,
1318        ) {
1319            unsafe {
1320                let f: &F = &*(f as *const F);
1321                f(Stack::from_glib_borrow(this).unsafe_cast_ref())
1322            }
1323        }
1324        unsafe {
1325            let f: Box_<F> = Box_::new(f);
1326            connect_raw(
1327                self.as_ptr() as *mut _,
1328                c"notify::transition-duration".as_ptr(),
1329                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1330                    notify_transition_duration_trampoline::<Self, F> as *const (),
1331                )),
1332                Box_::into_raw(f),
1333            )
1334        }
1335    }
1336
1337    #[doc(alias = "transition-running")]
1338    fn connect_transition_running_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1339        unsafe extern "C" fn notify_transition_running_trampoline<
1340            P: IsA<Stack>,
1341            F: Fn(&P) + 'static,
1342        >(
1343            this: *mut ffi::GtkStack,
1344            _param_spec: glib::ffi::gpointer,
1345            f: glib::ffi::gpointer,
1346        ) {
1347            unsafe {
1348                let f: &F = &*(f as *const F);
1349                f(Stack::from_glib_borrow(this).unsafe_cast_ref())
1350            }
1351        }
1352        unsafe {
1353            let f: Box_<F> = Box_::new(f);
1354            connect_raw(
1355                self.as_ptr() as *mut _,
1356                c"notify::transition-running".as_ptr(),
1357                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1358                    notify_transition_running_trampoline::<Self, F> as *const (),
1359                )),
1360                Box_::into_raw(f),
1361            )
1362        }
1363    }
1364
1365    #[doc(alias = "transition-type")]
1366    fn connect_transition_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1367        unsafe extern "C" fn notify_transition_type_trampoline<
1368            P: IsA<Stack>,
1369            F: Fn(&P) + 'static,
1370        >(
1371            this: *mut ffi::GtkStack,
1372            _param_spec: glib::ffi::gpointer,
1373            f: glib::ffi::gpointer,
1374        ) {
1375            unsafe {
1376                let f: &F = &*(f as *const F);
1377                f(Stack::from_glib_borrow(this).unsafe_cast_ref())
1378            }
1379        }
1380        unsafe {
1381            let f: Box_<F> = Box_::new(f);
1382            connect_raw(
1383                self.as_ptr() as *mut _,
1384                c"notify::transition-type".as_ptr(),
1385                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1386                    notify_transition_type_trampoline::<Self, F> as *const (),
1387                )),
1388                Box_::into_raw(f),
1389            )
1390        }
1391    }
1392
1393    #[doc(alias = "vhomogeneous")]
1394    fn connect_vhomogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1395        unsafe extern "C" fn notify_vhomogeneous_trampoline<P: IsA<Stack>, F: Fn(&P) + 'static>(
1396            this: *mut ffi::GtkStack,
1397            _param_spec: glib::ffi::gpointer,
1398            f: glib::ffi::gpointer,
1399        ) {
1400            unsafe {
1401                let f: &F = &*(f as *const F);
1402                f(Stack::from_glib_borrow(this).unsafe_cast_ref())
1403            }
1404        }
1405        unsafe {
1406            let f: Box_<F> = Box_::new(f);
1407            connect_raw(
1408                self.as_ptr() as *mut _,
1409                c"notify::vhomogeneous".as_ptr(),
1410                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1411                    notify_vhomogeneous_trampoline::<Self, F> as *const (),
1412                )),
1413                Box_::into_raw(f),
1414            )
1415        }
1416    }
1417
1418    #[doc(alias = "visible-child")]
1419    fn connect_visible_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1420        unsafe extern "C" fn notify_visible_child_trampoline<P: IsA<Stack>, F: Fn(&P) + 'static>(
1421            this: *mut ffi::GtkStack,
1422            _param_spec: glib::ffi::gpointer,
1423            f: glib::ffi::gpointer,
1424        ) {
1425            unsafe {
1426                let f: &F = &*(f as *const F);
1427                f(Stack::from_glib_borrow(this).unsafe_cast_ref())
1428            }
1429        }
1430        unsafe {
1431            let f: Box_<F> = Box_::new(f);
1432            connect_raw(
1433                self.as_ptr() as *mut _,
1434                c"notify::visible-child".as_ptr(),
1435                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1436                    notify_visible_child_trampoline::<Self, F> as *const (),
1437                )),
1438                Box_::into_raw(f),
1439            )
1440        }
1441    }
1442
1443    #[doc(alias = "visible-child-name")]
1444    fn connect_visible_child_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1445        unsafe extern "C" fn notify_visible_child_name_trampoline<
1446            P: IsA<Stack>,
1447            F: Fn(&P) + 'static,
1448        >(
1449            this: *mut ffi::GtkStack,
1450            _param_spec: glib::ffi::gpointer,
1451            f: glib::ffi::gpointer,
1452        ) {
1453            unsafe {
1454                let f: &F = &*(f as *const F);
1455                f(Stack::from_glib_borrow(this).unsafe_cast_ref())
1456            }
1457        }
1458        unsafe {
1459            let f: Box_<F> = Box_::new(f);
1460            connect_raw(
1461                self.as_ptr() as *mut _,
1462                c"notify::visible-child-name".as_ptr(),
1463                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1464                    notify_visible_child_name_trampoline::<Self, F> as *const (),
1465                )),
1466                Box_::into_raw(f),
1467            )
1468        }
1469    }
1470}
1471
1472impl<O: IsA<Stack>> StackExt for O {}