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};
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 /// 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 | Writeable
38 ///
39 ///
40 /// #### `homogeneous`
41 /// Readable | Writeable
42 ///
43 ///
44 /// #### `interpolate-size`
45 /// Readable | Writeable
46 ///
47 ///
48 /// #### `transition-duration`
49 /// Readable | Writeable
50 ///
51 ///
52 /// #### `transition-running`
53 /// Readable
54 ///
55 ///
56 /// #### `transition-type`
57 /// Readable | Writeable
58 ///
59 ///
60 /// #### `vhomogeneous`
61 /// [`true`] if the stack allocates the same height for all children.
62 ///
63 /// Readable | Writeable
64 ///
65 ///
66 /// #### `visible-child`
67 /// Readable | Writeable
68 ///
69 ///
70 /// #### `visible-child-name`
71 /// Readable | Writeable
72 /// <details><summary><h4>Container</h4></summary>
73 ///
74 ///
75 /// #### `border-width`
76 /// Readable | Writeable
77 ///
78 ///
79 /// #### `child`
80 /// Writeable
81 ///
82 ///
83 /// #### `resize-mode`
84 /// Readable | Writeable
85 /// </details>
86 /// <details><summary><h4>Widget</h4></summary>
87 ///
88 ///
89 /// #### `app-paintable`
90 /// Readable | Writeable
91 ///
92 ///
93 /// #### `can-default`
94 /// Readable | Writeable
95 ///
96 ///
97 /// #### `can-focus`
98 /// Readable | Writeable
99 ///
100 ///
101 /// #### `composite-child`
102 /// Readable
103 ///
104 ///
105 /// #### `double-buffered`
106 /// Whether the widget is double buffered.
107 ///
108 /// Readable | Writeable
109 ///
110 ///
111 /// #### `events`
112 /// Readable | Writeable
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 | Writeable
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 | Writeable
130 ///
131 ///
132 /// #### `halign`
133 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
134 ///
135 /// Readable | Writeable
136 ///
137 ///
138 /// #### `has-default`
139 /// Readable | Writeable
140 ///
141 ///
142 /// #### `has-focus`
143 /// Readable | Writeable
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 | Writeable
158 ///
159 ///
160 /// #### `height-request`
161 /// Readable | Writeable
162 ///
163 ///
164 /// #### `hexpand`
165 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
166 ///
167 /// Readable | Writeable
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 | Writeable
174 ///
175 ///
176 /// #### `is-focus`
177 /// Readable | Writeable
178 ///
179 ///
180 /// #### `margin`
181 /// Sets all four sides' margin at once. If read, returns max
182 /// margin on any side.
183 ///
184 /// Readable | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
247 ///
248 ///
249 /// #### `name`
250 /// Readable | Writeable
251 ///
252 ///
253 /// #### `no-show-all`
254 /// Readable | Writeable
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 | Writeable
264 ///
265 ///
266 /// #### `parent`
267 /// Readable | Writeable
268 ///
269 ///
270 /// #### `receives-default`
271 /// Readable | Writeable
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 | Writeable
283 ///
284 ///
285 /// #### `style`
286 /// The style of the widget, which contains information about how it will look (colors, etc).
287 ///
288 /// Readable | Writeable
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 | Writeable
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 | Writeable
321 ///
322 ///
323 /// #### `valign`
324 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
325 ///
326 /// Readable | Writeable
327 ///
328 ///
329 /// #### `vexpand`
330 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
331 ///
332 /// Readable | Writeable
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 | Writeable
339 ///
340 ///
341 /// #### `visible`
342 /// Readable | Writeable
343 ///
344 ///
345 /// #### `width-request`
346 /// Readable | Writeable
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 self.builder.build()
756 }
757}
758
759mod sealed {
760 pub trait Sealed {}
761 impl<T: super::IsA<super::Stack>> Sealed for T {}
762}
763
764/// Trait containing all [`struct@Stack`] methods.
765///
766/// # Implementors
767///
768/// [`Stack`][struct@crate::Stack]
769pub trait StackExt: IsA<Stack> + sealed::Sealed + 'static {
770 /// Adds a child to `self`.
771 /// The child is identified by the `name`.
772 /// ## `child`
773 /// the widget to add
774 /// ## `name`
775 /// the name for `child`
776 #[doc(alias = "gtk_stack_add_named")]
777 fn add_named(&self, child: &impl IsA<Widget>, name: &str) {
778 unsafe {
779 ffi::gtk_stack_add_named(
780 self.as_ref().to_glib_none().0,
781 child.as_ref().to_glib_none().0,
782 name.to_glib_none().0,
783 );
784 }
785 }
786
787 /// Adds a child to `self`.
788 /// The child is identified by the `name`. The `title`
789 /// will be used by [`StackSwitcher`][crate::StackSwitcher] to represent
790 /// `child` in a tab bar, so it should be short.
791 /// ## `child`
792 /// the widget to add
793 /// ## `name`
794 /// the name for `child`
795 /// ## `title`
796 /// a human-readable title for `child`
797 #[doc(alias = "gtk_stack_add_titled")]
798 fn add_titled(&self, child: &impl IsA<Widget>, name: &str, title: &str) {
799 unsafe {
800 ffi::gtk_stack_add_titled(
801 self.as_ref().to_glib_none().0,
802 child.as_ref().to_glib_none().0,
803 name.to_glib_none().0,
804 title.to_glib_none().0,
805 );
806 }
807 }
808
809 /// Finds the child of the [`Stack`][crate::Stack] with the name given as
810 /// the argument. Returns [`None`] if there is no child with this
811 /// name.
812 /// ## `name`
813 /// the name of the child to find
814 ///
815 /// # Returns
816 ///
817 /// the requested child of the [`Stack`][crate::Stack]
818 #[doc(alias = "gtk_stack_get_child_by_name")]
819 #[doc(alias = "get_child_by_name")]
820 fn child_by_name(&self, name: &str) -> Option<Widget> {
821 unsafe {
822 from_glib_none(ffi::gtk_stack_get_child_by_name(
823 self.as_ref().to_glib_none().0,
824 name.to_glib_none().0,
825 ))
826 }
827 }
828
829 /// Gets whether `self` is horizontally homogeneous.
830 /// See [`set_hhomogeneous()`][Self::set_hhomogeneous()].
831 ///
832 /// # Returns
833 ///
834 /// whether `self` is horizontally homogeneous.
835 #[doc(alias = "gtk_stack_get_hhomogeneous")]
836 #[doc(alias = "get_hhomogeneous")]
837 fn is_hhomogeneous(&self) -> bool {
838 unsafe {
839 from_glib(ffi::gtk_stack_get_hhomogeneous(
840 self.as_ref().to_glib_none().0,
841 ))
842 }
843 }
844
845 /// Gets whether `self` is homogeneous.
846 /// See [`set_homogeneous()`][Self::set_homogeneous()].
847 ///
848 /// # Returns
849 ///
850 /// whether `self` is homogeneous.
851 #[doc(alias = "gtk_stack_get_homogeneous")]
852 #[doc(alias = "get_homogeneous")]
853 fn is_homogeneous(&self) -> bool {
854 unsafe {
855 from_glib(ffi::gtk_stack_get_homogeneous(
856 self.as_ref().to_glib_none().0,
857 ))
858 }
859 }
860
861 /// Returns wether the [`Stack`][crate::Stack] is set up to interpolate between
862 /// the sizes of children on page switch.
863 ///
864 /// # Returns
865 ///
866 /// [`true`] if child sizes are interpolated
867 #[doc(alias = "gtk_stack_get_interpolate_size")]
868 #[doc(alias = "get_interpolate_size")]
869 fn interpolates_size(&self) -> bool {
870 unsafe {
871 from_glib(ffi::gtk_stack_get_interpolate_size(
872 self.as_ref().to_glib_none().0,
873 ))
874 }
875 }
876
877 /// Returns the amount of time (in milliseconds) that
878 /// transitions between pages in `self` will take.
879 ///
880 /// # Returns
881 ///
882 /// the transition duration
883 #[doc(alias = "gtk_stack_get_transition_duration")]
884 #[doc(alias = "get_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 fn is_transition_running(&self) -> bool {
898 unsafe {
899 from_glib(ffi::gtk_stack_get_transition_running(
900 self.as_ref().to_glib_none().0,
901 ))
902 }
903 }
904
905 /// Gets the type of animation that will be used
906 /// for transitions between pages in `self`.
907 ///
908 /// # Returns
909 ///
910 /// the current transition type of `self`
911 #[doc(alias = "gtk_stack_get_transition_type")]
912 #[doc(alias = "get_transition_type")]
913 fn transition_type(&self) -> StackTransitionType {
914 unsafe {
915 from_glib(ffi::gtk_stack_get_transition_type(
916 self.as_ref().to_glib_none().0,
917 ))
918 }
919 }
920
921 /// Gets whether `self` is vertically homogeneous.
922 /// See [`set_vhomogeneous()`][Self::set_vhomogeneous()].
923 ///
924 /// # Returns
925 ///
926 /// whether `self` is vertically homogeneous.
927 #[doc(alias = "gtk_stack_get_vhomogeneous")]
928 #[doc(alias = "get_vhomogeneous")]
929 fn is_vhomogeneous(&self) -> bool {
930 unsafe {
931 from_glib(ffi::gtk_stack_get_vhomogeneous(
932 self.as_ref().to_glib_none().0,
933 ))
934 }
935 }
936
937 /// Gets the currently visible child of `self`, or [`None`] if
938 /// there are no visible children.
939 ///
940 /// # Returns
941 ///
942 /// the visible child of the [`Stack`][crate::Stack]
943 #[doc(alias = "gtk_stack_get_visible_child")]
944 #[doc(alias = "get_visible_child")]
945 fn visible_child(&self) -> Option<Widget> {
946 unsafe {
947 from_glib_none(ffi::gtk_stack_get_visible_child(
948 self.as_ref().to_glib_none().0,
949 ))
950 }
951 }
952
953 /// Returns the name of the currently visible child of `self`, or
954 /// [`None`] if there is no visible child.
955 ///
956 /// # Returns
957 ///
958 /// the name of the visible child of the [`Stack`][crate::Stack]
959 #[doc(alias = "gtk_stack_get_visible_child_name")]
960 #[doc(alias = "get_visible_child_name")]
961 fn visible_child_name(&self) -> Option<glib::GString> {
962 unsafe {
963 from_glib_none(ffi::gtk_stack_get_visible_child_name(
964 self.as_ref().to_glib_none().0,
965 ))
966 }
967 }
968
969 /// Sets the [`Stack`][crate::Stack] to be horizontally homogeneous or not.
970 /// If it is homogeneous, the [`Stack`][crate::Stack] will request the same
971 /// width for all its children. If it isn't, the stack
972 /// may change width when a different child becomes visible.
973 /// ## `hhomogeneous`
974 /// [`true`] to make `self` horizontally homogeneous
975 #[doc(alias = "gtk_stack_set_hhomogeneous")]
976 fn set_hhomogeneous(&self, hhomogeneous: bool) {
977 unsafe {
978 ffi::gtk_stack_set_hhomogeneous(
979 self.as_ref().to_glib_none().0,
980 hhomogeneous.into_glib(),
981 );
982 }
983 }
984
985 /// Sets the [`Stack`][crate::Stack] to be homogeneous or not. If it
986 /// is homogeneous, the [`Stack`][crate::Stack] will request the same
987 /// size for all its children. If it isn't, the stack
988 /// may change size when a different child becomes visible.
989 ///
990 /// Since 3.16, homogeneity can be controlled separately
991 /// for horizontal and vertical size, with the
992 /// [`hhomogeneous`][struct@crate::Stack#hhomogeneous] and [`vhomogeneous`][struct@crate::Stack#vhomogeneous].
993 /// ## `homogeneous`
994 /// [`true`] to make `self` homogeneous
995 #[doc(alias = "gtk_stack_set_homogeneous")]
996 fn set_homogeneous(&self, homogeneous: bool) {
997 unsafe {
998 ffi::gtk_stack_set_homogeneous(self.as_ref().to_glib_none().0, homogeneous.into_glib());
999 }
1000 }
1001
1002 /// Sets whether or not `self` will interpolate its size when
1003 /// changing the visible child. If the [`interpolate-size`][struct@crate::Stack#interpolate-size]
1004 /// property is set to [`true`], `self` will interpolate its size between
1005 /// the current one and the one it'll take after changing the
1006 /// visible child, according to the set transition duration.
1007 /// ## `interpolate_size`
1008 /// the new value
1009 #[doc(alias = "gtk_stack_set_interpolate_size")]
1010 fn set_interpolate_size(&self, interpolate_size: bool) {
1011 unsafe {
1012 ffi::gtk_stack_set_interpolate_size(
1013 self.as_ref().to_glib_none().0,
1014 interpolate_size.into_glib(),
1015 );
1016 }
1017 }
1018
1019 /// Sets the duration that transitions between pages in `self`
1020 /// will take.
1021 /// ## `duration`
1022 /// the new duration, in milliseconds
1023 #[doc(alias = "gtk_stack_set_transition_duration")]
1024 fn set_transition_duration(&self, duration: u32) {
1025 unsafe {
1026 ffi::gtk_stack_set_transition_duration(self.as_ref().to_glib_none().0, duration);
1027 }
1028 }
1029
1030 /// Sets the type of animation that will be used for
1031 /// transitions between pages in `self`. Available
1032 /// types include various kinds of fades and slides.
1033 ///
1034 /// The transition type can be changed without problems
1035 /// at runtime, so it is possible to change the animation
1036 /// based on the page that is about to become current.
1037 /// ## `transition`
1038 /// the new transition type
1039 #[doc(alias = "gtk_stack_set_transition_type")]
1040 fn set_transition_type(&self, transition: StackTransitionType) {
1041 unsafe {
1042 ffi::gtk_stack_set_transition_type(
1043 self.as_ref().to_glib_none().0,
1044 transition.into_glib(),
1045 );
1046 }
1047 }
1048
1049 /// Sets the [`Stack`][crate::Stack] to be vertically homogeneous or not.
1050 /// If it is homogeneous, the [`Stack`][crate::Stack] will request the same
1051 /// height for all its children. If it isn't, the stack
1052 /// may change height when a different child becomes visible.
1053 /// ## `vhomogeneous`
1054 /// [`true`] to make `self` vertically homogeneous
1055 #[doc(alias = "gtk_stack_set_vhomogeneous")]
1056 fn set_vhomogeneous(&self, vhomogeneous: bool) {
1057 unsafe {
1058 ffi::gtk_stack_set_vhomogeneous(
1059 self.as_ref().to_glib_none().0,
1060 vhomogeneous.into_glib(),
1061 );
1062 }
1063 }
1064
1065 /// Makes `child` the visible child of `self`.
1066 ///
1067 /// If `child` is different from the currently
1068 /// visible child, the transition between the
1069 /// two will be animated with the current
1070 /// transition type of `self`.
1071 ///
1072 /// Note that the `child` widget has to be visible itself
1073 /// (see [`WidgetExt::show()`][crate::prelude::WidgetExt::show()]) in order to become the visible
1074 /// child of `self`.
1075 /// ## `child`
1076 /// a child of `self`
1077 #[doc(alias = "gtk_stack_set_visible_child")]
1078 fn set_visible_child(&self, child: &impl IsA<Widget>) {
1079 unsafe {
1080 ffi::gtk_stack_set_visible_child(
1081 self.as_ref().to_glib_none().0,
1082 child.as_ref().to_glib_none().0,
1083 );
1084 }
1085 }
1086
1087 /// Makes the child with the given name visible.
1088 ///
1089 /// Note that the child widget has to be visible itself
1090 /// (see [`WidgetExt::show()`][crate::prelude::WidgetExt::show()]) in order to become the visible
1091 /// child of `self`.
1092 /// ## `name`
1093 /// the name of the child to make visible
1094 /// ## `transition`
1095 /// the transition type to use
1096 #[doc(alias = "gtk_stack_set_visible_child_full")]
1097 fn set_visible_child_full(&self, name: &str, transition: StackTransitionType) {
1098 unsafe {
1099 ffi::gtk_stack_set_visible_child_full(
1100 self.as_ref().to_glib_none().0,
1101 name.to_glib_none().0,
1102 transition.into_glib(),
1103 );
1104 }
1105 }
1106
1107 /// Makes the child with the given name visible.
1108 ///
1109 /// If `child` is different from the currently
1110 /// visible child, the transition between the
1111 /// two will be animated with the current
1112 /// transition type of `self`.
1113 ///
1114 /// Note that the child widget has to be visible itself
1115 /// (see [`WidgetExt::show()`][crate::prelude::WidgetExt::show()]) in order to become the visible
1116 /// child of `self`.
1117 /// ## `name`
1118 /// the name of the child to make visible
1119 #[doc(alias = "gtk_stack_set_visible_child_name")]
1120 fn set_visible_child_name(&self, name: &str) {
1121 unsafe {
1122 ffi::gtk_stack_set_visible_child_name(
1123 self.as_ref().to_glib_none().0,
1124 name.to_glib_none().0,
1125 );
1126 }
1127 }
1128
1129 #[doc(alias = "child.icon-name")]
1130 fn child_icon_name<T: IsA<crate::Widget>>(&self, item: &T) -> Option<glib::GString> {
1131 crate::prelude::ContainerExtManual::child_property(
1132 self.as_ref(),
1133 &item.clone().upcast(),
1134 "icon-name",
1135 )
1136 }
1137
1138 #[doc(alias = "child.icon-name")]
1139 fn set_child_icon_name<T: IsA<crate::Widget>>(&self, item: &T, icon_name: Option<&str>) {
1140 crate::prelude::ContainerExtManual::child_set_property(
1141 self.as_ref(),
1142 &item.clone().upcast(),
1143 "icon-name",
1144 &icon_name,
1145 )
1146 }
1147
1148 fn child_name<T: IsA<crate::Widget>>(&self, item: &T) -> Option<glib::GString> {
1149 crate::prelude::ContainerExtManual::child_property(
1150 self.as_ref(),
1151 &item.clone().upcast(),
1152 "name",
1153 )
1154 }
1155
1156 fn set_child_name<T: IsA<crate::Widget>>(&self, item: &T, name: Option<&str>) {
1157 crate::prelude::ContainerExtManual::child_set_property(
1158 self.as_ref(),
1159 &item.clone().upcast(),
1160 "name",
1161 &name,
1162 )
1163 }
1164
1165 #[doc(alias = "child.needs-attention")]
1166 fn child_needs_attention<T: IsA<crate::Widget>>(&self, item: &T) -> bool {
1167 crate::prelude::ContainerExtManual::child_property(
1168 self.as_ref(),
1169 &item.clone().upcast(),
1170 "needs-attention",
1171 )
1172 }
1173
1174 #[doc(alias = "child.needs-attention")]
1175 fn set_child_needs_attention<T: IsA<crate::Widget>>(&self, item: &T, needs_attention: bool) {
1176 crate::prelude::ContainerExtManual::child_set_property(
1177 self.as_ref(),
1178 &item.clone().upcast(),
1179 "needs-attention",
1180 &needs_attention,
1181 )
1182 }
1183
1184 fn child_position<T: IsA<crate::Widget>>(&self, item: &T) -> i32 {
1185 crate::prelude::ContainerExtManual::child_property(
1186 self.as_ref(),
1187 &item.clone().upcast(),
1188 "position",
1189 )
1190 }
1191
1192 fn set_child_position<T: IsA<crate::Widget>>(&self, item: &T, position: i32) {
1193 crate::prelude::ContainerExtManual::child_set_property(
1194 self.as_ref(),
1195 &item.clone().upcast(),
1196 "position",
1197 &position,
1198 )
1199 }
1200
1201 fn child_title<T: IsA<crate::Widget>>(&self, item: &T) -> Option<glib::GString> {
1202 crate::prelude::ContainerExtManual::child_property(
1203 self.as_ref(),
1204 &item.clone().upcast(),
1205 "title",
1206 )
1207 }
1208
1209 fn set_child_title<T: IsA<crate::Widget>>(&self, item: &T, title: Option<&str>) {
1210 crate::prelude::ContainerExtManual::child_set_property(
1211 self.as_ref(),
1212 &item.clone().upcast(),
1213 "title",
1214 &title,
1215 )
1216 }
1217
1218 #[doc(alias = "hhomogeneous")]
1219 fn connect_hhomogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1220 unsafe extern "C" fn notify_hhomogeneous_trampoline<P: IsA<Stack>, F: Fn(&P) + 'static>(
1221 this: *mut ffi::GtkStack,
1222 _param_spec: glib::ffi::gpointer,
1223 f: glib::ffi::gpointer,
1224 ) {
1225 let f: &F = &*(f as *const F);
1226 f(Stack::from_glib_borrow(this).unsafe_cast_ref())
1227 }
1228 unsafe {
1229 let f: Box_<F> = Box_::new(f);
1230 connect_raw(
1231 self.as_ptr() as *mut _,
1232 b"notify::hhomogeneous\0".as_ptr() as *const _,
1233 Some(transmute::<_, unsafe extern "C" fn()>(
1234 notify_hhomogeneous_trampoline::<Self, F> as *const (),
1235 )),
1236 Box_::into_raw(f),
1237 )
1238 }
1239 }
1240
1241 #[doc(alias = "homogeneous")]
1242 fn connect_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1243 unsafe extern "C" fn notify_homogeneous_trampoline<P: IsA<Stack>, F: Fn(&P) + 'static>(
1244 this: *mut ffi::GtkStack,
1245 _param_spec: glib::ffi::gpointer,
1246 f: glib::ffi::gpointer,
1247 ) {
1248 let f: &F = &*(f as *const F);
1249 f(Stack::from_glib_borrow(this).unsafe_cast_ref())
1250 }
1251 unsafe {
1252 let f: Box_<F> = Box_::new(f);
1253 connect_raw(
1254 self.as_ptr() as *mut _,
1255 b"notify::homogeneous\0".as_ptr() as *const _,
1256 Some(transmute::<_, unsafe extern "C" fn()>(
1257 notify_homogeneous_trampoline::<Self, F> as *const (),
1258 )),
1259 Box_::into_raw(f),
1260 )
1261 }
1262 }
1263
1264 #[doc(alias = "interpolate-size")]
1265 fn connect_interpolate_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1266 unsafe extern "C" fn notify_interpolate_size_trampoline<
1267 P: IsA<Stack>,
1268 F: Fn(&P) + 'static,
1269 >(
1270 this: *mut ffi::GtkStack,
1271 _param_spec: glib::ffi::gpointer,
1272 f: glib::ffi::gpointer,
1273 ) {
1274 let f: &F = &*(f as *const F);
1275 f(Stack::from_glib_borrow(this).unsafe_cast_ref())
1276 }
1277 unsafe {
1278 let f: Box_<F> = Box_::new(f);
1279 connect_raw(
1280 self.as_ptr() as *mut _,
1281 b"notify::interpolate-size\0".as_ptr() as *const _,
1282 Some(transmute::<_, unsafe extern "C" fn()>(
1283 notify_interpolate_size_trampoline::<Self, F> as *const (),
1284 )),
1285 Box_::into_raw(f),
1286 )
1287 }
1288 }
1289
1290 #[doc(alias = "transition-duration")]
1291 fn connect_transition_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1292 unsafe extern "C" fn notify_transition_duration_trampoline<
1293 P: IsA<Stack>,
1294 F: Fn(&P) + 'static,
1295 >(
1296 this: *mut ffi::GtkStack,
1297 _param_spec: glib::ffi::gpointer,
1298 f: glib::ffi::gpointer,
1299 ) {
1300 let f: &F = &*(f as *const F);
1301 f(Stack::from_glib_borrow(this).unsafe_cast_ref())
1302 }
1303 unsafe {
1304 let f: Box_<F> = Box_::new(f);
1305 connect_raw(
1306 self.as_ptr() as *mut _,
1307 b"notify::transition-duration\0".as_ptr() as *const _,
1308 Some(transmute::<_, unsafe extern "C" fn()>(
1309 notify_transition_duration_trampoline::<Self, F> as *const (),
1310 )),
1311 Box_::into_raw(f),
1312 )
1313 }
1314 }
1315
1316 #[doc(alias = "transition-running")]
1317 fn connect_transition_running_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1318 unsafe extern "C" fn notify_transition_running_trampoline<
1319 P: IsA<Stack>,
1320 F: Fn(&P) + 'static,
1321 >(
1322 this: *mut ffi::GtkStack,
1323 _param_spec: glib::ffi::gpointer,
1324 f: glib::ffi::gpointer,
1325 ) {
1326 let f: &F = &*(f as *const F);
1327 f(Stack::from_glib_borrow(this).unsafe_cast_ref())
1328 }
1329 unsafe {
1330 let f: Box_<F> = Box_::new(f);
1331 connect_raw(
1332 self.as_ptr() as *mut _,
1333 b"notify::transition-running\0".as_ptr() as *const _,
1334 Some(transmute::<_, unsafe extern "C" fn()>(
1335 notify_transition_running_trampoline::<Self, F> as *const (),
1336 )),
1337 Box_::into_raw(f),
1338 )
1339 }
1340 }
1341
1342 #[doc(alias = "transition-type")]
1343 fn connect_transition_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1344 unsafe extern "C" fn notify_transition_type_trampoline<
1345 P: IsA<Stack>,
1346 F: Fn(&P) + 'static,
1347 >(
1348 this: *mut ffi::GtkStack,
1349 _param_spec: glib::ffi::gpointer,
1350 f: glib::ffi::gpointer,
1351 ) {
1352 let f: &F = &*(f as *const F);
1353 f(Stack::from_glib_borrow(this).unsafe_cast_ref())
1354 }
1355 unsafe {
1356 let f: Box_<F> = Box_::new(f);
1357 connect_raw(
1358 self.as_ptr() as *mut _,
1359 b"notify::transition-type\0".as_ptr() as *const _,
1360 Some(transmute::<_, unsafe extern "C" fn()>(
1361 notify_transition_type_trampoline::<Self, F> as *const (),
1362 )),
1363 Box_::into_raw(f),
1364 )
1365 }
1366 }
1367
1368 #[doc(alias = "vhomogeneous")]
1369 fn connect_vhomogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1370 unsafe extern "C" fn notify_vhomogeneous_trampoline<P: IsA<Stack>, F: Fn(&P) + 'static>(
1371 this: *mut ffi::GtkStack,
1372 _param_spec: glib::ffi::gpointer,
1373 f: glib::ffi::gpointer,
1374 ) {
1375 let f: &F = &*(f as *const F);
1376 f(Stack::from_glib_borrow(this).unsafe_cast_ref())
1377 }
1378 unsafe {
1379 let f: Box_<F> = Box_::new(f);
1380 connect_raw(
1381 self.as_ptr() as *mut _,
1382 b"notify::vhomogeneous\0".as_ptr() as *const _,
1383 Some(transmute::<_, unsafe extern "C" fn()>(
1384 notify_vhomogeneous_trampoline::<Self, F> as *const (),
1385 )),
1386 Box_::into_raw(f),
1387 )
1388 }
1389 }
1390
1391 #[doc(alias = "visible-child")]
1392 fn connect_visible_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1393 unsafe extern "C" fn notify_visible_child_trampoline<P: IsA<Stack>, F: Fn(&P) + 'static>(
1394 this: *mut ffi::GtkStack,
1395 _param_spec: glib::ffi::gpointer,
1396 f: glib::ffi::gpointer,
1397 ) {
1398 let f: &F = &*(f as *const F);
1399 f(Stack::from_glib_borrow(this).unsafe_cast_ref())
1400 }
1401 unsafe {
1402 let f: Box_<F> = Box_::new(f);
1403 connect_raw(
1404 self.as_ptr() as *mut _,
1405 b"notify::visible-child\0".as_ptr() as *const _,
1406 Some(transmute::<_, unsafe extern "C" fn()>(
1407 notify_visible_child_trampoline::<Self, F> as *const (),
1408 )),
1409 Box_::into_raw(f),
1410 )
1411 }
1412 }
1413
1414 #[doc(alias = "visible-child-name")]
1415 fn connect_visible_child_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1416 unsafe extern "C" fn notify_visible_child_name_trampoline<
1417 P: IsA<Stack>,
1418 F: Fn(&P) + 'static,
1419 >(
1420 this: *mut ffi::GtkStack,
1421 _param_spec: glib::ffi::gpointer,
1422 f: glib::ffi::gpointer,
1423 ) {
1424 let f: &F = &*(f as *const F);
1425 f(Stack::from_glib_borrow(this).unsafe_cast_ref())
1426 }
1427 unsafe {
1428 let f: Box_<F> = Box_::new(f);
1429 connect_raw(
1430 self.as_ptr() as *mut _,
1431 b"notify::visible-child-name\0".as_ptr() as *const _,
1432 Some(transmute::<_, unsafe extern "C" fn()>(
1433 notify_visible_child_name_trampoline::<Self, F> as *const (),
1434 )),
1435 Box_::into_raw(f),
1436 )
1437 }
1438 }
1439}
1440
1441impl<O: IsA<Stack>> StackExt for O {}
1442
1443impl fmt::Display for Stack {
1444 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1445 f.write_str("Stack")
1446 }
1447}