Skip to main content

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