Skip to main content

gtk4/auto/
window_handle.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{
6    Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, LayoutManager, Overflow,
7    Widget, ffi,
8};
9use glib::{
10    prelude::*,
11    signal::{SignalHandlerId, connect_raw},
12    translate::*,
13};
14use std::boxed::Box as Box_;
15
16glib::wrapper! {
17    /// Implements titlebar functionality for a window.
18    ///
19    /// When added into a window, it can be dragged to move the window,
20    /// and it implements the right click, double click and middle click
21    /// behaviors that are expected of a titlebar.
22    ///
23    /// # CSS nodes
24    ///
25    /// [`WindowHandle`][crate::WindowHandle] has a single CSS node with the name `windowhandle`.
26    ///
27    /// # Accessibility
28    ///
29    /// Until GTK 4.10, [`WindowHandle`][crate::WindowHandle] used the [enum@Gtk.AccessibleRole.group] role.
30    ///
31    /// Starting from GTK 4.12, [`WindowHandle`][crate::WindowHandle] uses the [enum@Gtk.AccessibleRole.generic]
32    /// role.
33    ///
34    /// ## Properties
35    ///
36    ///
37    /// #### `child`
38    ///  The child widget.
39    ///
40    /// Readable | Writeable
41    /// <details><summary><h4>Widget</h4></summary>
42    ///
43    ///
44    /// #### `can-focus`
45    ///  Whether the widget or any of its descendents can accept
46    /// the input focus.
47    ///
48    /// This property is meant to be set by widget implementations,
49    /// typically in their instance init function.
50    ///
51    /// Readable | Writeable
52    ///
53    ///
54    /// #### `can-target`
55    ///  Whether the widget can receive pointer events.
56    ///
57    /// Readable | Writeable
58    ///
59    ///
60    /// #### `css-classes`
61    ///  A list of css classes applied to this widget.
62    ///
63    /// Readable | Writeable
64    ///
65    ///
66    /// #### `css-name`
67    ///  The name of this widget in the CSS tree.
68    ///
69    /// This property is meant to be set by widget implementations,
70    /// typically in their instance init function.
71    ///
72    /// Readable | Writeable | Construct Only
73    ///
74    ///
75    /// #### `cursor`
76    ///  The cursor used by @widget.
77    ///
78    /// Readable | Writeable
79    ///
80    ///
81    /// #### `focus-on-click`
82    ///  Whether the widget should grab focus when it is clicked with the mouse.
83    ///
84    /// This property is only relevant for widgets that can take focus.
85    ///
86    /// Readable | Writeable
87    ///
88    ///
89    /// #### `focusable`
90    ///  Whether this widget itself will accept the input focus.
91    ///
92    /// Readable | Writeable
93    ///
94    ///
95    /// #### `halign`
96    ///  How to distribute horizontal space if widget gets extra space.
97    ///
98    /// Readable | Writeable
99    ///
100    ///
101    /// #### `has-default`
102    ///  Whether the widget is the default widget.
103    ///
104    /// Readable
105    ///
106    ///
107    /// #### `has-focus`
108    ///  Whether the widget has the input focus.
109    ///
110    /// Readable
111    ///
112    ///
113    /// #### `has-tooltip`
114    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
115    /// signal on @widget.
116    ///
117    /// A true value indicates that @widget can have a tooltip, in this case
118    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
119    /// determine whether it will provide a tooltip or not.
120    ///
121    /// Readable | Writeable
122    ///
123    ///
124    /// #### `height-request`
125    ///  Overrides for height request of the widget.
126    ///
127    /// If this is -1, the natural request will be used.
128    ///
129    /// Readable | Writeable
130    ///
131    ///
132    /// #### `hexpand`
133    ///  Whether to expand horizontally.
134    ///
135    /// Readable | Writeable
136    ///
137    ///
138    /// #### `hexpand-set`
139    ///  Whether to use the `hexpand` property.
140    ///
141    /// Readable | Writeable
142    ///
143    ///
144    /// #### `layout-manager`
145    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
146    /// the preferred size of the widget, and allocate its children.
147    ///
148    /// This property is meant to be set by widget implementations,
149    /// typically in their instance init function.
150    ///
151    /// Readable | Writeable
152    ///
153    ///
154    /// #### `limit-events`
155    ///  Makes this widget act like a modal dialog, with respect to
156    /// event delivery.
157    ///
158    /// Global event controllers will not handle events with targets
159    /// inside the widget, unless they are set up to ignore propagation
160    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
161    ///
162    /// Readable | Writeable
163    ///
164    ///
165    /// #### `margin-bottom`
166    ///  Margin on bottom side of widget.
167    ///
168    /// This property adds margin outside of the widget's normal size
169    /// request, the margin will be added in addition to the size from
170    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
171    ///
172    /// Readable | Writeable
173    ///
174    ///
175    /// #### `margin-end`
176    ///  Margin on end of widget, horizontally.
177    ///
178    /// This property supports left-to-right and right-to-left text
179    /// directions.
180    ///
181    /// This property adds margin outside of the widget's normal size
182    /// request, the margin will be added in addition to the size from
183    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
184    ///
185    /// Readable | Writeable
186    ///
187    ///
188    /// #### `margin-start`
189    ///  Margin on start of widget, horizontally.
190    ///
191    /// This property supports left-to-right and right-to-left text
192    /// directions.
193    ///
194    /// This property adds margin outside of the widget's normal size
195    /// request, the margin will be added in addition to the size from
196    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
197    ///
198    /// Readable | Writeable
199    ///
200    ///
201    /// #### `margin-top`
202    ///  Margin on top side of widget.
203    ///
204    /// This property adds margin outside of the widget's normal size
205    /// request, the margin will be added in addition to the size from
206    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
207    ///
208    /// Readable | Writeable
209    ///
210    ///
211    /// #### `name`
212    ///  The name of the widget.
213    ///
214    /// Readable | Writeable
215    ///
216    ///
217    /// #### `opacity`
218    ///  The requested opacity of the widget.
219    ///
220    /// Readable | Writeable
221    ///
222    ///
223    /// #### `overflow`
224    ///  How content outside the widget's content area is treated.
225    ///
226    /// This property is meant to be set by widget implementations,
227    /// typically in their instance init function.
228    ///
229    /// Readable | Writeable
230    ///
231    ///
232    /// #### `parent`
233    ///  The parent widget of this widget.
234    ///
235    /// Readable
236    ///
237    ///
238    /// #### `receives-default`
239    ///  Whether the widget will receive the default action when it is focused.
240    ///
241    /// Readable | Writeable
242    ///
243    ///
244    /// #### `root`
245    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
246    ///
247    /// This will be `NULL` if the widget is not contained in a root widget.
248    ///
249    /// Readable
250    ///
251    ///
252    /// #### `scale-factor`
253    ///  The scale factor of the widget.
254    ///
255    /// Readable
256    ///
257    ///
258    /// #### `sensitive`
259    ///  Whether the widget responds to input.
260    ///
261    /// Readable | Writeable
262    ///
263    ///
264    /// #### `tooltip-markup`
265    ///  Sets the text of tooltip to be the given string, which is marked up
266    /// with Pango markup.
267    ///
268    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
269    ///
270    /// This is a convenience property which will take care of getting the
271    /// tooltip shown if the given string is not `NULL`:
272    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
273    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
274    /// the default signal handler.
275    ///
276    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
277    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
278    ///
279    /// Readable | Writeable
280    ///
281    ///
282    /// #### `tooltip-text`
283    ///  Sets the text of tooltip to be the given string.
284    ///
285    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
286    ///
287    /// This is a convenience property which will take care of getting the
288    /// tooltip shown if the given string is not `NULL`:
289    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
290    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
291    /// the default signal handler.
292    ///
293    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
294    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
295    ///
296    /// Readable | Writeable
297    ///
298    ///
299    /// #### `valign`
300    ///  How to distribute vertical space if widget gets extra space.
301    ///
302    /// Readable | Writeable
303    ///
304    ///
305    /// #### `vexpand`
306    ///  Whether to expand vertically.
307    ///
308    /// Readable | Writeable
309    ///
310    ///
311    /// #### `vexpand-set`
312    ///  Whether to use the `vexpand` property.
313    ///
314    /// Readable | Writeable
315    ///
316    ///
317    /// #### `visible`
318    ///  Whether the widget is visible.
319    ///
320    /// Readable | Writeable
321    ///
322    ///
323    /// #### `width-request`
324    ///  Overrides for width request of the widget.
325    ///
326    /// If this is -1, the natural request will be used.
327    ///
328    /// Readable | Writeable
329    /// </details>
330    /// <details><summary><h4>Accessible</h4></summary>
331    ///
332    ///
333    /// #### `accessible-role`
334    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
335    ///
336    /// The accessible role cannot be changed once set.
337    ///
338    /// Readable | Writeable
339    /// </details>
340    ///
341    /// # Implements
342    ///
343    /// [`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]
344    #[doc(alias = "GtkWindowHandle")]
345    pub struct WindowHandle(Object<ffi::GtkWindowHandle, ffi::GtkWindowHandleClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget;
346
347    match fn {
348        type_ => || ffi::gtk_window_handle_get_type(),
349    }
350}
351
352impl WindowHandle {
353    /// Creates a new [`WindowHandle`][crate::WindowHandle].
354    ///
355    /// # Returns
356    ///
357    /// a new [`WindowHandle`][crate::WindowHandle].
358    #[doc(alias = "gtk_window_handle_new")]
359    pub fn new() -> WindowHandle {
360        assert_initialized_main_thread!();
361        unsafe { Widget::from_glib_none(ffi::gtk_window_handle_new()).unsafe_cast() }
362    }
363
364    // rustdoc-stripper-ignore-next
365    /// Creates a new builder-pattern struct instance to construct [`WindowHandle`] objects.
366    ///
367    /// This method returns an instance of [`WindowHandleBuilder`](crate::builders::WindowHandleBuilder) which can be used to create [`WindowHandle`] objects.
368    pub fn builder() -> WindowHandleBuilder {
369        WindowHandleBuilder::new()
370    }
371
372    /// Gets the child widget of @self.
373    ///
374    /// # Returns
375    ///
376    /// the child widget of @self
377    #[doc(alias = "gtk_window_handle_get_child")]
378    #[doc(alias = "get_child")]
379    pub fn child(&self) -> Option<Widget> {
380        unsafe { from_glib_none(ffi::gtk_window_handle_get_child(self.to_glib_none().0)) }
381    }
382
383    /// Sets the child widget of @self.
384    /// ## `child`
385    /// the child widget
386    #[doc(alias = "gtk_window_handle_set_child")]
387    #[doc(alias = "child")]
388    pub fn set_child(&self, child: Option<&impl IsA<Widget>>) {
389        unsafe {
390            ffi::gtk_window_handle_set_child(
391                self.to_glib_none().0,
392                child.map(|p| p.as_ref()).to_glib_none().0,
393            );
394        }
395    }
396
397    #[doc(alias = "child")]
398    pub fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
399        unsafe extern "C" fn notify_child_trampoline<F: Fn(&WindowHandle) + 'static>(
400            this: *mut ffi::GtkWindowHandle,
401            _param_spec: glib::ffi::gpointer,
402            f: glib::ffi::gpointer,
403        ) {
404            unsafe {
405                let f: &F = &*(f as *const F);
406                f(&from_glib_borrow(this))
407            }
408        }
409        unsafe {
410            let f: Box_<F> = Box_::new(f);
411            connect_raw(
412                self.as_ptr() as *mut _,
413                c"notify::child".as_ptr() as *const _,
414                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
415                    notify_child_trampoline::<F> as *const (),
416                )),
417                Box_::into_raw(f),
418            )
419        }
420    }
421}
422
423impl Default for WindowHandle {
424    fn default() -> Self {
425        Self::new()
426    }
427}
428
429// rustdoc-stripper-ignore-next
430/// A [builder-pattern] type to construct [`WindowHandle`] objects.
431///
432/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
433#[must_use = "The builder must be built to be used"]
434pub struct WindowHandleBuilder {
435    builder: glib::object::ObjectBuilder<'static, WindowHandle>,
436}
437
438impl WindowHandleBuilder {
439    fn new() -> Self {
440        Self {
441            builder: glib::object::Object::builder(),
442        }
443    }
444
445    /// The child widget.
446    pub fn child(self, child: &impl IsA<Widget>) -> Self {
447        Self {
448            builder: self.builder.property("child", child.clone().upcast()),
449        }
450    }
451
452    /// Whether the widget or any of its descendents can accept
453    /// the input focus.
454    ///
455    /// This property is meant to be set by widget implementations,
456    /// typically in their instance init function.
457    pub fn can_focus(self, can_focus: bool) -> Self {
458        Self {
459            builder: self.builder.property("can-focus", can_focus),
460        }
461    }
462
463    /// Whether the widget can receive pointer events.
464    pub fn can_target(self, can_target: bool) -> Self {
465        Self {
466            builder: self.builder.property("can-target", can_target),
467        }
468    }
469
470    /// A list of css classes applied to this widget.
471    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
472        Self {
473            builder: self.builder.property("css-classes", css_classes.into()),
474        }
475    }
476
477    /// The name of this widget in the CSS tree.
478    ///
479    /// This property is meant to be set by widget implementations,
480    /// typically in their instance init function.
481    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
482        Self {
483            builder: self.builder.property("css-name", css_name.into()),
484        }
485    }
486
487    /// The cursor used by @widget.
488    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
489        Self {
490            builder: self.builder.property("cursor", cursor.clone()),
491        }
492    }
493
494    /// Whether the widget should grab focus when it is clicked with the mouse.
495    ///
496    /// This property is only relevant for widgets that can take focus.
497    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
498        Self {
499            builder: self.builder.property("focus-on-click", focus_on_click),
500        }
501    }
502
503    /// Whether this widget itself will accept the input focus.
504    pub fn focusable(self, focusable: bool) -> Self {
505        Self {
506            builder: self.builder.property("focusable", focusable),
507        }
508    }
509
510    /// How to distribute horizontal space if widget gets extra space.
511    pub fn halign(self, halign: Align) -> Self {
512        Self {
513            builder: self.builder.property("halign", halign),
514        }
515    }
516
517    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
518    /// signal on @widget.
519    ///
520    /// A true value indicates that @widget can have a tooltip, in this case
521    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
522    /// determine whether it will provide a tooltip or not.
523    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
524        Self {
525            builder: self.builder.property("has-tooltip", has_tooltip),
526        }
527    }
528
529    /// Overrides for height request of the widget.
530    ///
531    /// If this is -1, the natural request will be used.
532    pub fn height_request(self, height_request: i32) -> Self {
533        Self {
534            builder: self.builder.property("height-request", height_request),
535        }
536    }
537
538    /// Whether to expand horizontally.
539    pub fn hexpand(self, hexpand: bool) -> Self {
540        Self {
541            builder: self.builder.property("hexpand", hexpand),
542        }
543    }
544
545    /// Whether to use the `hexpand` property.
546    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
547        Self {
548            builder: self.builder.property("hexpand-set", hexpand_set),
549        }
550    }
551
552    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
553    /// the preferred size of the widget, and allocate its children.
554    ///
555    /// This property is meant to be set by widget implementations,
556    /// typically in their instance init function.
557    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
558        Self {
559            builder: self
560                .builder
561                .property("layout-manager", layout_manager.clone().upcast()),
562        }
563    }
564
565    /// Makes this widget act like a modal dialog, with respect to
566    /// event delivery.
567    ///
568    /// Global event controllers will not handle events with targets
569    /// inside the widget, unless they are set up to ignore propagation
570    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
571    #[cfg(feature = "v4_18")]
572    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
573    pub fn limit_events(self, limit_events: bool) -> Self {
574        Self {
575            builder: self.builder.property("limit-events", limit_events),
576        }
577    }
578
579    /// Margin on bottom side of widget.
580    ///
581    /// This property adds margin outside of the widget's normal size
582    /// request, the margin will be added in addition to the size from
583    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
584    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
585        Self {
586            builder: self.builder.property("margin-bottom", margin_bottom),
587        }
588    }
589
590    /// Margin on end of widget, horizontally.
591    ///
592    /// This property supports left-to-right and right-to-left text
593    /// directions.
594    ///
595    /// This property adds margin outside of the widget's normal size
596    /// request, the margin will be added in addition to the size from
597    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
598    pub fn margin_end(self, margin_end: i32) -> Self {
599        Self {
600            builder: self.builder.property("margin-end", margin_end),
601        }
602    }
603
604    /// Margin on start of widget, horizontally.
605    ///
606    /// This property supports left-to-right and right-to-left text
607    /// directions.
608    ///
609    /// This property adds margin outside of the widget's normal size
610    /// request, the margin will be added in addition to the size from
611    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
612    pub fn margin_start(self, margin_start: i32) -> Self {
613        Self {
614            builder: self.builder.property("margin-start", margin_start),
615        }
616    }
617
618    /// Margin on top side of widget.
619    ///
620    /// This property adds margin outside of the widget's normal size
621    /// request, the margin will be added in addition to the size from
622    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
623    pub fn margin_top(self, margin_top: i32) -> Self {
624        Self {
625            builder: self.builder.property("margin-top", margin_top),
626        }
627    }
628
629    /// The name of the widget.
630    pub fn name(self, name: impl Into<glib::GString>) -> Self {
631        Self {
632            builder: self.builder.property("name", name.into()),
633        }
634    }
635
636    /// The requested opacity of the widget.
637    pub fn opacity(self, opacity: f64) -> Self {
638        Self {
639            builder: self.builder.property("opacity", opacity),
640        }
641    }
642
643    /// How content outside the widget's content area is treated.
644    ///
645    /// This property is meant to be set by widget implementations,
646    /// typically in their instance init function.
647    pub fn overflow(self, overflow: Overflow) -> Self {
648        Self {
649            builder: self.builder.property("overflow", overflow),
650        }
651    }
652
653    /// Whether the widget will receive the default action when it is focused.
654    pub fn receives_default(self, receives_default: bool) -> Self {
655        Self {
656            builder: self.builder.property("receives-default", receives_default),
657        }
658    }
659
660    /// Whether the widget responds to input.
661    pub fn sensitive(self, sensitive: bool) -> Self {
662        Self {
663            builder: self.builder.property("sensitive", sensitive),
664        }
665    }
666
667    /// Sets the text of tooltip to be the given string, which is marked up
668    /// with Pango markup.
669    ///
670    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
671    ///
672    /// This is a convenience property which will take care of getting the
673    /// tooltip shown if the given string is not `NULL`:
674    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
675    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
676    /// the default signal handler.
677    ///
678    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
679    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
680    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
681        Self {
682            builder: self
683                .builder
684                .property("tooltip-markup", tooltip_markup.into()),
685        }
686    }
687
688    /// Sets the text of tooltip to be the given string.
689    ///
690    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
691    ///
692    /// This is a convenience property which will take care of getting the
693    /// tooltip shown if the given string is not `NULL`:
694    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
695    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
696    /// the default signal handler.
697    ///
698    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
699    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
700    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
701        Self {
702            builder: self.builder.property("tooltip-text", tooltip_text.into()),
703        }
704    }
705
706    /// How to distribute vertical space if widget gets extra space.
707    pub fn valign(self, valign: Align) -> Self {
708        Self {
709            builder: self.builder.property("valign", valign),
710        }
711    }
712
713    /// Whether to expand vertically.
714    pub fn vexpand(self, vexpand: bool) -> Self {
715        Self {
716            builder: self.builder.property("vexpand", vexpand),
717        }
718    }
719
720    /// Whether to use the `vexpand` property.
721    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
722        Self {
723            builder: self.builder.property("vexpand-set", vexpand_set),
724        }
725    }
726
727    /// Whether the widget is visible.
728    pub fn visible(self, visible: bool) -> Self {
729        Self {
730            builder: self.builder.property("visible", visible),
731        }
732    }
733
734    /// Overrides for width request of the widget.
735    ///
736    /// If this is -1, the natural request will be used.
737    pub fn width_request(self, width_request: i32) -> Self {
738        Self {
739            builder: self.builder.property("width-request", width_request),
740        }
741    }
742
743    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
744    ///
745    /// The accessible role cannot be changed once set.
746    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
747        Self {
748            builder: self.builder.property("accessible-role", accessible_role),
749        }
750    }
751
752    // rustdoc-stripper-ignore-next
753    /// Build the [`WindowHandle`].
754    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
755    pub fn build(self) -> WindowHandle {
756        assert_initialized_main_thread!();
757        self.builder.build()
758    }
759}