Skip to main content

gtk/auto/
revealer.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, Bin, Buildable, Container, ResizeMode, RevealerTransitionType, 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 GtkRevealer widget is a container which animates
15    /// the transition of its child from invisible to visible.
16    ///
17    /// The style of transition can be controlled with
18    /// [`RevealerExt::set_transition_type()`][crate::prelude::RevealerExt::set_transition_type()].
19    ///
20    /// These animations respect the [`gtk-enable-animations`][struct@crate::Settings#gtk-enable-animations]
21    /// setting.
22    ///
23    /// # CSS nodes
24    ///
25    /// GtkRevealer has a single CSS node with name revealer.
26    ///
27    /// The GtkRevealer widget was added in GTK+ 3.10.
28    ///
29    /// ## Properties
30    ///
31    ///
32    /// #### `child-revealed`
33    ///  Readable
34    ///
35    ///
36    /// #### `reveal-child`
37    ///  Readable | Writeable | Construct
38    ///
39    ///
40    /// #### `transition-duration`
41    ///  Readable | Writeable | Construct
42    ///
43    ///
44    /// #### `transition-type`
45    ///  Readable | Writeable | Construct
46    /// <details><summary><h4>Container</h4></summary>
47    ///
48    ///
49    /// #### `border-width`
50    ///  Readable | Writeable
51    ///
52    ///
53    /// #### `child`
54    ///  Writeable
55    ///
56    ///
57    /// #### `resize-mode`
58    ///  Readable | Writeable
59    /// </details>
60    /// <details><summary><h4>Widget</h4></summary>
61    ///
62    ///
63    /// #### `app-paintable`
64    ///  Readable | Writeable
65    ///
66    ///
67    /// #### `can-default`
68    ///  Readable | Writeable
69    ///
70    ///
71    /// #### `can-focus`
72    ///  Readable | Writeable
73    ///
74    ///
75    /// #### `composite-child`
76    ///  Readable
77    ///
78    ///
79    /// #### `double-buffered`
80    ///  Whether the widget is double buffered.
81    ///
82    /// Readable | Writeable
83    ///
84    ///
85    /// #### `events`
86    ///  Readable | Writeable
87    ///
88    ///
89    /// #### `expand`
90    ///  Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
91    ///
92    /// Readable | Writeable
93    ///
94    ///
95    /// #### `focus-on-click`
96    ///  Whether the widget should grab focus when it is clicked with the mouse.
97    ///
98    /// This property is only relevant for widgets that can take focus.
99    ///
100    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
101    /// GtkComboBox) implemented this property individually.
102    ///
103    /// Readable | Writeable
104    ///
105    ///
106    /// #### `halign`
107    ///  How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
108    ///
109    /// Readable | Writeable
110    ///
111    ///
112    /// #### `has-default`
113    ///  Readable | Writeable
114    ///
115    ///
116    /// #### `has-focus`
117    ///  Readable | Writeable
118    ///
119    ///
120    /// #### `has-tooltip`
121    ///  Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
122    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
123    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
124    /// whether it will provide a tooltip or not.
125    ///
126    /// Note that setting this property to [`true`] for the first time will change
127    /// the event masks of the GdkWindows of this widget to include leave-notify
128    /// and motion-notify events. This cannot and will not be undone when the
129    /// property is set to [`false`] again.
130    ///
131    /// Readable | Writeable
132    ///
133    ///
134    /// #### `height-request`
135    ///  Readable | Writeable
136    ///
137    ///
138    /// #### `hexpand`
139    ///  Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
140    ///
141    /// Readable | Writeable
142    ///
143    ///
144    /// #### `hexpand-set`
145    ///  Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
146    ///
147    /// Readable | Writeable
148    ///
149    ///
150    /// #### `is-focus`
151    ///  Readable | Writeable
152    ///
153    ///
154    /// #### `margin`
155    ///  Sets all four sides' margin at once. If read, returns max
156    /// margin on any side.
157    ///
158    /// Readable | Writeable
159    ///
160    ///
161    /// #### `margin-bottom`
162    ///  Margin on bottom side of widget.
163    ///
164    /// This property adds margin outside of the widget's normal size
165    /// request, the margin will be added in addition to the size from
166    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
167    ///
168    /// Readable | Writeable
169    ///
170    ///
171    /// #### `margin-end`
172    ///  Margin on end of widget, horizontally. This property supports
173    /// left-to-right and right-to-left text directions.
174    ///
175    /// This property adds margin outside of the widget's normal size
176    /// request, the margin will be added in addition to the size from
177    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
178    ///
179    /// Readable | Writeable
180    ///
181    ///
182    /// #### `margin-left`
183    ///  Margin on left side of widget.
184    ///
185    /// This property adds margin outside of the widget's normal size
186    /// request, the margin will be added in addition to the size from
187    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
188    ///
189    /// Readable | Writeable
190    ///
191    ///
192    /// #### `margin-right`
193    ///  Margin on right side of widget.
194    ///
195    /// This property adds margin outside of the widget's normal size
196    /// request, the margin will be added in addition to the size from
197    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
198    ///
199    /// Readable | Writeable
200    ///
201    ///
202    /// #### `margin-start`
203    ///  Margin on start of widget, horizontally. This property supports
204    /// left-to-right and right-to-left text directions.
205    ///
206    /// This property adds margin outside of the widget's normal size
207    /// request, the margin will be added in addition to the size from
208    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
209    ///
210    /// Readable | Writeable
211    ///
212    ///
213    /// #### `margin-top`
214    ///  Margin on top side of widget.
215    ///
216    /// This property adds margin outside of the widget's normal size
217    /// request, the margin will be added in addition to the size from
218    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
219    ///
220    /// Readable | Writeable
221    ///
222    ///
223    /// #### `name`
224    ///  Readable | Writeable
225    ///
226    ///
227    /// #### `no-show-all`
228    ///  Readable | Writeable
229    ///
230    ///
231    /// #### `opacity`
232    ///  The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
233    /// more details about window opacity.
234    ///
235    /// Before 3.8 this was only available in GtkWindow
236    ///
237    /// Readable | Writeable
238    ///
239    ///
240    /// #### `parent`
241    ///  Readable | Writeable
242    ///
243    ///
244    /// #### `receives-default`
245    ///  Readable | Writeable
246    ///
247    ///
248    /// #### `scale-factor`
249    ///  The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
250    /// more details about widget scaling.
251    ///
252    /// Readable
253    ///
254    ///
255    /// #### `sensitive`
256    ///  Readable | Writeable
257    ///
258    ///
259    /// #### `style`
260    ///  The style of the widget, which contains information about how it will look (colors, etc).
261    ///
262    /// Readable | Writeable
263    ///
264    ///
265    /// #### `tooltip-markup`
266    ///  Sets the text of tooltip to be the given string, which is marked up
267    /// with the [Pango text markup language][PangoMarkupFormat].
268    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
269    ///
270    /// This is a convenience property which will take care of getting the
271    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
272    /// will automatically be set to [`true`] and there will be taken care of
273    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
274    ///
275    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
276    /// are set, the last one wins.
277    ///
278    /// Readable | Writeable
279    ///
280    ///
281    /// #### `tooltip-text`
282    ///  Sets the text of tooltip to be the given string.
283    ///
284    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
285    ///
286    /// This is a convenience property which will take care of getting the
287    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
288    /// will automatically be set to [`true`] and there will be taken care of
289    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
290    ///
291    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
292    /// are set, the last one wins.
293    ///
294    /// Readable | Writeable
295    ///
296    ///
297    /// #### `valign`
298    ///  How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
299    ///
300    /// Readable | Writeable
301    ///
302    ///
303    /// #### `vexpand`
304    ///  Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
305    ///
306    /// Readable | Writeable
307    ///
308    ///
309    /// #### `vexpand-set`
310    ///  Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
311    ///
312    /// Readable | Writeable
313    ///
314    ///
315    /// #### `visible`
316    ///  Readable | Writeable
317    ///
318    ///
319    /// #### `width-request`
320    ///  Readable | Writeable
321    ///
322    ///
323    /// #### `window`
324    ///  The widget's window if it is realized, [`None`] otherwise.
325    ///
326    /// Readable
327    /// </details>
328    ///
329    /// # Implements
330    ///
331    /// [`RevealerExt`][trait@crate::prelude::RevealerExt], [`BinExt`][trait@crate::prelude::BinExt], [`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]
332    #[doc(alias = "GtkRevealer")]
333    pub struct Revealer(Object<ffi::GtkRevealer, ffi::GtkRevealerClass>) @extends Bin, Container, Widget, @implements Buildable;
334
335    match fn {
336        type_ => || ffi::gtk_revealer_get_type(),
337    }
338}
339
340impl Revealer {
341    pub const NONE: Option<&'static Revealer> = None;
342
343    /// Creates a new [`Revealer`][crate::Revealer].
344    ///
345    /// # Returns
346    ///
347    /// a newly created [`Revealer`][crate::Revealer]
348    #[doc(alias = "gtk_revealer_new")]
349    pub fn new() -> Revealer {
350        assert_initialized_main_thread!();
351        unsafe { Widget::from_glib_none(ffi::gtk_revealer_new()).unsafe_cast() }
352    }
353
354    // rustdoc-stripper-ignore-next
355    /// Creates a new builder-pattern struct instance to construct [`Revealer`] objects.
356    ///
357    /// This method returns an instance of [`RevealerBuilder`](crate::builders::RevealerBuilder) which can be used to create [`Revealer`] objects.
358    pub fn builder() -> RevealerBuilder {
359        RevealerBuilder::new()
360    }
361}
362
363impl Default for Revealer {
364    fn default() -> Self {
365        Self::new()
366    }
367}
368
369// rustdoc-stripper-ignore-next
370/// A [builder-pattern] type to construct [`Revealer`] objects.
371///
372/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
373#[must_use = "The builder must be built to be used"]
374pub struct RevealerBuilder {
375    builder: glib::object::ObjectBuilder<'static, Revealer>,
376}
377
378impl RevealerBuilder {
379    fn new() -> Self {
380        Self {
381            builder: glib::object::Object::builder(),
382        }
383    }
384
385    pub fn reveal_child(self, reveal_child: bool) -> Self {
386        Self {
387            builder: self.builder.property("reveal-child", reveal_child),
388        }
389    }
390
391    pub fn transition_duration(self, transition_duration: u32) -> Self {
392        Self {
393            builder: self
394                .builder
395                .property("transition-duration", transition_duration),
396        }
397    }
398
399    pub fn transition_type(self, transition_type: RevealerTransitionType) -> Self {
400        Self {
401            builder: self.builder.property("transition-type", transition_type),
402        }
403    }
404
405    pub fn border_width(self, border_width: u32) -> Self {
406        Self {
407            builder: self.builder.property("border-width", border_width),
408        }
409    }
410
411    pub fn child(self, child: &impl IsA<Widget>) -> Self {
412        Self {
413            builder: self.builder.property("child", child.clone().upcast()),
414        }
415    }
416
417    pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
418        Self {
419            builder: self.builder.property("resize-mode", resize_mode),
420        }
421    }
422
423    pub fn app_paintable(self, app_paintable: bool) -> Self {
424        Self {
425            builder: self.builder.property("app-paintable", app_paintable),
426        }
427    }
428
429    pub fn can_default(self, can_default: bool) -> Self {
430        Self {
431            builder: self.builder.property("can-default", can_default),
432        }
433    }
434
435    pub fn can_focus(self, can_focus: bool) -> Self {
436        Self {
437            builder: self.builder.property("can-focus", can_focus),
438        }
439    }
440
441    pub fn events(self, events: gdk::EventMask) -> Self {
442        Self {
443            builder: self.builder.property("events", events),
444        }
445    }
446
447    /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
448    pub fn expand(self, expand: bool) -> Self {
449        Self {
450            builder: self.builder.property("expand", expand),
451        }
452    }
453
454    /// Whether the widget should grab focus when it is clicked with the mouse.
455    ///
456    /// This property is only relevant for widgets that can take focus.
457    ///
458    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
459    /// GtkComboBox) implemented this property individually.
460    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
461        Self {
462            builder: self.builder.property("focus-on-click", focus_on_click),
463        }
464    }
465
466    /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
467    pub fn halign(self, halign: Align) -> Self {
468        Self {
469            builder: self.builder.property("halign", halign),
470        }
471    }
472
473    pub fn has_default(self, has_default: bool) -> Self {
474        Self {
475            builder: self.builder.property("has-default", has_default),
476        }
477    }
478
479    pub fn has_focus(self, has_focus: bool) -> Self {
480        Self {
481            builder: self.builder.property("has-focus", has_focus),
482        }
483    }
484
485    /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
486    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
487    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
488    /// whether it will provide a tooltip or not.
489    ///
490    /// Note that setting this property to [`true`] for the first time will change
491    /// the event masks of the GdkWindows of this widget to include leave-notify
492    /// and motion-notify events. This cannot and will not be undone when the
493    /// property is set to [`false`] again.
494    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
495        Self {
496            builder: self.builder.property("has-tooltip", has_tooltip),
497        }
498    }
499
500    pub fn height_request(self, height_request: i32) -> Self {
501        Self {
502            builder: self.builder.property("height-request", height_request),
503        }
504    }
505
506    /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
507    pub fn hexpand(self, hexpand: bool) -> Self {
508        Self {
509            builder: self.builder.property("hexpand", hexpand),
510        }
511    }
512
513    /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
514    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
515        Self {
516            builder: self.builder.property("hexpand-set", hexpand_set),
517        }
518    }
519
520    pub fn is_focus(self, is_focus: bool) -> Self {
521        Self {
522            builder: self.builder.property("is-focus", is_focus),
523        }
524    }
525
526    /// Sets all four sides' margin at once. If read, returns max
527    /// margin on any side.
528    pub fn margin(self, margin: i32) -> Self {
529        Self {
530            builder: self.builder.property("margin", margin),
531        }
532    }
533
534    /// Margin on bottom side of widget.
535    ///
536    /// This property adds margin outside of the widget's normal size
537    /// request, the margin will be added in addition to the size from
538    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
539    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
540        Self {
541            builder: self.builder.property("margin-bottom", margin_bottom),
542        }
543    }
544
545    /// Margin on end of widget, horizontally. This property supports
546    /// left-to-right and right-to-left text directions.
547    ///
548    /// This property adds margin outside of the widget's normal size
549    /// request, the margin will be added in addition to the size from
550    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
551    pub fn margin_end(self, margin_end: i32) -> Self {
552        Self {
553            builder: self.builder.property("margin-end", margin_end),
554        }
555    }
556
557    /// Margin on start of widget, horizontally. This property supports
558    /// left-to-right and right-to-left text directions.
559    ///
560    /// This property adds margin outside of the widget's normal size
561    /// request, the margin will be added in addition to the size from
562    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
563    pub fn margin_start(self, margin_start: i32) -> Self {
564        Self {
565            builder: self.builder.property("margin-start", margin_start),
566        }
567    }
568
569    /// Margin on top side of widget.
570    ///
571    /// This property adds margin outside of the widget's normal size
572    /// request, the margin will be added in addition to the size from
573    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
574    pub fn margin_top(self, margin_top: i32) -> Self {
575        Self {
576            builder: self.builder.property("margin-top", margin_top),
577        }
578    }
579
580    pub fn name(self, name: impl Into<glib::GString>) -> Self {
581        Self {
582            builder: self.builder.property("name", name.into()),
583        }
584    }
585
586    pub fn no_show_all(self, no_show_all: bool) -> Self {
587        Self {
588            builder: self.builder.property("no-show-all", no_show_all),
589        }
590    }
591
592    /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
593    /// more details about window opacity.
594    ///
595    /// Before 3.8 this was only available in GtkWindow
596    pub fn opacity(self, opacity: f64) -> Self {
597        Self {
598            builder: self.builder.property("opacity", opacity),
599        }
600    }
601
602    pub fn parent(self, parent: &impl IsA<Container>) -> Self {
603        Self {
604            builder: self.builder.property("parent", parent.clone().upcast()),
605        }
606    }
607
608    pub fn receives_default(self, receives_default: bool) -> Self {
609        Self {
610            builder: self.builder.property("receives-default", receives_default),
611        }
612    }
613
614    pub fn sensitive(self, sensitive: bool) -> Self {
615        Self {
616            builder: self.builder.property("sensitive", sensitive),
617        }
618    }
619
620    /// Sets the text of tooltip to be the given string, which is marked up
621    /// with the [Pango text markup language][PangoMarkupFormat].
622    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
623    ///
624    /// This is a convenience property which will take care of getting the
625    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
626    /// will automatically be set to [`true`] and there will be taken care of
627    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
628    ///
629    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
630    /// are set, the last one wins.
631    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
632        Self {
633            builder: self
634                .builder
635                .property("tooltip-markup", tooltip_markup.into()),
636        }
637    }
638
639    /// Sets the text of tooltip to be the given string.
640    ///
641    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
642    ///
643    /// This is a convenience property which will take care of getting the
644    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
645    /// will automatically be set to [`true`] and there will be taken care of
646    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
647    ///
648    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
649    /// are set, the last one wins.
650    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
651        Self {
652            builder: self.builder.property("tooltip-text", tooltip_text.into()),
653        }
654    }
655
656    /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
657    pub fn valign(self, valign: Align) -> Self {
658        Self {
659            builder: self.builder.property("valign", valign),
660        }
661    }
662
663    /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
664    pub fn vexpand(self, vexpand: bool) -> Self {
665        Self {
666            builder: self.builder.property("vexpand", vexpand),
667        }
668    }
669
670    /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
671    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
672        Self {
673            builder: self.builder.property("vexpand-set", vexpand_set),
674        }
675    }
676
677    pub fn visible(self, visible: bool) -> Self {
678        Self {
679            builder: self.builder.property("visible", visible),
680        }
681    }
682
683    pub fn width_request(self, width_request: i32) -> Self {
684        Self {
685            builder: self.builder.property("width-request", width_request),
686        }
687    }
688
689    // rustdoc-stripper-ignore-next
690    /// Build the [`Revealer`].
691    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
692    pub fn build(self) -> Revealer {
693        self.builder.build()
694    }
695}
696
697mod sealed {
698    pub trait Sealed {}
699    impl<T: super::IsA<super::Revealer>> Sealed for T {}
700}
701
702/// Trait containing all [`struct@Revealer`] methods.
703///
704/// # Implementors
705///
706/// [`Revealer`][struct@crate::Revealer]
707pub trait RevealerExt: IsA<Revealer> + sealed::Sealed + 'static {
708    /// Returns whether the child is fully revealed, in other words whether
709    /// the transition to the revealed state is completed.
710    ///
711    /// # Returns
712    ///
713    /// [`true`] if the child is fully revealed
714    #[doc(alias = "gtk_revealer_get_child_revealed")]
715    #[doc(alias = "get_child_revealed")]
716    fn is_child_revealed(&self) -> bool {
717        unsafe {
718            from_glib(ffi::gtk_revealer_get_child_revealed(
719                self.as_ref().to_glib_none().0,
720            ))
721        }
722    }
723
724    /// Returns whether the child is currently
725    /// revealed. See [`set_reveal_child()`][Self::set_reveal_child()].
726    ///
727    /// This function returns [`true`] as soon as the transition
728    /// is to the revealed state is started. To learn whether
729    /// the child is fully revealed (ie the transition is completed),
730    /// use [`is_child_revealed()`][Self::is_child_revealed()].
731    ///
732    /// # Returns
733    ///
734    /// [`true`] if the child is revealed.
735    #[doc(alias = "gtk_revealer_get_reveal_child")]
736    #[doc(alias = "get_reveal_child")]
737    fn reveals_child(&self) -> bool {
738        unsafe {
739            from_glib(ffi::gtk_revealer_get_reveal_child(
740                self.as_ref().to_glib_none().0,
741            ))
742        }
743    }
744
745    /// Returns the amount of time (in milliseconds) that
746    /// transitions will take.
747    ///
748    /// # Returns
749    ///
750    /// the transition duration
751    #[doc(alias = "gtk_revealer_get_transition_duration")]
752    #[doc(alias = "get_transition_duration")]
753    fn transition_duration(&self) -> u32 {
754        unsafe { ffi::gtk_revealer_get_transition_duration(self.as_ref().to_glib_none().0) }
755    }
756
757    /// Gets the type of animation that will be used
758    /// for transitions in `self`.
759    ///
760    /// # Returns
761    ///
762    /// the current transition type of `self`
763    #[doc(alias = "gtk_revealer_get_transition_type")]
764    #[doc(alias = "get_transition_type")]
765    fn transition_type(&self) -> RevealerTransitionType {
766        unsafe {
767            from_glib(ffi::gtk_revealer_get_transition_type(
768                self.as_ref().to_glib_none().0,
769            ))
770        }
771    }
772
773    /// Tells the [`Revealer`][crate::Revealer] to reveal or conceal its child.
774    ///
775    /// The transition will be animated with the current
776    /// transition type of `self`.
777    /// ## `reveal_child`
778    /// [`true`] to reveal the child
779    #[doc(alias = "gtk_revealer_set_reveal_child")]
780    fn set_reveal_child(&self, reveal_child: bool) {
781        unsafe {
782            ffi::gtk_revealer_set_reveal_child(
783                self.as_ref().to_glib_none().0,
784                reveal_child.into_glib(),
785            );
786        }
787    }
788
789    /// Sets the duration that transitions will take.
790    /// ## `duration`
791    /// the new duration, in milliseconds
792    #[doc(alias = "gtk_revealer_set_transition_duration")]
793    fn set_transition_duration(&self, duration: u32) {
794        unsafe {
795            ffi::gtk_revealer_set_transition_duration(self.as_ref().to_glib_none().0, duration);
796        }
797    }
798
799    /// Sets the type of animation that will be used for
800    /// transitions in `self`. Available types include
801    /// various kinds of fades and slides.
802    /// ## `transition`
803    /// the new transition type
804    #[doc(alias = "gtk_revealer_set_transition_type")]
805    fn set_transition_type(&self, transition: RevealerTransitionType) {
806        unsafe {
807            ffi::gtk_revealer_set_transition_type(
808                self.as_ref().to_glib_none().0,
809                transition.into_glib(),
810            );
811        }
812    }
813
814    #[doc(alias = "child-revealed")]
815    fn connect_child_revealed_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
816        unsafe extern "C" fn notify_child_revealed_trampoline<
817            P: IsA<Revealer>,
818            F: Fn(&P) + 'static,
819        >(
820            this: *mut ffi::GtkRevealer,
821            _param_spec: glib::ffi::gpointer,
822            f: glib::ffi::gpointer,
823        ) {
824            let f: &F = &*(f as *const F);
825            f(Revealer::from_glib_borrow(this).unsafe_cast_ref())
826        }
827        unsafe {
828            let f: Box_<F> = Box_::new(f);
829            connect_raw(
830                self.as_ptr() as *mut _,
831                b"notify::child-revealed\0".as_ptr() as *const _,
832                Some(transmute::<_, unsafe extern "C" fn()>(
833                    notify_child_revealed_trampoline::<Self, F> as *const (),
834                )),
835                Box_::into_raw(f),
836            )
837        }
838    }
839
840    #[doc(alias = "reveal-child")]
841    fn connect_reveal_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
842        unsafe extern "C" fn notify_reveal_child_trampoline<
843            P: IsA<Revealer>,
844            F: Fn(&P) + 'static,
845        >(
846            this: *mut ffi::GtkRevealer,
847            _param_spec: glib::ffi::gpointer,
848            f: glib::ffi::gpointer,
849        ) {
850            let f: &F = &*(f as *const F);
851            f(Revealer::from_glib_borrow(this).unsafe_cast_ref())
852        }
853        unsafe {
854            let f: Box_<F> = Box_::new(f);
855            connect_raw(
856                self.as_ptr() as *mut _,
857                b"notify::reveal-child\0".as_ptr() as *const _,
858                Some(transmute::<_, unsafe extern "C" fn()>(
859                    notify_reveal_child_trampoline::<Self, F> as *const (),
860                )),
861                Box_::into_raw(f),
862            )
863        }
864    }
865
866    #[doc(alias = "transition-duration")]
867    fn connect_transition_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
868        unsafe extern "C" fn notify_transition_duration_trampoline<
869            P: IsA<Revealer>,
870            F: Fn(&P) + 'static,
871        >(
872            this: *mut ffi::GtkRevealer,
873            _param_spec: glib::ffi::gpointer,
874            f: glib::ffi::gpointer,
875        ) {
876            let f: &F = &*(f as *const F);
877            f(Revealer::from_glib_borrow(this).unsafe_cast_ref())
878        }
879        unsafe {
880            let f: Box_<F> = Box_::new(f);
881            connect_raw(
882                self.as_ptr() as *mut _,
883                b"notify::transition-duration\0".as_ptr() as *const _,
884                Some(transmute::<_, unsafe extern "C" fn()>(
885                    notify_transition_duration_trampoline::<Self, F> as *const (),
886                )),
887                Box_::into_raw(f),
888            )
889        }
890    }
891
892    #[doc(alias = "transition-type")]
893    fn connect_transition_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
894        unsafe extern "C" fn notify_transition_type_trampoline<
895            P: IsA<Revealer>,
896            F: Fn(&P) + 'static,
897        >(
898            this: *mut ffi::GtkRevealer,
899            _param_spec: glib::ffi::gpointer,
900            f: glib::ffi::gpointer,
901        ) {
902            let f: &F = &*(f as *const F);
903            f(Revealer::from_glib_borrow(this).unsafe_cast_ref())
904        }
905        unsafe {
906            let f: Box_<F> = Box_::new(f);
907            connect_raw(
908                self.as_ptr() as *mut _,
909                b"notify::transition-type\0".as_ptr() as *const _,
910                Some(transmute::<_, unsafe extern "C" fn()>(
911                    notify_transition_type_trampoline::<Self, F> as *const (),
912                )),
913                Box_::into_raw(f),
914            )
915        }
916    }
917}
918
919impl<O: IsA<Revealer>> RevealerExt for O {}
920
921impl fmt::Display for Revealer {
922    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
923        f.write_str("Revealer")
924    }
925}