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    ffi, Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, LayoutManager, Overflow,
7    Widget,
8};
9use glib::{
10    object::ObjectType as _,
11    prelude::*,
12    signal::{connect_raw, SignalHandlerId},
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            let f: &F = &*(f as *const F);
847            f(&from_glib_borrow(this))
848        }
849        unsafe {
850            let f: Box_<F> = Box_::new(f);
851            connect_raw(
852                self.as_ptr() as *mut _,
853                c"activate".as_ptr() as *const _,
854                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
855                    activate_trampoline::<F> as *const (),
856                )),
857                Box_::into_raw(f),
858            )
859        }
860    }
861
862    pub fn emit_activate(&self) {
863        self.emit_by_name::<()>("activate", &[]);
864    }
865
866    #[doc(alias = "child")]
867    pub fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
868        unsafe extern "C" fn notify_child_trampoline<F: Fn(&Expander) + 'static>(
869            this: *mut ffi::GtkExpander,
870            _param_spec: glib::ffi::gpointer,
871            f: glib::ffi::gpointer,
872        ) {
873            let f: &F = &*(f as *const F);
874            f(&from_glib_borrow(this))
875        }
876        unsafe {
877            let f: Box_<F> = Box_::new(f);
878            connect_raw(
879                self.as_ptr() as *mut _,
880                c"notify::child".as_ptr() as *const _,
881                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
882                    notify_child_trampoline::<F> as *const (),
883                )),
884                Box_::into_raw(f),
885            )
886        }
887    }
888
889    #[doc(alias = "expanded")]
890    pub fn connect_expanded_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
891        unsafe extern "C" fn notify_expanded_trampoline<F: Fn(&Expander) + 'static>(
892            this: *mut ffi::GtkExpander,
893            _param_spec: glib::ffi::gpointer,
894            f: glib::ffi::gpointer,
895        ) {
896            let f: &F = &*(f as *const F);
897            f(&from_glib_borrow(this))
898        }
899        unsafe {
900            let f: Box_<F> = Box_::new(f);
901            connect_raw(
902                self.as_ptr() as *mut _,
903                c"notify::expanded".as_ptr() as *const _,
904                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
905                    notify_expanded_trampoline::<F> as *const (),
906                )),
907                Box_::into_raw(f),
908            )
909        }
910    }
911
912    #[doc(alias = "label")]
913    pub fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
914        unsafe extern "C" fn notify_label_trampoline<F: Fn(&Expander) + 'static>(
915            this: *mut ffi::GtkExpander,
916            _param_spec: glib::ffi::gpointer,
917            f: glib::ffi::gpointer,
918        ) {
919            let f: &F = &*(f as *const F);
920            f(&from_glib_borrow(this))
921        }
922        unsafe {
923            let f: Box_<F> = Box_::new(f);
924            connect_raw(
925                self.as_ptr() as *mut _,
926                c"notify::label".as_ptr() as *const _,
927                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
928                    notify_label_trampoline::<F> as *const (),
929                )),
930                Box_::into_raw(f),
931            )
932        }
933    }
934
935    #[doc(alias = "label-widget")]
936    pub fn connect_label_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
937        unsafe extern "C" fn notify_label_widget_trampoline<F: Fn(&Expander) + 'static>(
938            this: *mut ffi::GtkExpander,
939            _param_spec: glib::ffi::gpointer,
940            f: glib::ffi::gpointer,
941        ) {
942            let f: &F = &*(f as *const F);
943            f(&from_glib_borrow(this))
944        }
945        unsafe {
946            let f: Box_<F> = Box_::new(f);
947            connect_raw(
948                self.as_ptr() as *mut _,
949                c"notify::label-widget".as_ptr() as *const _,
950                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
951                    notify_label_widget_trampoline::<F> as *const (),
952                )),
953                Box_::into_raw(f),
954            )
955        }
956    }
957
958    #[doc(alias = "resize-toplevel")]
959    pub fn connect_resize_toplevel_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
960        unsafe extern "C" fn notify_resize_toplevel_trampoline<F: Fn(&Expander) + 'static>(
961            this: *mut ffi::GtkExpander,
962            _param_spec: glib::ffi::gpointer,
963            f: glib::ffi::gpointer,
964        ) {
965            let f: &F = &*(f as *const F);
966            f(&from_glib_borrow(this))
967        }
968        unsafe {
969            let f: Box_<F> = Box_::new(f);
970            connect_raw(
971                self.as_ptr() as *mut _,
972                c"notify::resize-toplevel".as_ptr() as *const _,
973                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
974                    notify_resize_toplevel_trampoline::<F> as *const (),
975                )),
976                Box_::into_raw(f),
977            )
978        }
979    }
980
981    #[doc(alias = "use-markup")]
982    pub fn connect_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
983        unsafe extern "C" fn notify_use_markup_trampoline<F: Fn(&Expander) + 'static>(
984            this: *mut ffi::GtkExpander,
985            _param_spec: glib::ffi::gpointer,
986            f: glib::ffi::gpointer,
987        ) {
988            let f: &F = &*(f as *const F);
989            f(&from_glib_borrow(this))
990        }
991        unsafe {
992            let f: Box_<F> = Box_::new(f);
993            connect_raw(
994                self.as_ptr() as *mut _,
995                c"notify::use-markup".as_ptr() as *const _,
996                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
997                    notify_use_markup_trampoline::<F> as *const (),
998                )),
999                Box_::into_raw(f),
1000            )
1001        }
1002    }
1003
1004    #[doc(alias = "use-underline")]
1005    pub fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1006        unsafe extern "C" fn notify_use_underline_trampoline<F: Fn(&Expander) + 'static>(
1007            this: *mut ffi::GtkExpander,
1008            _param_spec: glib::ffi::gpointer,
1009            f: glib::ffi::gpointer,
1010        ) {
1011            let f: &F = &*(f as *const F);
1012            f(&from_glib_borrow(this))
1013        }
1014        unsafe {
1015            let f: Box_<F> = Box_::new(f);
1016            connect_raw(
1017                self.as_ptr() as *mut _,
1018                c"notify::use-underline".as_ptr() as *const _,
1019                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1020                    notify_use_underline_trampoline::<F> as *const (),
1021                )),
1022                Box_::into_raw(f),
1023            )
1024        }
1025    }
1026}
1027
1028impl Default for Expander {
1029    fn default() -> Self {
1030        glib::object::Object::new::<Self>()
1031    }
1032}
1033
1034// rustdoc-stripper-ignore-next
1035/// A [builder-pattern] type to construct [`Expander`] objects.
1036///
1037/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1038#[must_use = "The builder must be built to be used"]
1039pub struct ExpanderBuilder {
1040    builder: glib::object::ObjectBuilder<'static, Expander>,
1041}
1042
1043impl ExpanderBuilder {
1044    fn new() -> Self {
1045        Self {
1046            builder: glib::object::Object::builder(),
1047        }
1048    }
1049
1050    /// The child widget.
1051    pub fn child(self, child: &impl IsA<Widget>) -> Self {
1052        Self {
1053            builder: self.builder.property("child", child.clone().upcast()),
1054        }
1055    }
1056
1057    /// Whether the expander has been opened to reveal the child.
1058    pub fn expanded(self, expanded: bool) -> Self {
1059        Self {
1060            builder: self.builder.property("expanded", expanded),
1061        }
1062    }
1063
1064    /// The text of the expanders label.
1065    pub fn label(self, label: impl Into<glib::GString>) -> Self {
1066        Self {
1067            builder: self.builder.property("label", label.into()),
1068        }
1069    }
1070
1071    /// A widget to display instead of the usual expander label.
1072    pub fn label_widget(self, label_widget: &impl IsA<Widget>) -> Self {
1073        Self {
1074            builder: self
1075                .builder
1076                .property("label-widget", label_widget.clone().upcast()),
1077        }
1078    }
1079
1080    /// When this property is [`true`], the expander will resize the toplevel
1081    /// widget containing the expander upon expanding and collapsing.
1082    pub fn resize_toplevel(self, resize_toplevel: bool) -> Self {
1083        Self {
1084            builder: self.builder.property("resize-toplevel", resize_toplevel),
1085        }
1086    }
1087
1088    /// Whether the text in the label is Pango markup.
1089    pub fn use_markup(self, use_markup: bool) -> Self {
1090        Self {
1091            builder: self.builder.property("use-markup", use_markup),
1092        }
1093    }
1094
1095    /// Whether an underline in the text indicates a mnemonic.
1096    pub fn use_underline(self, use_underline: bool) -> Self {
1097        Self {
1098            builder: self.builder.property("use-underline", use_underline),
1099        }
1100    }
1101
1102    /// Whether the widget or any of its descendents can accept
1103    /// the input focus.
1104    ///
1105    /// This property is meant to be set by widget implementations,
1106    /// typically in their instance init function.
1107    pub fn can_focus(self, can_focus: bool) -> Self {
1108        Self {
1109            builder: self.builder.property("can-focus", can_focus),
1110        }
1111    }
1112
1113    /// Whether the widget can receive pointer events.
1114    pub fn can_target(self, can_target: bool) -> Self {
1115        Self {
1116            builder: self.builder.property("can-target", can_target),
1117        }
1118    }
1119
1120    /// A list of css classes applied to this widget.
1121    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1122        Self {
1123            builder: self.builder.property("css-classes", css_classes.into()),
1124        }
1125    }
1126
1127    /// The name of this widget in the CSS tree.
1128    ///
1129    /// This property is meant to be set by widget implementations,
1130    /// typically in their instance init function.
1131    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1132        Self {
1133            builder: self.builder.property("css-name", css_name.into()),
1134        }
1135    }
1136
1137    /// The cursor used by @widget.
1138    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1139        Self {
1140            builder: self.builder.property("cursor", cursor.clone()),
1141        }
1142    }
1143
1144    /// Whether the widget should grab focus when it is clicked with the mouse.
1145    ///
1146    /// This property is only relevant for widgets that can take focus.
1147    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1148        Self {
1149            builder: self.builder.property("focus-on-click", focus_on_click),
1150        }
1151    }
1152
1153    /// Whether this widget itself will accept the input focus.
1154    pub fn focusable(self, focusable: bool) -> Self {
1155        Self {
1156            builder: self.builder.property("focusable", focusable),
1157        }
1158    }
1159
1160    /// How to distribute horizontal space if widget gets extra space.
1161    pub fn halign(self, halign: Align) -> Self {
1162        Self {
1163            builder: self.builder.property("halign", halign),
1164        }
1165    }
1166
1167    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1168    /// signal on @widget.
1169    ///
1170    /// A true value indicates that @widget can have a tooltip, in this case
1171    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1172    /// determine whether it will provide a tooltip or not.
1173    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1174        Self {
1175            builder: self.builder.property("has-tooltip", has_tooltip),
1176        }
1177    }
1178
1179    /// Overrides for height request of the widget.
1180    ///
1181    /// If this is -1, the natural request will be used.
1182    pub fn height_request(self, height_request: i32) -> Self {
1183        Self {
1184            builder: self.builder.property("height-request", height_request),
1185        }
1186    }
1187
1188    /// Whether to expand horizontally.
1189    pub fn hexpand(self, hexpand: bool) -> Self {
1190        Self {
1191            builder: self.builder.property("hexpand", hexpand),
1192        }
1193    }
1194
1195    /// Whether to use the `hexpand` property.
1196    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1197        Self {
1198            builder: self.builder.property("hexpand-set", hexpand_set),
1199        }
1200    }
1201
1202    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1203    /// the preferred size of the widget, and allocate its children.
1204    ///
1205    /// This property is meant to be set by widget implementations,
1206    /// typically in their instance init function.
1207    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1208        Self {
1209            builder: self
1210                .builder
1211                .property("layout-manager", layout_manager.clone().upcast()),
1212        }
1213    }
1214
1215    /// Makes this widget act like a modal dialog, with respect to
1216    /// event delivery.
1217    ///
1218    /// Global event controllers will not handle events with targets
1219    /// inside the widget, unless they are set up to ignore propagation
1220    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1221    #[cfg(feature = "v4_18")]
1222    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1223    pub fn limit_events(self, limit_events: bool) -> Self {
1224        Self {
1225            builder: self.builder.property("limit-events", limit_events),
1226        }
1227    }
1228
1229    /// Margin on bottom side of widget.
1230    ///
1231    /// This property adds margin outside of the widget's normal size
1232    /// request, the margin will be added in addition to the size from
1233    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1234    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1235        Self {
1236            builder: self.builder.property("margin-bottom", margin_bottom),
1237        }
1238    }
1239
1240    /// Margin on end of widget, horizontally.
1241    ///
1242    /// This property supports left-to-right and right-to-left text
1243    /// directions.
1244    ///
1245    /// This property adds margin outside of the widget's normal size
1246    /// request, the margin will be added in addition to the size from
1247    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1248    pub fn margin_end(self, margin_end: i32) -> Self {
1249        Self {
1250            builder: self.builder.property("margin-end", margin_end),
1251        }
1252    }
1253
1254    /// Margin on start of widget, horizontally.
1255    ///
1256    /// This property supports left-to-right and right-to-left text
1257    /// directions.
1258    ///
1259    /// This property adds margin outside of the widget's normal size
1260    /// request, the margin will be added in addition to the size from
1261    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1262    pub fn margin_start(self, margin_start: i32) -> Self {
1263        Self {
1264            builder: self.builder.property("margin-start", margin_start),
1265        }
1266    }
1267
1268    /// Margin on top side of widget.
1269    ///
1270    /// This property adds margin outside of the widget's normal size
1271    /// request, the margin will be added in addition to the size from
1272    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1273    pub fn margin_top(self, margin_top: i32) -> Self {
1274        Self {
1275            builder: self.builder.property("margin-top", margin_top),
1276        }
1277    }
1278
1279    /// The name of the widget.
1280    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1281        Self {
1282            builder: self.builder.property("name", name.into()),
1283        }
1284    }
1285
1286    /// The requested opacity of the widget.
1287    pub fn opacity(self, opacity: f64) -> Self {
1288        Self {
1289            builder: self.builder.property("opacity", opacity),
1290        }
1291    }
1292
1293    /// How content outside the widget's content area is treated.
1294    ///
1295    /// This property is meant to be set by widget implementations,
1296    /// typically in their instance init function.
1297    pub fn overflow(self, overflow: Overflow) -> Self {
1298        Self {
1299            builder: self.builder.property("overflow", overflow),
1300        }
1301    }
1302
1303    /// Whether the widget will receive the default action when it is focused.
1304    pub fn receives_default(self, receives_default: bool) -> Self {
1305        Self {
1306            builder: self.builder.property("receives-default", receives_default),
1307        }
1308    }
1309
1310    /// Whether the widget responds to input.
1311    pub fn sensitive(self, sensitive: bool) -> Self {
1312        Self {
1313            builder: self.builder.property("sensitive", sensitive),
1314        }
1315    }
1316
1317    /// Sets the text of tooltip to be the given string, which is marked up
1318    /// with Pango markup.
1319    ///
1320    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1321    ///
1322    /// This is a convenience property which will take care of getting the
1323    /// tooltip shown if the given string is not `NULL`:
1324    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1325    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1326    /// the default signal handler.
1327    ///
1328    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1329    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1330    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1331        Self {
1332            builder: self
1333                .builder
1334                .property("tooltip-markup", tooltip_markup.into()),
1335        }
1336    }
1337
1338    /// Sets the text of tooltip to be the given string.
1339    ///
1340    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1341    ///
1342    /// This is a convenience property which will take care of getting the
1343    /// tooltip shown if the given string is not `NULL`:
1344    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1345    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1346    /// the default signal handler.
1347    ///
1348    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1349    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1350    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1351        Self {
1352            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1353        }
1354    }
1355
1356    /// How to distribute vertical space if widget gets extra space.
1357    pub fn valign(self, valign: Align) -> Self {
1358        Self {
1359            builder: self.builder.property("valign", valign),
1360        }
1361    }
1362
1363    /// Whether to expand vertically.
1364    pub fn vexpand(self, vexpand: bool) -> Self {
1365        Self {
1366            builder: self.builder.property("vexpand", vexpand),
1367        }
1368    }
1369
1370    /// Whether to use the `vexpand` property.
1371    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1372        Self {
1373            builder: self.builder.property("vexpand-set", vexpand_set),
1374        }
1375    }
1376
1377    /// Whether the widget is visible.
1378    pub fn visible(self, visible: bool) -> Self {
1379        Self {
1380            builder: self.builder.property("visible", visible),
1381        }
1382    }
1383
1384    /// Overrides for width request of the widget.
1385    ///
1386    /// If this is -1, the natural request will be used.
1387    pub fn width_request(self, width_request: i32) -> Self {
1388        Self {
1389            builder: self.builder.property("width-request", width_request),
1390        }
1391    }
1392
1393    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1394    ///
1395    /// The accessible role cannot be changed once set.
1396    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1397        Self {
1398            builder: self.builder.property("accessible-role", accessible_role),
1399        }
1400    }
1401
1402    // rustdoc-stripper-ignore-next
1403    /// Build the [`Expander`].
1404    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1405    pub fn build(self) -> Expander {
1406        assert_initialized_main_thread!();
1407        self.builder.build()
1408    }
1409}