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