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