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, ffi};
6use glib::{
7    prelude::*,
8    signal::{SignalHandlerId, connect_raw},
9    translate::*,
10};
11use std::boxed::Box as Box_;
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 | Writable | Construct
38    ///
39    ///
40    /// #### `transition-duration`
41    ///  Readable | Writable | Construct
42    ///
43    ///
44    /// #### `transition-type`
45    ///  Readable | Writable | Construct
46    /// <details><summary><h4>Container</h4></summary>
47    ///
48    ///
49    /// #### `border-width`
50    ///  Readable | Writable
51    ///
52    ///
53    /// #### `child`
54    ///  Writable
55    ///
56    ///
57    /// #### `resize-mode`
58    ///  Readable | Writable
59    /// </details>
60    /// <details><summary><h4>Widget</h4></summary>
61    ///
62    ///
63    /// #### `app-paintable`
64    ///  Readable | Writable
65    ///
66    ///
67    /// #### `can-default`
68    ///  Readable | Writable
69    ///
70    ///
71    /// #### `can-focus`
72    ///  Readable | Writable
73    ///
74    ///
75    /// #### `composite-child`
76    ///  Readable
77    ///
78    ///
79    /// #### `double-buffered`
80    ///  Whether the widget is double buffered.
81    ///
82    /// Readable | Writable
83    ///
84    ///
85    /// #### `events`
86    ///  Readable | Writable
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 | Writable
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 | Writable
104    ///
105    ///
106    /// #### `halign`
107    ///  How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
108    ///
109    /// Readable | Writable
110    ///
111    ///
112    /// #### `has-default`
113    ///  Readable | Writable
114    ///
115    ///
116    /// #### `has-focus`
117    ///  Readable | Writable
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 | Writable
132    ///
133    ///
134    /// #### `height-request`
135    ///  Readable | Writable
136    ///
137    ///
138    /// #### `hexpand`
139    ///  Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
140    ///
141    /// Readable | Writable
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 | Writable
148    ///
149    ///
150    /// #### `is-focus`
151    ///  Readable | Writable
152    ///
153    ///
154    /// #### `margin`
155    ///  Sets all four sides' margin at once. If read, returns max
156    /// margin on any side.
157    ///
158    /// Readable | Writable
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 | Writable
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 | Writable
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 | Writable
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 | Writable
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 | Writable
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 | Writable
221    ///
222    ///
223    /// #### `name`
224    ///  Readable | Writable
225    ///
226    ///
227    /// #### `no-show-all`
228    ///  Readable | Writable
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 | Writable
238    ///
239    ///
240    /// #### `parent`
241    ///  Readable | Writable
242    ///
243    ///
244    /// #### `receives-default`
245    ///  Readable | Writable
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 | Writable
257    ///
258    ///
259    /// #### `style`
260    ///  The style of the widget, which contains information about how it will look (colors, etc).
261    ///
262    /// Readable | Writable
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 | Writable
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 | Writable
295    ///
296    ///
297    /// #### `valign`
298    ///  How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
299    ///
300    /// Readable | Writable
301    ///
302    ///
303    /// #### `vexpand`
304    ///  Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
305    ///
306    /// Readable | Writable
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 | Writable
313    ///
314    ///
315    /// #### `visible`
316    ///  Readable | Writable
317    ///
318    ///
319    /// #### `width-request`
320    ///  Readable | Writable
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        assert_initialized_main_thread!();
694        self.builder.build()
695    }
696}
697
698/// Trait containing all [`struct@Revealer`] methods.
699///
700/// # Implementors
701///
702/// [`Revealer`][struct@crate::Revealer]
703pub trait RevealerExt: IsA<Revealer> + 'static {
704    /// Returns whether the child is fully revealed, in other words whether
705    /// the transition to the revealed state is completed.
706    ///
707    /// # Returns
708    ///
709    /// [`true`] if the child is fully revealed
710    #[doc(alias = "gtk_revealer_get_child_revealed")]
711    #[doc(alias = "get_child_revealed")]
712    #[doc(alias = "child-revealed")]
713    fn is_child_revealed(&self) -> bool {
714        unsafe {
715            from_glib(ffi::gtk_revealer_get_child_revealed(
716                self.as_ref().to_glib_none().0,
717            ))
718        }
719    }
720
721    /// Returns whether the child is currently
722    /// revealed. See [`set_reveal_child()`][Self::set_reveal_child()].
723    ///
724    /// This function returns [`true`] as soon as the transition
725    /// is to the revealed state is started. To learn whether
726    /// the child is fully revealed (ie the transition is completed),
727    /// use [`is_child_revealed()`][Self::is_child_revealed()].
728    ///
729    /// # Returns
730    ///
731    /// [`true`] if the child is revealed.
732    #[doc(alias = "gtk_revealer_get_reveal_child")]
733    #[doc(alias = "get_reveal_child")]
734    #[doc(alias = "reveal-child")]
735    fn reveals_child(&self) -> bool {
736        unsafe {
737            from_glib(ffi::gtk_revealer_get_reveal_child(
738                self.as_ref().to_glib_none().0,
739            ))
740        }
741    }
742
743    /// Returns the amount of time (in milliseconds) that
744    /// transitions will take.
745    ///
746    /// # Returns
747    ///
748    /// the transition duration
749    #[doc(alias = "gtk_revealer_get_transition_duration")]
750    #[doc(alias = "get_transition_duration")]
751    #[doc(alias = "transition-duration")]
752    fn transition_duration(&self) -> u32 {
753        unsafe { ffi::gtk_revealer_get_transition_duration(self.as_ref().to_glib_none().0) }
754    }
755
756    /// Gets the type of animation that will be used
757    /// for transitions in `self`.
758    ///
759    /// # Returns
760    ///
761    /// the current transition type of `self`
762    #[doc(alias = "gtk_revealer_get_transition_type")]
763    #[doc(alias = "get_transition_type")]
764    #[doc(alias = "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    #[doc(alias = "reveal-child")]
781    fn set_reveal_child(&self, reveal_child: bool) {
782        unsafe {
783            ffi::gtk_revealer_set_reveal_child(
784                self.as_ref().to_glib_none().0,
785                reveal_child.into_glib(),
786            );
787        }
788    }
789
790    /// Sets the duration that transitions will take.
791    /// ## `duration`
792    /// the new duration, in milliseconds
793    #[doc(alias = "gtk_revealer_set_transition_duration")]
794    #[doc(alias = "transition-duration")]
795    fn set_transition_duration(&self, duration: u32) {
796        unsafe {
797            ffi::gtk_revealer_set_transition_duration(self.as_ref().to_glib_none().0, duration);
798        }
799    }
800
801    /// Sets the type of animation that will be used for
802    /// transitions in `self`. Available types include
803    /// various kinds of fades and slides.
804    /// ## `transition`
805    /// the new transition type
806    #[doc(alias = "gtk_revealer_set_transition_type")]
807    #[doc(alias = "transition-type")]
808    fn set_transition_type(&self, transition: RevealerTransitionType) {
809        unsafe {
810            ffi::gtk_revealer_set_transition_type(
811                self.as_ref().to_glib_none().0,
812                transition.into_glib(),
813            );
814        }
815    }
816
817    #[doc(alias = "child-revealed")]
818    fn connect_child_revealed_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
819        unsafe extern "C" fn notify_child_revealed_trampoline<
820            P: IsA<Revealer>,
821            F: Fn(&P) + 'static,
822        >(
823            this: *mut ffi::GtkRevealer,
824            _param_spec: glib::ffi::gpointer,
825            f: glib::ffi::gpointer,
826        ) {
827            unsafe {
828                let f: &F = &*(f as *const F);
829                f(Revealer::from_glib_borrow(this).unsafe_cast_ref())
830            }
831        }
832        unsafe {
833            let f: Box_<F> = Box_::new(f);
834            connect_raw(
835                self.as_ptr() as *mut _,
836                c"notify::child-revealed".as_ptr(),
837                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
838                    notify_child_revealed_trampoline::<Self, F> as *const (),
839                )),
840                Box_::into_raw(f),
841            )
842        }
843    }
844
845    #[doc(alias = "reveal-child")]
846    fn connect_reveal_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
847        unsafe extern "C" fn notify_reveal_child_trampoline<
848            P: IsA<Revealer>,
849            F: Fn(&P) + 'static,
850        >(
851            this: *mut ffi::GtkRevealer,
852            _param_spec: glib::ffi::gpointer,
853            f: glib::ffi::gpointer,
854        ) {
855            unsafe {
856                let f: &F = &*(f as *const F);
857                f(Revealer::from_glib_borrow(this).unsafe_cast_ref())
858            }
859        }
860        unsafe {
861            let f: Box_<F> = Box_::new(f);
862            connect_raw(
863                self.as_ptr() as *mut _,
864                c"notify::reveal-child".as_ptr(),
865                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
866                    notify_reveal_child_trampoline::<Self, F> as *const (),
867                )),
868                Box_::into_raw(f),
869            )
870        }
871    }
872
873    #[doc(alias = "transition-duration")]
874    fn connect_transition_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
875        unsafe extern "C" fn notify_transition_duration_trampoline<
876            P: IsA<Revealer>,
877            F: Fn(&P) + 'static,
878        >(
879            this: *mut ffi::GtkRevealer,
880            _param_spec: glib::ffi::gpointer,
881            f: glib::ffi::gpointer,
882        ) {
883            unsafe {
884                let f: &F = &*(f as *const F);
885                f(Revealer::from_glib_borrow(this).unsafe_cast_ref())
886            }
887        }
888        unsafe {
889            let f: Box_<F> = Box_::new(f);
890            connect_raw(
891                self.as_ptr() as *mut _,
892                c"notify::transition-duration".as_ptr(),
893                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
894                    notify_transition_duration_trampoline::<Self, F> as *const (),
895                )),
896                Box_::into_raw(f),
897            )
898        }
899    }
900
901    #[doc(alias = "transition-type")]
902    fn connect_transition_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
903        unsafe extern "C" fn notify_transition_type_trampoline<
904            P: IsA<Revealer>,
905            F: Fn(&P) + 'static,
906        >(
907            this: *mut ffi::GtkRevealer,
908            _param_spec: glib::ffi::gpointer,
909            f: glib::ffi::gpointer,
910        ) {
911            unsafe {
912                let f: &F = &*(f as *const F);
913                f(Revealer::from_glib_borrow(this).unsafe_cast_ref())
914            }
915        }
916        unsafe {
917            let f: Box_<F> = Box_::new(f);
918            connect_raw(
919                self.as_ptr() as *mut _,
920                c"notify::transition-type".as_ptr(),
921                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
922                    notify_transition_type_trampoline::<Self, F> as *const (),
923                )),
924                Box_::into_raw(f),
925            )
926        }
927    }
928}
929
930impl<O: IsA<Revealer>> RevealerExt for O {}