Skip to main content

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