Skip to main content

gtk4/auto/
expander.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    Widget, ffi,
8};
9use glib::{
10    object::ObjectType as _,
11    prelude::*,
12    signal::{SignalHandlerId, connect_raw},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    /// Allows the user to reveal or conceal a child widget.
19    ///
20    /// <picture>
21    ///   <source srcset="expander-dark.png" media="(prefers-color-scheme: dark)">
22    ///   <img alt="An example GtkExpander" src="expander.png">
23    /// </picture>
24    ///
25    /// This is similar to the triangles used in a [`TreeView`][crate::TreeView].
26    ///
27    /// Normally you use an expander as you would use a frame; you create
28    /// the child widget and use [`set_child()`][Self::set_child()] to add it
29    /// to the expander. When the expander is toggled, it will take care of
30    /// showing and hiding the child automatically.
31    ///
32    /// # Special Usage
33    ///
34    /// There are situations in which you may prefer to show and hide the
35    /// expanded widget yourself, such as when you want to actually create
36    /// the widget at expansion time. In this case, create a [`Expander`][crate::Expander]
37    /// but do not add a child to it. The expander widget has an
38    /// [`expanded`][struct@crate::Expander#expanded] property which can be used to
39    /// monitor its expansion state. You should watch this property with
40    /// a signal connection as follows:
41    ///
42    /// **⚠️ The following code is in c ⚠️**
43    ///
44    /// ```c
45    /// static void
46    /// expander_callback (GObject    *object,
47    ///                    GParamSpec *param_spec,
48    ///                    gpointer    user_data)
49    /// {
50    ///   GtkExpander *expander;
51    ///
52    ///   expander = GTK_EXPANDER (object);
53    ///
54    ///   if (gtk_expander_get_expanded (expander))
55    ///     {
56    ///       // Show or create widgets
57    ///     }
58    ///   else
59    ///     {
60    ///       // Hide or destroy widgets
61    ///     }
62    /// }
63    ///
64    /// static void
65    /// create_expander (void)
66    /// {
67    ///   GtkWidget *expander = gtk_expander_new_with_mnemonic ("_More Options");
68    ///   g_signal_connect (expander, "notify::expanded",
69    ///                     G_CALLBACK (expander_callback), NULL);
70    ///
71    ///   // ...
72    /// }
73    /// ```
74    ///
75    /// # GtkExpander as GtkBuildable
76    ///
77    /// An example of a UI definition fragment with GtkExpander:
78    ///
79    /// ```xml
80    /// <object class="GtkExpander">
81    ///   <property name="label-widget">
82    ///     <object class="GtkLabel" id="expander-label"/>
83    ///   </property>
84    ///   <property name="child">
85    ///     <object class="GtkEntry" id="expander-content"/>
86    ///   </property>
87    /// </object>
88    /// ```
89    ///
90    /// # CSS nodes
91    ///
92    /// ```text
93    /// expander-widget
94    /// ╰── box
95    ///     ├── title
96    ///     │   ├── expander
97    ///     │   ╰── <label widget>
98    ///     ╰── <child>
99    /// ```
100    ///
101    /// [`Expander`][crate::Expander] has a main node `expander-widget`, and subnode `box` containing
102    /// the title and child widget. The box subnode `title` contains node `expander`,
103    /// i.e. the expand/collapse arrow; then the label widget if any. The arrow of an
104    /// expander that is showing its child gets the `:checked` pseudoclass set on it.
105    ///
106    /// # Accessibility
107    ///
108    /// [`Expander`][crate::Expander] uses the [enum@Gtk.AccessibleRole.button] role.
109    ///
110    /// ## Properties
111    ///
112    ///
113    /// #### `child`
114    ///  The child widget.
115    ///
116    /// Readable | Writeable
117    ///
118    ///
119    /// #### `expanded`
120    ///  Whether the expander has been opened to reveal the child.
121    ///
122    /// Readable | Writeable | Construct
123    ///
124    ///
125    /// #### `label`
126    ///  The text of the expanders label.
127    ///
128    /// Readable | Writeable | Construct
129    ///
130    ///
131    /// #### `label-widget`
132    ///  A widget to display instead of the usual expander label.
133    ///
134    /// Readable | Writeable
135    ///
136    ///
137    /// #### `resize-toplevel`
138    ///  When this property is [`true`], the expander will resize the toplevel
139    /// widget containing the expander upon expanding and collapsing.
140    ///
141    /// Readable | Writeable
142    ///
143    ///
144    /// #### `use-markup`
145    ///  Whether the text in the label is Pango markup.
146    ///
147    /// Readable | Writeable | Construct
148    ///
149    ///
150    /// #### `use-underline`
151    ///  Whether an underline in the text indicates a mnemonic.
152    ///
153    /// Readable | Writeable | Construct
154    /// <details><summary><h4>Widget</h4></summary>
155    ///
156    ///
157    /// #### `can-focus`
158    ///  Whether the widget or any of its descendents can accept
159    /// the input focus.
160    ///
161    /// This property is meant to be set by widget implementations,
162    /// typically in their instance init function.
163    ///
164    /// Readable | Writeable
165    ///
166    ///
167    /// #### `can-target`
168    ///  Whether the widget can receive pointer events.
169    ///
170    /// Readable | Writeable
171    ///
172    ///
173    /// #### `css-classes`
174    ///  A list of css classes applied to this widget.
175    ///
176    /// Readable | Writeable
177    ///
178    ///
179    /// #### `css-name`
180    ///  The name of this widget in the CSS tree.
181    ///
182    /// This property is meant to be set by widget implementations,
183    /// typically in their instance init function.
184    ///
185    /// Readable | Writeable | Construct Only
186    ///
187    ///
188    /// #### `cursor`
189    ///  The cursor used by @widget.
190    ///
191    /// Readable | Writeable
192    ///
193    ///
194    /// #### `focus-on-click`
195    ///  Whether the widget should grab focus when it is clicked with the mouse.
196    ///
197    /// This property is only relevant for widgets that can take focus.
198    ///
199    /// Readable | Writeable
200    ///
201    ///
202    /// #### `focusable`
203    ///  Whether this widget itself will accept the input focus.
204    ///
205    /// Readable | Writeable
206    ///
207    ///
208    /// #### `halign`
209    ///  How to distribute horizontal space if widget gets extra space.
210    ///
211    /// Readable | Writeable
212    ///
213    ///
214    /// #### `has-default`
215    ///  Whether the widget is the default widget.
216    ///
217    /// Readable
218    ///
219    ///
220    /// #### `has-focus`
221    ///  Whether the widget has the input focus.
222    ///
223    /// Readable
224    ///
225    ///
226    /// #### `has-tooltip`
227    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
228    /// signal on @widget.
229    ///
230    /// A true value indicates that @widget can have a tooltip, in this case
231    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
232    /// determine whether it will provide a tooltip or not.
233    ///
234    /// Readable | Writeable
235    ///
236    ///
237    /// #### `height-request`
238    ///  Overrides for height request of the widget.
239    ///
240    /// If this is -1, the natural request will be used.
241    ///
242    /// Readable | Writeable
243    ///
244    ///
245    /// #### `hexpand`
246    ///  Whether to expand horizontally.
247    ///
248    /// Readable | Writeable
249    ///
250    ///
251    /// #### `hexpand-set`
252    ///  Whether to use the `hexpand` property.
253    ///
254    /// Readable | Writeable
255    ///
256    ///
257    /// #### `layout-manager`
258    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
259    /// the preferred size of the widget, and allocate its children.
260    ///
261    /// This property is meant to be set by widget implementations,
262    /// typically in their instance init function.
263    ///
264    /// Readable | Writeable
265    ///
266    ///
267    /// #### `limit-events`
268    ///  Makes this widget act like a modal dialog, with respect to
269    /// event delivery.
270    ///
271    /// Global event controllers will not handle events with targets
272    /// inside the widget, unless they are set up to ignore propagation
273    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
274    ///
275    /// Readable | Writeable
276    ///
277    ///
278    /// #### `margin-bottom`
279    ///  Margin on bottom side of widget.
280    ///
281    /// This property adds margin outside of the widget's normal size
282    /// request, the margin will be added in addition to the size from
283    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
284    ///
285    /// Readable | Writeable
286    ///
287    ///
288    /// #### `margin-end`
289    ///  Margin on end of widget, horizontally.
290    ///
291    /// This property supports left-to-right and right-to-left text
292    /// directions.
293    ///
294    /// This property adds margin outside of the widget's normal size
295    /// request, the margin will be added in addition to the size from
296    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
297    ///
298    /// Readable | Writeable
299    ///
300    ///
301    /// #### `margin-start`
302    ///  Margin on start of widget, horizontally.
303    ///
304    /// This property supports left-to-right and right-to-left text
305    /// directions.
306    ///
307    /// This property adds margin outside of the widget's normal size
308    /// request, the margin will be added in addition to the size from
309    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
310    ///
311    /// Readable | Writeable
312    ///
313    ///
314    /// #### `margin-top`
315    ///  Margin on top side of widget.
316    ///
317    /// This property adds margin outside of the widget's normal size
318    /// request, the margin will be added in addition to the size from
319    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
320    ///
321    /// Readable | Writeable
322    ///
323    ///
324    /// #### `name`
325    ///  The name of the widget.
326    ///
327    /// Readable | Writeable
328    ///
329    ///
330    /// #### `opacity`
331    ///  The requested opacity of the widget.
332    ///
333    /// Readable | Writeable
334    ///
335    ///
336    /// #### `overflow`
337    ///  How content outside the widget's content area is treated.
338    ///
339    /// This property is meant to be set by widget implementations,
340    /// typically in their instance init function.
341    ///
342    /// Readable | Writeable
343    ///
344    ///
345    /// #### `parent`
346    ///  The parent widget of this widget.
347    ///
348    /// Readable
349    ///
350    ///
351    /// #### `receives-default`
352    ///  Whether the widget will receive the default action when it is focused.
353    ///
354    /// Readable | Writeable
355    ///
356    ///
357    /// #### `root`
358    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
359    ///
360    /// This will be `NULL` if the widget is not contained in a root widget.
361    ///
362    /// Readable
363    ///
364    ///
365    /// #### `scale-factor`
366    ///  The scale factor of the widget.
367    ///
368    /// Readable
369    ///
370    ///
371    /// #### `sensitive`
372    ///  Whether the widget responds to input.
373    ///
374    /// Readable | Writeable
375    ///
376    ///
377    /// #### `tooltip-markup`
378    ///  Sets the text of tooltip to be the given string, which is marked up
379    /// with Pango markup.
380    ///
381    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
382    ///
383    /// This is a convenience property which will take care of getting the
384    /// tooltip shown if the given string is not `NULL`:
385    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
386    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
387    /// the default signal handler.
388    ///
389    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
390    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
391    ///
392    /// Readable | Writeable
393    ///
394    ///
395    /// #### `tooltip-text`
396    ///  Sets the text of tooltip to be the given string.
397    ///
398    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
399    ///
400    /// This is a convenience property which will take care of getting the
401    /// tooltip shown if the given string is not `NULL`:
402    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
403    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
404    /// the default signal handler.
405    ///
406    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
407    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
408    ///
409    /// Readable | Writeable
410    ///
411    ///
412    /// #### `valign`
413    ///  How to distribute vertical space if widget gets extra space.
414    ///
415    /// Readable | Writeable
416    ///
417    ///
418    /// #### `vexpand`
419    ///  Whether to expand vertically.
420    ///
421    /// Readable | Writeable
422    ///
423    ///
424    /// #### `vexpand-set`
425    ///  Whether to use the `vexpand` property.
426    ///
427    /// Readable | Writeable
428    ///
429    ///
430    /// #### `visible`
431    ///  Whether the widget is visible.
432    ///
433    /// Readable | Writeable
434    ///
435    ///
436    /// #### `width-request`
437    ///  Overrides for width request of the widget.
438    ///
439    /// If this is -1, the natural request will be used.
440    ///
441    /// Readable | Writeable
442    /// </details>
443    /// <details><summary><h4>Accessible</h4></summary>
444    ///
445    ///
446    /// #### `accessible-role`
447    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
448    ///
449    /// The accessible role cannot be changed once set.
450    ///
451    /// Readable | Writeable
452    /// </details>
453    ///
454    /// ## Signals
455    ///
456    ///
457    /// #### `activate`
458    ///  Activates the [`Expander`][crate::Expander].
459    ///
460    /// Action
461    /// <details><summary><h4>Widget</h4></summary>
462    ///
463    ///
464    /// #### `destroy`
465    ///  Signals that all holders of a reference to the widget should release
466    /// the reference that they hold.
467    ///
468    /// May result in finalization of the widget if all references are released.
469    ///
470    /// This signal is not suitable for saving widget state.
471    ///
472    ///
473    ///
474    ///
475    /// #### `direction-changed`
476    ///  Emitted when the text direction of a widget changes.
477    ///
478    ///
479    ///
480    ///
481    /// #### `hide`
482    ///  Emitted when @widget is hidden.
483    ///
484    ///
485    ///
486    ///
487    /// #### `keynav-failed`
488    ///  Emitted if keyboard navigation fails.
489    ///
490    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
491    ///
492    ///
493    ///
494    ///
495    /// #### `map`
496    ///  Emitted when @widget is going to be mapped.
497    ///
498    /// A widget is mapped when the widget is visible (which is controlled with
499    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
500    /// are also visible.
501    ///
502    /// The `::map` signal can be used to determine whether a widget will be drawn,
503    /// for instance it can resume an animation that was stopped during the
504    /// emission of [`unmap`][struct@crate::Widget#unmap].
505    ///
506    ///
507    ///
508    ///
509    /// #### `mnemonic-activate`
510    ///  Emitted when a widget is activated via a mnemonic.
511    ///
512    /// The default handler for this signal activates @widget if @group_cycling
513    /// is false, or just makes @widget grab focus if @group_cycling is true.
514    ///
515    ///
516    ///
517    ///
518    /// #### `move-focus`
519    ///  Emitted when the focus is moved.
520    ///
521    /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
522    ///
523    /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
524    /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
525    ///
526    /// Action
527    ///
528    ///
529    /// #### `query-tooltip`
530    ///  Emitted when the widget’s tooltip is about to be shown.
531    ///
532    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
533    /// is true and the hover timeout has expired with the cursor hovering
534    /// above @widget; or emitted when @widget got focus in keyboard mode.
535    ///
536    /// Using the given coordinates, the signal handler should determine
537    /// whether a tooltip should be shown for @widget. If this is the case
538    /// true should be returned, false otherwise. Note that if @keyboard_mode
539    /// is true, the values of @x and @y are undefined and should not be used.
540    ///
541    /// The signal handler is free to manipulate @tooltip with the therefore
542    /// destined function calls.
543    ///
544    ///
545    ///
546    ///
547    /// #### `realize`
548    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
549    ///
550    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
551    /// or the widget has been mapped (that is, it is going to be drawn).
552    ///
553    ///
554    ///
555    ///
556    /// #### `show`
557    ///  Emitted when @widget is shown.
558    ///
559    ///
560    ///
561    ///
562    /// #### `state-flags-changed`
563    ///  Emitted when the widget state changes.
564    ///
565    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
566    ///
567    ///
568    ///
569    ///
570    /// #### `unmap`
571    ///  Emitted when @widget is going to be unmapped.
572    ///
573    /// A widget is unmapped when either it or any of its parents up to the
574    /// toplevel widget have been set as hidden.
575    ///
576    /// As `::unmap` indicates that a widget will not be shown any longer,
577    /// it can be used to, for example, stop an animation on the widget.
578    ///
579    ///
580    ///
581    ///
582    /// #### `unrealize`
583    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
584    ///
585    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
586    /// or the widget has been unmapped (that is, it is going to be hidden).
587    ///
588    ///
589    /// </details>
590    ///
591    /// # Implements
592    ///
593    /// [`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]
594    #[doc(alias = "GtkExpander")]
595    pub struct Expander(Object<ffi::GtkExpander>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget;
596
597    match fn {
598        type_ => || ffi::gtk_expander_get_type(),
599    }
600}
601
602impl Expander {
603    /// Creates a new expander using @label as the text of the label.
604    /// ## `label`
605    /// the text of the label
606    ///
607    /// # Returns
608    ///
609    /// a new [`Expander`][crate::Expander] widget.
610    #[doc(alias = "gtk_expander_new")]
611    pub fn new(label: Option<&str>) -> Expander {
612        assert_initialized_main_thread!();
613        unsafe {
614            Widget::from_glib_none(ffi::gtk_expander_new(label.to_glib_none().0)).unsafe_cast()
615        }
616    }
617
618    /// Creates a new expander using @label as the text of the label.
619    ///
620    /// If characters in @label are preceded by an underscore, they are
621    /// underlined. If you need a literal underscore character in a label,
622    /// use “__” (two underscores). The first underlined character represents
623    /// a keyboard accelerator called a mnemonic.
624    ///
625    /// Pressing Alt and that key activates the button.
626    /// ## `label`
627    /// the text of the label with an underscore
628    ///   in front of the mnemonic character
629    ///
630    /// # Returns
631    ///
632    /// a new [`Expander`][crate::Expander] widget.
633    #[doc(alias = "gtk_expander_new_with_mnemonic")]
634    #[doc(alias = "new_with_mnemonic")]
635    pub fn with_mnemonic(label: &str) -> Expander {
636        assert_initialized_main_thread!();
637        unsafe {
638            Widget::from_glib_none(ffi::gtk_expander_new_with_mnemonic(label.to_glib_none().0))
639                .unsafe_cast()
640        }
641    }
642
643    // rustdoc-stripper-ignore-next
644    /// Creates a new builder-pattern struct instance to construct [`Expander`] objects.
645    ///
646    /// This method returns an instance of [`ExpanderBuilder`](crate::builders::ExpanderBuilder) which can be used to create [`Expander`] objects.
647    pub fn builder() -> ExpanderBuilder {
648        ExpanderBuilder::new()
649    }
650
651    /// Gets the child widget of @self.
652    ///
653    /// # Returns
654    ///
655    /// the child widget of @self
656    #[doc(alias = "gtk_expander_get_child")]
657    #[doc(alias = "get_child")]
658    pub fn child(&self) -> Option<Widget> {
659        unsafe { from_glib_none(ffi::gtk_expander_get_child(self.to_glib_none().0)) }
660    }
661
662    /// Queries a [`Expander`][crate::Expander] and returns its current state.
663    ///
664    /// Returns [`true`] if the child widget is revealed.
665    ///
666    /// # Returns
667    ///
668    /// the current state of the expander
669    #[doc(alias = "gtk_expander_get_expanded")]
670    #[doc(alias = "get_expanded")]
671    #[doc(alias = "expanded")]
672    pub fn is_expanded(&self) -> bool {
673        unsafe { from_glib(ffi::gtk_expander_get_expanded(self.to_glib_none().0)) }
674    }
675
676    /// Fetches the text from a label widget.
677    ///
678    /// This is including any embedded underlines indicating mnemonics and
679    /// Pango markup, as set by [`set_label()`][Self::set_label()]. If the label
680    /// text has not been set the return value will be [`None`]. This will be the
681    /// case if you create an empty button with gtk_button_new() to use as a
682    /// container.
683    ///
684    /// # Returns
685    ///
686    /// The text of the label widget. This string is owned
687    ///   by the widget and must not be modified or freed.
688    #[doc(alias = "gtk_expander_get_label")]
689    #[doc(alias = "get_label")]
690    pub fn label(&self) -> Option<glib::GString> {
691        unsafe { from_glib_none(ffi::gtk_expander_get_label(self.to_glib_none().0)) }
692    }
693
694    /// Retrieves the label widget for the frame.
695    ///
696    /// # Returns
697    ///
698    /// the label widget
699    #[doc(alias = "gtk_expander_get_label_widget")]
700    #[doc(alias = "get_label_widget")]
701    #[doc(alias = "label-widget")]
702    pub fn label_widget(&self) -> Option<Widget> {
703        unsafe { from_glib_none(ffi::gtk_expander_get_label_widget(self.to_glib_none().0)) }
704    }
705
706    /// Returns whether the expander will resize the toplevel widget
707    /// containing the expander upon resizing and collapsing.
708    ///
709    /// # Returns
710    ///
711    /// the “resize toplevel” setting.
712    #[doc(alias = "gtk_expander_get_resize_toplevel")]
713    #[doc(alias = "get_resize_toplevel")]
714    #[doc(alias = "resize-toplevel")]
715    pub fn resizes_toplevel(&self) -> bool {
716        unsafe { from_glib(ffi::gtk_expander_get_resize_toplevel(self.to_glib_none().0)) }
717    }
718
719    /// Returns whether the label’s text is interpreted as Pango markup.
720    ///
721    /// # Returns
722    ///
723    /// [`true`] if the label’s text will be parsed for markup
724    #[doc(alias = "gtk_expander_get_use_markup")]
725    #[doc(alias = "get_use_markup")]
726    #[doc(alias = "use-markup")]
727    pub fn uses_markup(&self) -> bool {
728        unsafe { from_glib(ffi::gtk_expander_get_use_markup(self.to_glib_none().0)) }
729    }
730
731    /// Returns whether an underline in the text indicates a mnemonic.
732    ///
733    /// # Returns
734    ///
735    /// [`true`] if an embedded underline in the expander
736    ///   label indicates the mnemonic accelerator keys
737    #[doc(alias = "gtk_expander_get_use_underline")]
738    #[doc(alias = "get_use_underline")]
739    #[doc(alias = "use-underline")]
740    pub fn uses_underline(&self) -> bool {
741        unsafe { from_glib(ffi::gtk_expander_get_use_underline(self.to_glib_none().0)) }
742    }
743
744    /// Sets the child widget of @self.
745    /// ## `child`
746    /// the child widget
747    #[doc(alias = "gtk_expander_set_child")]
748    #[doc(alias = "child")]
749    pub fn set_child(&self, child: Option<&impl IsA<Widget>>) {
750        unsafe {
751            ffi::gtk_expander_set_child(
752                self.to_glib_none().0,
753                child.map(|p| p.as_ref()).to_glib_none().0,
754            );
755        }
756    }
757
758    /// Sets the state of the expander.
759    ///
760    /// Set to [`true`], if you want the child widget to be revealed,
761    /// and [`false`] if you want the child widget to be hidden.
762    /// ## `expanded`
763    /// whether the child widget is revealed
764    #[doc(alias = "gtk_expander_set_expanded")]
765    #[doc(alias = "expanded")]
766    pub fn set_expanded(&self, expanded: bool) {
767        unsafe {
768            ffi::gtk_expander_set_expanded(self.to_glib_none().0, expanded.into_glib());
769        }
770    }
771
772    /// Sets the text of the label of the expander to @label.
773    ///
774    /// This will also clear any previously set labels.
775    /// ## `label`
776    /// a string
777    #[doc(alias = "gtk_expander_set_label")]
778    #[doc(alias = "label")]
779    pub fn set_label(&self, label: Option<&str>) {
780        unsafe {
781            ffi::gtk_expander_set_label(self.to_glib_none().0, label.to_glib_none().0);
782        }
783    }
784
785    /// Set the label widget for the expander.
786    ///
787    /// This is the widget that will appear embedded alongside
788    /// the expander arrow.
789    /// ## `label_widget`
790    /// the new label widget
791    #[doc(alias = "gtk_expander_set_label_widget")]
792    #[doc(alias = "label-widget")]
793    pub fn set_label_widget(&self, label_widget: Option<&impl IsA<Widget>>) {
794        unsafe {
795            ffi::gtk_expander_set_label_widget(
796                self.to_glib_none().0,
797                label_widget.map(|p| p.as_ref()).to_glib_none().0,
798            );
799        }
800    }
801
802    /// Sets whether the expander will resize the toplevel widget
803    /// containing the expander upon resizing and collapsing.
804    /// ## `resize_toplevel`
805    /// whether to resize the toplevel
806    #[doc(alias = "gtk_expander_set_resize_toplevel")]
807    #[doc(alias = "resize-toplevel")]
808    pub fn set_resize_toplevel(&self, resize_toplevel: bool) {
809        unsafe {
810            ffi::gtk_expander_set_resize_toplevel(
811                self.to_glib_none().0,
812                resize_toplevel.into_glib(),
813            );
814        }
815    }
816
817    /// Sets whether the text of the label contains Pango markup.
818    /// ## `use_markup`
819    /// [`true`] if the label’s text should be parsed for markup
820    #[doc(alias = "gtk_expander_set_use_markup")]
821    #[doc(alias = "use-markup")]
822    pub fn set_use_markup(&self, use_markup: bool) {
823        unsafe {
824            ffi::gtk_expander_set_use_markup(self.to_glib_none().0, use_markup.into_glib());
825        }
826    }
827
828    /// If true, an underline in the text indicates a mnemonic.
829    /// ## `use_underline`
830    /// [`true`] if underlines in the text indicate mnemonics
831    #[doc(alias = "gtk_expander_set_use_underline")]
832    #[doc(alias = "use-underline")]
833    pub fn set_use_underline(&self, use_underline: bool) {
834        unsafe {
835            ffi::gtk_expander_set_use_underline(self.to_glib_none().0, use_underline.into_glib());
836        }
837    }
838
839    /// Activates the [`Expander`][crate::Expander].
840    #[doc(alias = "activate")]
841    pub fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
842        unsafe extern "C" fn activate_trampoline<F: Fn(&Expander) + 'static>(
843            this: *mut ffi::GtkExpander,
844            f: glib::ffi::gpointer,
845        ) {
846            unsafe {
847                let f: &F = &*(f as *const F);
848                f(&from_glib_borrow(this))
849            }
850        }
851        unsafe {
852            let f: Box_<F> = Box_::new(f);
853            connect_raw(
854                self.as_ptr() as *mut _,
855                c"activate".as_ptr() as *const _,
856                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
857                    activate_trampoline::<F> as *const (),
858                )),
859                Box_::into_raw(f),
860            )
861        }
862    }
863
864    pub fn emit_activate(&self) {
865        self.emit_by_name::<()>("activate", &[]);
866    }
867
868    #[doc(alias = "child")]
869    pub fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
870        unsafe extern "C" fn notify_child_trampoline<F: Fn(&Expander) + 'static>(
871            this: *mut ffi::GtkExpander,
872            _param_spec: glib::ffi::gpointer,
873            f: glib::ffi::gpointer,
874        ) {
875            unsafe {
876                let f: &F = &*(f as *const F);
877                f(&from_glib_borrow(this))
878            }
879        }
880        unsafe {
881            let f: Box_<F> = Box_::new(f);
882            connect_raw(
883                self.as_ptr() as *mut _,
884                c"notify::child".as_ptr() as *const _,
885                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
886                    notify_child_trampoline::<F> as *const (),
887                )),
888                Box_::into_raw(f),
889            )
890        }
891    }
892
893    #[doc(alias = "expanded")]
894    pub fn connect_expanded_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
895        unsafe extern "C" fn notify_expanded_trampoline<F: Fn(&Expander) + 'static>(
896            this: *mut ffi::GtkExpander,
897            _param_spec: glib::ffi::gpointer,
898            f: glib::ffi::gpointer,
899        ) {
900            unsafe {
901                let f: &F = &*(f as *const F);
902                f(&from_glib_borrow(this))
903            }
904        }
905        unsafe {
906            let f: Box_<F> = Box_::new(f);
907            connect_raw(
908                self.as_ptr() as *mut _,
909                c"notify::expanded".as_ptr() as *const _,
910                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
911                    notify_expanded_trampoline::<F> as *const (),
912                )),
913                Box_::into_raw(f),
914            )
915        }
916    }
917
918    #[doc(alias = "label")]
919    pub fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
920        unsafe extern "C" fn notify_label_trampoline<F: Fn(&Expander) + 'static>(
921            this: *mut ffi::GtkExpander,
922            _param_spec: glib::ffi::gpointer,
923            f: glib::ffi::gpointer,
924        ) {
925            unsafe {
926                let f: &F = &*(f as *const F);
927                f(&from_glib_borrow(this))
928            }
929        }
930        unsafe {
931            let f: Box_<F> = Box_::new(f);
932            connect_raw(
933                self.as_ptr() as *mut _,
934                c"notify::label".as_ptr() as *const _,
935                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
936                    notify_label_trampoline::<F> as *const (),
937                )),
938                Box_::into_raw(f),
939            )
940        }
941    }
942
943    #[doc(alias = "label-widget")]
944    pub fn connect_label_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
945        unsafe extern "C" fn notify_label_widget_trampoline<F: Fn(&Expander) + 'static>(
946            this: *mut ffi::GtkExpander,
947            _param_spec: glib::ffi::gpointer,
948            f: glib::ffi::gpointer,
949        ) {
950            unsafe {
951                let f: &F = &*(f as *const F);
952                f(&from_glib_borrow(this))
953            }
954        }
955        unsafe {
956            let f: Box_<F> = Box_::new(f);
957            connect_raw(
958                self.as_ptr() as *mut _,
959                c"notify::label-widget".as_ptr() as *const _,
960                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
961                    notify_label_widget_trampoline::<F> as *const (),
962                )),
963                Box_::into_raw(f),
964            )
965        }
966    }
967
968    #[doc(alias = "resize-toplevel")]
969    pub fn connect_resize_toplevel_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
970        unsafe extern "C" fn notify_resize_toplevel_trampoline<F: Fn(&Expander) + 'static>(
971            this: *mut ffi::GtkExpander,
972            _param_spec: glib::ffi::gpointer,
973            f: glib::ffi::gpointer,
974        ) {
975            unsafe {
976                let f: &F = &*(f as *const F);
977                f(&from_glib_borrow(this))
978            }
979        }
980        unsafe {
981            let f: Box_<F> = Box_::new(f);
982            connect_raw(
983                self.as_ptr() as *mut _,
984                c"notify::resize-toplevel".as_ptr() as *const _,
985                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
986                    notify_resize_toplevel_trampoline::<F> as *const (),
987                )),
988                Box_::into_raw(f),
989            )
990        }
991    }
992
993    #[doc(alias = "use-markup")]
994    pub fn connect_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
995        unsafe extern "C" fn notify_use_markup_trampoline<F: Fn(&Expander) + 'static>(
996            this: *mut ffi::GtkExpander,
997            _param_spec: glib::ffi::gpointer,
998            f: glib::ffi::gpointer,
999        ) {
1000            unsafe {
1001                let f: &F = &*(f as *const F);
1002                f(&from_glib_borrow(this))
1003            }
1004        }
1005        unsafe {
1006            let f: Box_<F> = Box_::new(f);
1007            connect_raw(
1008                self.as_ptr() as *mut _,
1009                c"notify::use-markup".as_ptr() as *const _,
1010                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1011                    notify_use_markup_trampoline::<F> as *const (),
1012                )),
1013                Box_::into_raw(f),
1014            )
1015        }
1016    }
1017
1018    #[doc(alias = "use-underline")]
1019    pub fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1020        unsafe extern "C" fn notify_use_underline_trampoline<F: Fn(&Expander) + 'static>(
1021            this: *mut ffi::GtkExpander,
1022            _param_spec: glib::ffi::gpointer,
1023            f: glib::ffi::gpointer,
1024        ) {
1025            unsafe {
1026                let f: &F = &*(f as *const F);
1027                f(&from_glib_borrow(this))
1028            }
1029        }
1030        unsafe {
1031            let f: Box_<F> = Box_::new(f);
1032            connect_raw(
1033                self.as_ptr() as *mut _,
1034                c"notify::use-underline".as_ptr() as *const _,
1035                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1036                    notify_use_underline_trampoline::<F> as *const (),
1037                )),
1038                Box_::into_raw(f),
1039            )
1040        }
1041    }
1042}
1043
1044impl Default for Expander {
1045    fn default() -> Self {
1046        glib::object::Object::new::<Self>()
1047    }
1048}
1049
1050// rustdoc-stripper-ignore-next
1051/// A [builder-pattern] type to construct [`Expander`] objects.
1052///
1053/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1054#[must_use = "The builder must be built to be used"]
1055pub struct ExpanderBuilder {
1056    builder: glib::object::ObjectBuilder<'static, Expander>,
1057}
1058
1059impl ExpanderBuilder {
1060    fn new() -> Self {
1061        Self {
1062            builder: glib::object::Object::builder(),
1063        }
1064    }
1065
1066    /// The child widget.
1067    pub fn child(self, child: &impl IsA<Widget>) -> Self {
1068        Self {
1069            builder: self.builder.property("child", child.clone().upcast()),
1070        }
1071    }
1072
1073    /// Whether the expander has been opened to reveal the child.
1074    pub fn expanded(self, expanded: bool) -> Self {
1075        Self {
1076            builder: self.builder.property("expanded", expanded),
1077        }
1078    }
1079
1080    /// The text of the expanders label.
1081    pub fn label(self, label: impl Into<glib::GString>) -> Self {
1082        Self {
1083            builder: self.builder.property("label", label.into()),
1084        }
1085    }
1086
1087    /// A widget to display instead of the usual expander label.
1088    pub fn label_widget(self, label_widget: &impl IsA<Widget>) -> Self {
1089        Self {
1090            builder: self
1091                .builder
1092                .property("label-widget", label_widget.clone().upcast()),
1093        }
1094    }
1095
1096    /// When this property is [`true`], the expander will resize the toplevel
1097    /// widget containing the expander upon expanding and collapsing.
1098    pub fn resize_toplevel(self, resize_toplevel: bool) -> Self {
1099        Self {
1100            builder: self.builder.property("resize-toplevel", resize_toplevel),
1101        }
1102    }
1103
1104    /// Whether the text in the label is Pango markup.
1105    pub fn use_markup(self, use_markup: bool) -> Self {
1106        Self {
1107            builder: self.builder.property("use-markup", use_markup),
1108        }
1109    }
1110
1111    /// Whether an underline in the text indicates a mnemonic.
1112    pub fn use_underline(self, use_underline: bool) -> Self {
1113        Self {
1114            builder: self.builder.property("use-underline", use_underline),
1115        }
1116    }
1117
1118    /// Whether the widget or any of its descendents can accept
1119    /// the input focus.
1120    ///
1121    /// This property is meant to be set by widget implementations,
1122    /// typically in their instance init function.
1123    pub fn can_focus(self, can_focus: bool) -> Self {
1124        Self {
1125            builder: self.builder.property("can-focus", can_focus),
1126        }
1127    }
1128
1129    /// Whether the widget can receive pointer events.
1130    pub fn can_target(self, can_target: bool) -> Self {
1131        Self {
1132            builder: self.builder.property("can-target", can_target),
1133        }
1134    }
1135
1136    /// A list of css classes applied to this widget.
1137    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1138        Self {
1139            builder: self.builder.property("css-classes", css_classes.into()),
1140        }
1141    }
1142
1143    /// The name of this widget in the CSS tree.
1144    ///
1145    /// This property is meant to be set by widget implementations,
1146    /// typically in their instance init function.
1147    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1148        Self {
1149            builder: self.builder.property("css-name", css_name.into()),
1150        }
1151    }
1152
1153    /// The cursor used by @widget.
1154    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1155        Self {
1156            builder: self.builder.property("cursor", cursor.clone()),
1157        }
1158    }
1159
1160    /// Whether the widget should grab focus when it is clicked with the mouse.
1161    ///
1162    /// This property is only relevant for widgets that can take focus.
1163    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1164        Self {
1165            builder: self.builder.property("focus-on-click", focus_on_click),
1166        }
1167    }
1168
1169    /// Whether this widget itself will accept the input focus.
1170    pub fn focusable(self, focusable: bool) -> Self {
1171        Self {
1172            builder: self.builder.property("focusable", focusable),
1173        }
1174    }
1175
1176    /// How to distribute horizontal space if widget gets extra space.
1177    pub fn halign(self, halign: Align) -> Self {
1178        Self {
1179            builder: self.builder.property("halign", halign),
1180        }
1181    }
1182
1183    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1184    /// signal on @widget.
1185    ///
1186    /// A true value indicates that @widget can have a tooltip, in this case
1187    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1188    /// determine whether it will provide a tooltip or not.
1189    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1190        Self {
1191            builder: self.builder.property("has-tooltip", has_tooltip),
1192        }
1193    }
1194
1195    /// Overrides for height request of the widget.
1196    ///
1197    /// If this is -1, the natural request will be used.
1198    pub fn height_request(self, height_request: i32) -> Self {
1199        Self {
1200            builder: self.builder.property("height-request", height_request),
1201        }
1202    }
1203
1204    /// Whether to expand horizontally.
1205    pub fn hexpand(self, hexpand: bool) -> Self {
1206        Self {
1207            builder: self.builder.property("hexpand", hexpand),
1208        }
1209    }
1210
1211    /// Whether to use the `hexpand` property.
1212    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1213        Self {
1214            builder: self.builder.property("hexpand-set", hexpand_set),
1215        }
1216    }
1217
1218    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1219    /// the preferred size of the widget, and allocate its children.
1220    ///
1221    /// This property is meant to be set by widget implementations,
1222    /// typically in their instance init function.
1223    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1224        Self {
1225            builder: self
1226                .builder
1227                .property("layout-manager", layout_manager.clone().upcast()),
1228        }
1229    }
1230
1231    /// Makes this widget act like a modal dialog, with respect to
1232    /// event delivery.
1233    ///
1234    /// Global event controllers will not handle events with targets
1235    /// inside the widget, unless they are set up to ignore propagation
1236    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1237    #[cfg(feature = "v4_18")]
1238    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1239    pub fn limit_events(self, limit_events: bool) -> Self {
1240        Self {
1241            builder: self.builder.property("limit-events", limit_events),
1242        }
1243    }
1244
1245    /// Margin on bottom side of widget.
1246    ///
1247    /// This property adds margin outside of the widget's normal size
1248    /// request, the margin will be added in addition to the size from
1249    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1250    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1251        Self {
1252            builder: self.builder.property("margin-bottom", margin_bottom),
1253        }
1254    }
1255
1256    /// Margin on end of widget, horizontally.
1257    ///
1258    /// This property supports left-to-right and right-to-left text
1259    /// directions.
1260    ///
1261    /// This property adds margin outside of the widget's normal size
1262    /// request, the margin will be added in addition to the size from
1263    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1264    pub fn margin_end(self, margin_end: i32) -> Self {
1265        Self {
1266            builder: self.builder.property("margin-end", margin_end),
1267        }
1268    }
1269
1270    /// Margin on start of widget, horizontally.
1271    ///
1272    /// This property supports left-to-right and right-to-left text
1273    /// directions.
1274    ///
1275    /// This property adds margin outside of the widget's normal size
1276    /// request, the margin will be added in addition to the size from
1277    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1278    pub fn margin_start(self, margin_start: i32) -> Self {
1279        Self {
1280            builder: self.builder.property("margin-start", margin_start),
1281        }
1282    }
1283
1284    /// Margin on top side of widget.
1285    ///
1286    /// This property adds margin outside of the widget's normal size
1287    /// request, the margin will be added in addition to the size from
1288    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1289    pub fn margin_top(self, margin_top: i32) -> Self {
1290        Self {
1291            builder: self.builder.property("margin-top", margin_top),
1292        }
1293    }
1294
1295    /// The name of the widget.
1296    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1297        Self {
1298            builder: self.builder.property("name", name.into()),
1299        }
1300    }
1301
1302    /// The requested opacity of the widget.
1303    pub fn opacity(self, opacity: f64) -> Self {
1304        Self {
1305            builder: self.builder.property("opacity", opacity),
1306        }
1307    }
1308
1309    /// How content outside the widget's content area is treated.
1310    ///
1311    /// This property is meant to be set by widget implementations,
1312    /// typically in their instance init function.
1313    pub fn overflow(self, overflow: Overflow) -> Self {
1314        Self {
1315            builder: self.builder.property("overflow", overflow),
1316        }
1317    }
1318
1319    /// Whether the widget will receive the default action when it is focused.
1320    pub fn receives_default(self, receives_default: bool) -> Self {
1321        Self {
1322            builder: self.builder.property("receives-default", receives_default),
1323        }
1324    }
1325
1326    /// Whether the widget responds to input.
1327    pub fn sensitive(self, sensitive: bool) -> Self {
1328        Self {
1329            builder: self.builder.property("sensitive", sensitive),
1330        }
1331    }
1332
1333    /// Sets the text of tooltip to be the given string, which is marked up
1334    /// with Pango markup.
1335    ///
1336    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1337    ///
1338    /// This is a convenience property which will take care of getting the
1339    /// tooltip shown if the given string is not `NULL`:
1340    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1341    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1342    /// the default signal handler.
1343    ///
1344    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1345    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1346    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1347        Self {
1348            builder: self
1349                .builder
1350                .property("tooltip-markup", tooltip_markup.into()),
1351        }
1352    }
1353
1354    /// Sets the text of tooltip to be the given string.
1355    ///
1356    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1357    ///
1358    /// This is a convenience property which will take care of getting the
1359    /// tooltip shown if the given string is not `NULL`:
1360    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1361    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1362    /// the default signal handler.
1363    ///
1364    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1365    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1366    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1367        Self {
1368            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1369        }
1370    }
1371
1372    /// How to distribute vertical space if widget gets extra space.
1373    pub fn valign(self, valign: Align) -> Self {
1374        Self {
1375            builder: self.builder.property("valign", valign),
1376        }
1377    }
1378
1379    /// Whether to expand vertically.
1380    pub fn vexpand(self, vexpand: bool) -> Self {
1381        Self {
1382            builder: self.builder.property("vexpand", vexpand),
1383        }
1384    }
1385
1386    /// Whether to use the `vexpand` property.
1387    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1388        Self {
1389            builder: self.builder.property("vexpand-set", vexpand_set),
1390        }
1391    }
1392
1393    /// Whether the widget is visible.
1394    pub fn visible(self, visible: bool) -> Self {
1395        Self {
1396            builder: self.builder.property("visible", visible),
1397        }
1398    }
1399
1400    /// Overrides for width request of the widget.
1401    ///
1402    /// If this is -1, the natural request will be used.
1403    pub fn width_request(self, width_request: i32) -> Self {
1404        Self {
1405            builder: self.builder.property("width-request", width_request),
1406        }
1407    }
1408
1409    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1410    ///
1411    /// The accessible role cannot be changed once set.
1412    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1413        Self {
1414            builder: self.builder.property("accessible-role", accessible_role),
1415        }
1416    }
1417
1418    // rustdoc-stripper-ignore-next
1419    /// Build the [`Expander`].
1420    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1421    pub fn build(self) -> Expander {
1422        assert_initialized_main_thread!();
1423        self.builder.build()
1424    }
1425}