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