Skip to main content

gtk/auto/
popover_menu.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    Align, Bin, Buildable, Container, Popover, PopoverConstraint, PositionType, ResizeMode, Widget,
7    ffi,
8};
9use glib::{
10    prelude::*,
11    signal::{SignalHandlerId, connect_raw},
12    translate::*,
13};
14use std::boxed::Box as Box_;
15
16glib::wrapper! {
17    ///
18    /// ]|
19    ///
20    /// Just like normal popovers created using gtk_popover_new_from_model,
21    /// [`PopoverMenu`][crate::PopoverMenu] instances have a single css node called "popover"
22    /// and get the .menu style class.
23    ///
24    /// ## Properties
25    ///
26    ///
27    /// #### `visible-submenu`
28    ///  Readable | Writable
29    /// <details><summary><h4>Popover</h4></summary>
30    ///
31    ///
32    /// #### `constrain-to`
33    ///  Sets a constraint for the popover position.
34    ///
35    /// Readable | Writable
36    ///
37    ///
38    /// #### `modal`
39    ///  Sets whether the popover is modal (so other elements in the window do not
40    /// receive input while the popover is visible).
41    ///
42    /// Readable | Writable
43    ///
44    ///
45    /// #### `pointing-to`
46    ///  Marks a specific rectangle to be pointed.
47    ///
48    /// Readable | Writable
49    ///
50    ///
51    /// #### `position`
52    ///  Sets the preferred position of the popover.
53    ///
54    /// Readable | Writable
55    ///
56    ///
57    /// #### `relative-to`
58    ///  Sets the attached widget.
59    ///
60    /// Readable | Writable
61    ///
62    ///
63    /// #### `transitions-enabled`
64    ///  Whether show/hide transitions are enabled for this popover.
65    ///
66    /// Readable | Writable
67    /// </details>
68    /// <details><summary><h4>Container</h4></summary>
69    ///
70    ///
71    /// #### `border-width`
72    ///  Readable | Writable
73    ///
74    ///
75    /// #### `child`
76    ///  Writable
77    ///
78    ///
79    /// #### `resize-mode`
80    ///  Readable | Writable
81    /// </details>
82    /// <details><summary><h4>Widget</h4></summary>
83    ///
84    ///
85    /// #### `app-paintable`
86    ///  Readable | Writable
87    ///
88    ///
89    /// #### `can-default`
90    ///  Readable | Writable
91    ///
92    ///
93    /// #### `can-focus`
94    ///  Readable | Writable
95    ///
96    ///
97    /// #### `composite-child`
98    ///  Readable
99    ///
100    ///
101    /// #### `double-buffered`
102    ///  Whether the widget is double buffered.
103    ///
104    /// Readable | Writable
105    ///
106    ///
107    /// #### `events`
108    ///  Readable | Writable
109    ///
110    ///
111    /// #### `expand`
112    ///  Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
113    ///
114    /// Readable | Writable
115    ///
116    ///
117    /// #### `focus-on-click`
118    ///  Whether the widget should grab focus when it is clicked with the mouse.
119    ///
120    /// This property is only relevant for widgets that can take focus.
121    ///
122    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
123    /// GtkComboBox) implemented this property individually.
124    ///
125    /// Readable | Writable
126    ///
127    ///
128    /// #### `halign`
129    ///  How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
130    ///
131    /// Readable | Writable
132    ///
133    ///
134    /// #### `has-default`
135    ///  Readable | Writable
136    ///
137    ///
138    /// #### `has-focus`
139    ///  Readable | Writable
140    ///
141    ///
142    /// #### `has-tooltip`
143    ///  Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
144    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
145    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
146    /// whether it will provide a tooltip or not.
147    ///
148    /// Note that setting this property to [`true`] for the first time will change
149    /// the event masks of the GdkWindows of this widget to include leave-notify
150    /// and motion-notify events. This cannot and will not be undone when the
151    /// property is set to [`false`] again.
152    ///
153    /// Readable | Writable
154    ///
155    ///
156    /// #### `height-request`
157    ///  Readable | Writable
158    ///
159    ///
160    /// #### `hexpand`
161    ///  Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
162    ///
163    /// Readable | Writable
164    ///
165    ///
166    /// #### `hexpand-set`
167    ///  Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
168    ///
169    /// Readable | Writable
170    ///
171    ///
172    /// #### `is-focus`
173    ///  Readable | Writable
174    ///
175    ///
176    /// #### `margin`
177    ///  Sets all four sides' margin at once. If read, returns max
178    /// margin on any side.
179    ///
180    /// Readable | Writable
181    ///
182    ///
183    /// #### `margin-bottom`
184    ///  Margin on bottom side of widget.
185    ///
186    /// This property adds margin outside of the widget's normal size
187    /// request, the margin will be added in addition to the size from
188    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
189    ///
190    /// Readable | Writable
191    ///
192    ///
193    /// #### `margin-end`
194    ///  Margin on end of widget, horizontally. This property supports
195    /// left-to-right and right-to-left text directions.
196    ///
197    /// This property adds margin outside of the widget's normal size
198    /// request, the margin will be added in addition to the size from
199    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
200    ///
201    /// Readable | Writable
202    ///
203    ///
204    /// #### `margin-left`
205    ///  Margin on left side of widget.
206    ///
207    /// This property adds margin outside of the widget's normal size
208    /// request, the margin will be added in addition to the size from
209    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
210    ///
211    /// Readable | Writable
212    ///
213    ///
214    /// #### `margin-right`
215    ///  Margin on right side of widget.
216    ///
217    /// This property adds margin outside of the widget's normal size
218    /// request, the margin will be added in addition to the size from
219    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
220    ///
221    /// Readable | Writable
222    ///
223    ///
224    /// #### `margin-start`
225    ///  Margin on start of widget, horizontally. This property supports
226    /// left-to-right and right-to-left text directions.
227    ///
228    /// This property adds margin outside of the widget's normal size
229    /// request, the margin will be added in addition to the size from
230    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
231    ///
232    /// Readable | Writable
233    ///
234    ///
235    /// #### `margin-top`
236    ///  Margin on top side of widget.
237    ///
238    /// This property adds margin outside of the widget's normal size
239    /// request, the margin will be added in addition to the size from
240    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
241    ///
242    /// Readable | Writable
243    ///
244    ///
245    /// #### `name`
246    ///  Readable | Writable
247    ///
248    ///
249    /// #### `no-show-all`
250    ///  Readable | Writable
251    ///
252    ///
253    /// #### `opacity`
254    ///  The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
255    /// more details about window opacity.
256    ///
257    /// Before 3.8 this was only available in GtkWindow
258    ///
259    /// Readable | Writable
260    ///
261    ///
262    /// #### `parent`
263    ///  Readable | Writable
264    ///
265    ///
266    /// #### `receives-default`
267    ///  Readable | Writable
268    ///
269    ///
270    /// #### `scale-factor`
271    ///  The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
272    /// more details about widget scaling.
273    ///
274    /// Readable
275    ///
276    ///
277    /// #### `sensitive`
278    ///  Readable | Writable
279    ///
280    ///
281    /// #### `style`
282    ///  The style of the widget, which contains information about how it will look (colors, etc).
283    ///
284    /// Readable | Writable
285    ///
286    ///
287    /// #### `tooltip-markup`
288    ///  Sets the text of tooltip to be the given string, which is marked up
289    /// with the [Pango text markup language][PangoMarkupFormat].
290    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
291    ///
292    /// This is a convenience property which will take care of getting the
293    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
294    /// will automatically be set to [`true`] and there will be taken care of
295    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
296    ///
297    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
298    /// 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 [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
310    /// will automatically be set to [`true`] and there will be taken care of
311    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
312    ///
313    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
314    /// are set, the last one wins.
315    ///
316    /// Readable | Writable
317    ///
318    ///
319    /// #### `valign`
320    ///  How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
321    ///
322    /// Readable | Writable
323    ///
324    ///
325    /// #### `vexpand`
326    ///  Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
327    ///
328    /// Readable | Writable
329    ///
330    ///
331    /// #### `vexpand-set`
332    ///  Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
333    ///
334    /// Readable | Writable
335    ///
336    ///
337    /// #### `visible`
338    ///  Readable | Writable
339    ///
340    ///
341    /// #### `width-request`
342    ///  Readable | Writable
343    ///
344    ///
345    /// #### `window`
346    ///  The widget's window if it is realized, [`None`] otherwise.
347    ///
348    /// Readable
349    /// </details>
350    ///
351    /// # Implements
352    ///
353    /// [`PopoverExt`][trait@crate::prelude::PopoverExt], [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
354    #[doc(alias = "GtkPopoverMenu")]
355    pub struct PopoverMenu(Object<ffi::GtkPopoverMenu, ffi::GtkPopoverMenuClass>) @extends Popover, Bin, Container, Widget, @implements Buildable;
356
357    match fn {
358        type_ => || ffi::gtk_popover_menu_get_type(),
359    }
360}
361
362impl PopoverMenu {
363    /// Creates a new popover menu.
364    ///
365    /// # Returns
366    ///
367    /// a new [`PopoverMenu`][crate::PopoverMenu]
368    #[doc(alias = "gtk_popover_menu_new")]
369    pub fn new() -> PopoverMenu {
370        assert_initialized_main_thread!();
371        unsafe { Widget::from_glib_none(ffi::gtk_popover_menu_new()).unsafe_cast() }
372    }
373
374    // rustdoc-stripper-ignore-next
375    /// Creates a new builder-pattern struct instance to construct [`PopoverMenu`] objects.
376    ///
377    /// This method returns an instance of [`PopoverMenuBuilder`](crate::builders::PopoverMenuBuilder) which can be used to create [`PopoverMenu`] objects.
378    pub fn builder() -> PopoverMenuBuilder {
379        PopoverMenuBuilder::new()
380    }
381
382    /// Opens a submenu of the `self`. The `name`
383    /// must be one of the names given to the submenus
384    /// of `self` with [`submenu`][struct@crate::PopoverMenu#submenu], or
385    /// "main" to switch back to the main menu.
386    ///
387    /// [`ModelButton`][crate::ModelButton] will open submenus automatically
388    /// when the [`menu-name`][struct@crate::ModelButton#menu-name] property is set,
389    /// so this function is only needed when you are using
390    /// other kinds of widgets to initiate menu changes.
391    /// ## `name`
392    /// the name of the menu to switch to
393    #[doc(alias = "gtk_popover_menu_open_submenu")]
394    pub fn open_submenu(&self, name: &str) {
395        unsafe {
396            ffi::gtk_popover_menu_open_submenu(self.to_glib_none().0, name.to_glib_none().0);
397        }
398    }
399
400    #[doc(alias = "visible-submenu")]
401    pub fn visible_submenu(&self) -> Option<glib::GString> {
402        ObjectExt::property(self, "visible-submenu")
403    }
404
405    #[doc(alias = "visible-submenu")]
406    pub fn set_visible_submenu(&self, visible_submenu: Option<&str>) {
407        ObjectExt::set_property(self, "visible-submenu", visible_submenu)
408    }
409
410    pub fn child_position<T: IsA<crate::Widget>>(&self, item: &T) -> i32 {
411        crate::prelude::ContainerExtManual::child_property(self, &item.clone().upcast(), "position")
412    }
413
414    pub fn set_child_position<T: IsA<crate::Widget>>(&self, item: &T, position: i32) {
415        crate::prelude::ContainerExtManual::child_set_property(
416            self,
417            &item.clone().upcast(),
418            "position",
419            &position,
420        )
421    }
422
423    pub fn child_submenu<T: IsA<crate::Widget>>(&self, item: &T) -> Option<glib::GString> {
424        crate::prelude::ContainerExtManual::child_property(self, &item.clone().upcast(), "submenu")
425    }
426
427    pub fn set_child_submenu<T: IsA<crate::Widget>>(&self, item: &T, submenu: Option<&str>) {
428        crate::prelude::ContainerExtManual::child_set_property(
429            self,
430            &item.clone().upcast(),
431            "submenu",
432            &submenu,
433        )
434    }
435
436    #[doc(alias = "visible-submenu")]
437    pub fn connect_visible_submenu_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
438        unsafe extern "C" fn notify_visible_submenu_trampoline<F: Fn(&PopoverMenu) + 'static>(
439            this: *mut ffi::GtkPopoverMenu,
440            _param_spec: glib::ffi::gpointer,
441            f: glib::ffi::gpointer,
442        ) {
443            unsafe {
444                let f: &F = &*(f as *const F);
445                f(&from_glib_borrow(this))
446            }
447        }
448        unsafe {
449            let f: Box_<F> = Box_::new(f);
450            connect_raw(
451                self.as_ptr() as *mut _,
452                c"notify::visible-submenu".as_ptr(),
453                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
454                    notify_visible_submenu_trampoline::<F> as *const (),
455                )),
456                Box_::into_raw(f),
457            )
458        }
459    }
460}
461
462impl Default for PopoverMenu {
463    fn default() -> Self {
464        Self::new()
465    }
466}
467
468// rustdoc-stripper-ignore-next
469/// A [builder-pattern] type to construct [`PopoverMenu`] objects.
470///
471/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
472#[must_use = "The builder must be built to be used"]
473pub struct PopoverMenuBuilder {
474    builder: glib::object::ObjectBuilder<'static, PopoverMenu>,
475}
476
477impl PopoverMenuBuilder {
478    fn new() -> Self {
479        Self {
480            builder: glib::object::Object::builder(),
481        }
482    }
483
484    pub fn visible_submenu(self, visible_submenu: impl Into<glib::GString>) -> Self {
485        Self {
486            builder: self
487                .builder
488                .property("visible-submenu", visible_submenu.into()),
489        }
490    }
491
492    /// Sets a constraint for the popover position.
493    pub fn constrain_to(self, constrain_to: PopoverConstraint) -> Self {
494        Self {
495            builder: self.builder.property("constrain-to", constrain_to),
496        }
497    }
498
499    /// Sets whether the popover is modal (so other elements in the window do not
500    /// receive input while the popover is visible).
501    pub fn modal(self, modal: bool) -> Self {
502        Self {
503            builder: self.builder.property("modal", modal),
504        }
505    }
506
507    /// Marks a specific rectangle to be pointed.
508    pub fn pointing_to(self, pointing_to: &gdk::Rectangle) -> Self {
509        Self {
510            builder: self.builder.property("pointing-to", pointing_to),
511        }
512    }
513
514    /// Sets the preferred position of the popover.
515    pub fn position(self, position: PositionType) -> Self {
516        Self {
517            builder: self.builder.property("position", position),
518        }
519    }
520
521    /// Sets the attached widget.
522    pub fn relative_to(self, relative_to: &impl IsA<Widget>) -> Self {
523        Self {
524            builder: self
525                .builder
526                .property("relative-to", relative_to.clone().upcast()),
527        }
528    }
529
530    pub fn border_width(self, border_width: u32) -> Self {
531        Self {
532            builder: self.builder.property("border-width", border_width),
533        }
534    }
535
536    pub fn child(self, child: &impl IsA<Widget>) -> Self {
537        Self {
538            builder: self.builder.property("child", child.clone().upcast()),
539        }
540    }
541
542    pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
543        Self {
544            builder: self.builder.property("resize-mode", resize_mode),
545        }
546    }
547
548    pub fn app_paintable(self, app_paintable: bool) -> Self {
549        Self {
550            builder: self.builder.property("app-paintable", app_paintable),
551        }
552    }
553
554    pub fn can_default(self, can_default: bool) -> Self {
555        Self {
556            builder: self.builder.property("can-default", can_default),
557        }
558    }
559
560    pub fn can_focus(self, can_focus: bool) -> Self {
561        Self {
562            builder: self.builder.property("can-focus", can_focus),
563        }
564    }
565
566    pub fn events(self, events: gdk::EventMask) -> Self {
567        Self {
568            builder: self.builder.property("events", events),
569        }
570    }
571
572    /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
573    pub fn expand(self, expand: bool) -> Self {
574        Self {
575            builder: self.builder.property("expand", expand),
576        }
577    }
578
579    /// Whether the widget should grab focus when it is clicked with the mouse.
580    ///
581    /// This property is only relevant for widgets that can take focus.
582    ///
583    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
584    /// GtkComboBox) implemented this property individually.
585    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
586        Self {
587            builder: self.builder.property("focus-on-click", focus_on_click),
588        }
589    }
590
591    /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
592    pub fn halign(self, halign: Align) -> Self {
593        Self {
594            builder: self.builder.property("halign", halign),
595        }
596    }
597
598    pub fn has_default(self, has_default: bool) -> Self {
599        Self {
600            builder: self.builder.property("has-default", has_default),
601        }
602    }
603
604    pub fn has_focus(self, has_focus: bool) -> Self {
605        Self {
606            builder: self.builder.property("has-focus", has_focus),
607        }
608    }
609
610    /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
611    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
612    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
613    /// whether it will provide a tooltip or not.
614    ///
615    /// Note that setting this property to [`true`] for the first time will change
616    /// the event masks of the GdkWindows of this widget to include leave-notify
617    /// and motion-notify events. This cannot and will not be undone when the
618    /// property is set to [`false`] again.
619    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
620        Self {
621            builder: self.builder.property("has-tooltip", has_tooltip),
622        }
623    }
624
625    pub fn height_request(self, height_request: i32) -> Self {
626        Self {
627            builder: self.builder.property("height-request", height_request),
628        }
629    }
630
631    /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
632    pub fn hexpand(self, hexpand: bool) -> Self {
633        Self {
634            builder: self.builder.property("hexpand", hexpand),
635        }
636    }
637
638    /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
639    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
640        Self {
641            builder: self.builder.property("hexpand-set", hexpand_set),
642        }
643    }
644
645    pub fn is_focus(self, is_focus: bool) -> Self {
646        Self {
647            builder: self.builder.property("is-focus", is_focus),
648        }
649    }
650
651    /// Sets all four sides' margin at once. If read, returns max
652    /// margin on any side.
653    pub fn margin(self, margin: i32) -> Self {
654        Self {
655            builder: self.builder.property("margin", margin),
656        }
657    }
658
659    /// Margin on bottom side of widget.
660    ///
661    /// This property adds margin outside of the widget's normal size
662    /// request, the margin will be added in addition to the size from
663    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
664    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
665        Self {
666            builder: self.builder.property("margin-bottom", margin_bottom),
667        }
668    }
669
670    /// Margin on end of widget, horizontally. This property supports
671    /// left-to-right and right-to-left text directions.
672    ///
673    /// This property adds margin outside of the widget's normal size
674    /// request, the margin will be added in addition to the size from
675    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
676    pub fn margin_end(self, margin_end: i32) -> Self {
677        Self {
678            builder: self.builder.property("margin-end", margin_end),
679        }
680    }
681
682    /// Margin on start of widget, horizontally. This property supports
683    /// left-to-right and right-to-left text directions.
684    ///
685    /// This property adds margin outside of the widget's normal size
686    /// request, the margin will be added in addition to the size from
687    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
688    pub fn margin_start(self, margin_start: i32) -> Self {
689        Self {
690            builder: self.builder.property("margin-start", margin_start),
691        }
692    }
693
694    /// Margin on top side of widget.
695    ///
696    /// This property adds margin outside of the widget's normal size
697    /// request, the margin will be added in addition to the size from
698    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
699    pub fn margin_top(self, margin_top: i32) -> Self {
700        Self {
701            builder: self.builder.property("margin-top", margin_top),
702        }
703    }
704
705    pub fn name(self, name: impl Into<glib::GString>) -> Self {
706        Self {
707            builder: self.builder.property("name", name.into()),
708        }
709    }
710
711    pub fn no_show_all(self, no_show_all: bool) -> Self {
712        Self {
713            builder: self.builder.property("no-show-all", no_show_all),
714        }
715    }
716
717    /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
718    /// more details about window opacity.
719    ///
720    /// Before 3.8 this was only available in GtkWindow
721    pub fn opacity(self, opacity: f64) -> Self {
722        Self {
723            builder: self.builder.property("opacity", opacity),
724        }
725    }
726
727    pub fn parent(self, parent: &impl IsA<Container>) -> Self {
728        Self {
729            builder: self.builder.property("parent", parent.clone().upcast()),
730        }
731    }
732
733    pub fn receives_default(self, receives_default: bool) -> Self {
734        Self {
735            builder: self.builder.property("receives-default", receives_default),
736        }
737    }
738
739    pub fn sensitive(self, sensitive: bool) -> Self {
740        Self {
741            builder: self.builder.property("sensitive", sensitive),
742        }
743    }
744
745    /// Sets the text of tooltip to be the given string, which is marked up
746    /// with the [Pango text markup language][PangoMarkupFormat].
747    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
748    ///
749    /// This is a convenience property which will take care of getting the
750    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
751    /// will automatically be set to [`true`] and there will be taken care of
752    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
753    ///
754    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
755    /// are set, the last one wins.
756    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
757        Self {
758            builder: self
759                .builder
760                .property("tooltip-markup", tooltip_markup.into()),
761        }
762    }
763
764    /// Sets the text of tooltip to be the given string.
765    ///
766    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
767    ///
768    /// This is a convenience property which will take care of getting the
769    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
770    /// will automatically be set to [`true`] and there will be taken care of
771    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
772    ///
773    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
774    /// are set, the last one wins.
775    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
776        Self {
777            builder: self.builder.property("tooltip-text", tooltip_text.into()),
778        }
779    }
780
781    /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
782    pub fn valign(self, valign: Align) -> Self {
783        Self {
784            builder: self.builder.property("valign", valign),
785        }
786    }
787
788    /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
789    pub fn vexpand(self, vexpand: bool) -> Self {
790        Self {
791            builder: self.builder.property("vexpand", vexpand),
792        }
793    }
794
795    /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
796    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
797        Self {
798            builder: self.builder.property("vexpand-set", vexpand_set),
799        }
800    }
801
802    pub fn visible(self, visible: bool) -> Self {
803        Self {
804            builder: self.builder.property("visible", visible),
805        }
806    }
807
808    pub fn width_request(self, width_request: i32) -> Self {
809        Self {
810            builder: self.builder.property("width-request", width_request),
811        }
812    }
813
814    // rustdoc-stripper-ignore-next
815    /// Build the [`PopoverMenu`].
816    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
817    pub fn build(self) -> PopoverMenu {
818        assert_initialized_main_thread!();
819        self.builder.build()
820    }
821}