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