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 ffi, Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, LayoutManager, Overflow,
7 Widget,
8};
9use glib::{
10 prelude::*,
11 signal::{connect_raw, SignalHandlerId},
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 let f: &F = &*(f as *const F);
405 f(&from_glib_borrow(this))
406 }
407 unsafe {
408 let f: Box_<F> = Box_::new(f);
409 connect_raw(
410 self.as_ptr() as *mut _,
411 c"notify::child".as_ptr() as *const _,
412 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
413 notify_child_trampoline::<F> as *const (),
414 )),
415 Box_::into_raw(f),
416 )
417 }
418 }
419}
420
421impl Default for WindowHandle {
422 fn default() -> Self {
423 Self::new()
424 }
425}
426
427// rustdoc-stripper-ignore-next
428/// A [builder-pattern] type to construct [`WindowHandle`] objects.
429///
430/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
431#[must_use = "The builder must be built to be used"]
432pub struct WindowHandleBuilder {
433 builder: glib::object::ObjectBuilder<'static, WindowHandle>,
434}
435
436impl WindowHandleBuilder {
437 fn new() -> Self {
438 Self {
439 builder: glib::object::Object::builder(),
440 }
441 }
442
443 /// The child widget.
444 pub fn child(self, child: &impl IsA<Widget>) -> Self {
445 Self {
446 builder: self.builder.property("child", child.clone().upcast()),
447 }
448 }
449
450 /// Whether the widget or any of its descendents can accept
451 /// the input focus.
452 ///
453 /// This property is meant to be set by widget implementations,
454 /// typically in their instance init function.
455 pub fn can_focus(self, can_focus: bool) -> Self {
456 Self {
457 builder: self.builder.property("can-focus", can_focus),
458 }
459 }
460
461 /// Whether the widget can receive pointer events.
462 pub fn can_target(self, can_target: bool) -> Self {
463 Self {
464 builder: self.builder.property("can-target", can_target),
465 }
466 }
467
468 /// A list of css classes applied to this widget.
469 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
470 Self {
471 builder: self.builder.property("css-classes", css_classes.into()),
472 }
473 }
474
475 /// The name of this widget in the CSS tree.
476 ///
477 /// This property is meant to be set by widget implementations,
478 /// typically in their instance init function.
479 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
480 Self {
481 builder: self.builder.property("css-name", css_name.into()),
482 }
483 }
484
485 /// The cursor used by @widget.
486 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
487 Self {
488 builder: self.builder.property("cursor", cursor.clone()),
489 }
490 }
491
492 /// Whether the widget should grab focus when it is clicked with the mouse.
493 ///
494 /// This property is only relevant for widgets that can take focus.
495 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
496 Self {
497 builder: self.builder.property("focus-on-click", focus_on_click),
498 }
499 }
500
501 /// Whether this widget itself will accept the input focus.
502 pub fn focusable(self, focusable: bool) -> Self {
503 Self {
504 builder: self.builder.property("focusable", focusable),
505 }
506 }
507
508 /// How to distribute horizontal space if widget gets extra space.
509 pub fn halign(self, halign: Align) -> Self {
510 Self {
511 builder: self.builder.property("halign", halign),
512 }
513 }
514
515 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
516 /// signal on @widget.
517 ///
518 /// A true value indicates that @widget can have a tooltip, in this case
519 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
520 /// determine whether it will provide a tooltip or not.
521 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
522 Self {
523 builder: self.builder.property("has-tooltip", has_tooltip),
524 }
525 }
526
527 /// Overrides for height request of the widget.
528 ///
529 /// If this is -1, the natural request will be used.
530 pub fn height_request(self, height_request: i32) -> Self {
531 Self {
532 builder: self.builder.property("height-request", height_request),
533 }
534 }
535
536 /// Whether to expand horizontally.
537 pub fn hexpand(self, hexpand: bool) -> Self {
538 Self {
539 builder: self.builder.property("hexpand", hexpand),
540 }
541 }
542
543 /// Whether to use the `hexpand` property.
544 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
545 Self {
546 builder: self.builder.property("hexpand-set", hexpand_set),
547 }
548 }
549
550 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
551 /// the preferred size of the widget, and allocate its children.
552 ///
553 /// This property is meant to be set by widget implementations,
554 /// typically in their instance init function.
555 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
556 Self {
557 builder: self
558 .builder
559 .property("layout-manager", layout_manager.clone().upcast()),
560 }
561 }
562
563 /// Makes this widget act like a modal dialog, with respect to
564 /// event delivery.
565 ///
566 /// Global event controllers will not handle events with targets
567 /// inside the widget, unless they are set up to ignore propagation
568 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
569 #[cfg(feature = "v4_18")]
570 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
571 pub fn limit_events(self, limit_events: bool) -> Self {
572 Self {
573 builder: self.builder.property("limit-events", limit_events),
574 }
575 }
576
577 /// Margin on bottom side of widget.
578 ///
579 /// This property adds margin outside of the widget's normal size
580 /// request, the margin will be added in addition to the size from
581 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
582 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
583 Self {
584 builder: self.builder.property("margin-bottom", margin_bottom),
585 }
586 }
587
588 /// Margin on end of widget, horizontally.
589 ///
590 /// This property supports left-to-right and right-to-left text
591 /// directions.
592 ///
593 /// This property adds margin outside of the widget's normal size
594 /// request, the margin will be added in addition to the size from
595 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
596 pub fn margin_end(self, margin_end: i32) -> Self {
597 Self {
598 builder: self.builder.property("margin-end", margin_end),
599 }
600 }
601
602 /// Margin on start of widget, horizontally.
603 ///
604 /// This property supports left-to-right and right-to-left text
605 /// directions.
606 ///
607 /// This property adds margin outside of the widget's normal size
608 /// request, the margin will be added in addition to the size from
609 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
610 pub fn margin_start(self, margin_start: i32) -> Self {
611 Self {
612 builder: self.builder.property("margin-start", margin_start),
613 }
614 }
615
616 /// Margin on top side of widget.
617 ///
618 /// This property adds margin outside of the widget's normal size
619 /// request, the margin will be added in addition to the size from
620 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
621 pub fn margin_top(self, margin_top: i32) -> Self {
622 Self {
623 builder: self.builder.property("margin-top", margin_top),
624 }
625 }
626
627 /// The name of the widget.
628 pub fn name(self, name: impl Into<glib::GString>) -> Self {
629 Self {
630 builder: self.builder.property("name", name.into()),
631 }
632 }
633
634 /// The requested opacity of the widget.
635 pub fn opacity(self, opacity: f64) -> Self {
636 Self {
637 builder: self.builder.property("opacity", opacity),
638 }
639 }
640
641 /// How content outside the widget's content area is treated.
642 ///
643 /// This property is meant to be set by widget implementations,
644 /// typically in their instance init function.
645 pub fn overflow(self, overflow: Overflow) -> Self {
646 Self {
647 builder: self.builder.property("overflow", overflow),
648 }
649 }
650
651 /// Whether the widget will receive the default action when it is focused.
652 pub fn receives_default(self, receives_default: bool) -> Self {
653 Self {
654 builder: self.builder.property("receives-default", receives_default),
655 }
656 }
657
658 /// Whether the widget responds to input.
659 pub fn sensitive(self, sensitive: bool) -> Self {
660 Self {
661 builder: self.builder.property("sensitive", sensitive),
662 }
663 }
664
665 /// Sets the text of tooltip to be the given string, which is marked up
666 /// with Pango markup.
667 ///
668 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
669 ///
670 /// This is a convenience property which will take care of getting the
671 /// tooltip shown if the given string is not `NULL`:
672 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
673 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
674 /// the default signal handler.
675 ///
676 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
677 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
678 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
679 Self {
680 builder: self
681 .builder
682 .property("tooltip-markup", tooltip_markup.into()),
683 }
684 }
685
686 /// Sets the text of tooltip to be the given string.
687 ///
688 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
689 ///
690 /// This is a convenience property which will take care of getting the
691 /// tooltip shown if the given string is not `NULL`:
692 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
693 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
694 /// the default signal handler.
695 ///
696 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
697 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
698 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
699 Self {
700 builder: self.builder.property("tooltip-text", tooltip_text.into()),
701 }
702 }
703
704 /// How to distribute vertical space if widget gets extra space.
705 pub fn valign(self, valign: Align) -> Self {
706 Self {
707 builder: self.builder.property("valign", valign),
708 }
709 }
710
711 /// Whether to expand vertically.
712 pub fn vexpand(self, vexpand: bool) -> Self {
713 Self {
714 builder: self.builder.property("vexpand", vexpand),
715 }
716 }
717
718 /// Whether to use the `vexpand` property.
719 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
720 Self {
721 builder: self.builder.property("vexpand-set", vexpand_set),
722 }
723 }
724
725 /// Whether the widget is visible.
726 pub fn visible(self, visible: bool) -> Self {
727 Self {
728 builder: self.builder.property("visible", visible),
729 }
730 }
731
732 /// Overrides for width request of the widget.
733 ///
734 /// If this is -1, the natural request will be used.
735 pub fn width_request(self, width_request: i32) -> Self {
736 Self {
737 builder: self.builder.property("width-request", width_request),
738 }
739 }
740
741 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
742 ///
743 /// The accessible role cannot be changed once set.
744 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
745 Self {
746 builder: self.builder.property("accessible-role", accessible_role),
747 }
748 }
749
750 // rustdoc-stripper-ignore-next
751 /// Build the [`WindowHandle`].
752 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
753 pub fn build(self) -> WindowHandle {
754 assert_initialized_main_thread!();
755 self.builder.build()
756 }
757}