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