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