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