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 Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, LayoutManager, Overflow,
7 Widget, ffi,
8};
9use glib::{
10 prelude::*,
11 signal::{SignalHandlerId, connect_raw},
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 unsafe {
477 let f: &F = &*(f as *const F);
478 f(&from_glib_borrow(this))
479 }
480 }
481 unsafe {
482 let f: Box_<F> = Box_::new(f);
483 connect_raw(
484 self.as_ptr() as *mut _,
485 c"notify::menu-model".as_ptr() as *const _,
486 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
487 notify_menu_model_trampoline::<F> as *const (),
488 )),
489 Box_::into_raw(f),
490 )
491 }
492 }
493}
494
495// rustdoc-stripper-ignore-next
496/// A [builder-pattern] type to construct [`PopoverMenuBar`] objects.
497///
498/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
499#[must_use = "The builder must be built to be used"]
500pub struct PopoverMenuBarBuilder {
501 builder: glib::object::ObjectBuilder<'static, PopoverMenuBar>,
502}
503
504impl PopoverMenuBarBuilder {
505 fn new() -> Self {
506 Self {
507 builder: glib::object::Object::builder(),
508 }
509 }
510
511 /// The `GMenuModel` from which the menu bar is created.
512 ///
513 /// The model should only contain submenus as toplevel elements.
514 pub fn menu_model(self, menu_model: &impl IsA<gio::MenuModel>) -> Self {
515 Self {
516 builder: self
517 .builder
518 .property("menu-model", menu_model.clone().upcast()),
519 }
520 }
521
522 /// Whether the widget or any of its descendents can accept
523 /// the input focus.
524 ///
525 /// This property is meant to be set by widget implementations,
526 /// typically in their instance init function.
527 pub fn can_focus(self, can_focus: bool) -> Self {
528 Self {
529 builder: self.builder.property("can-focus", can_focus),
530 }
531 }
532
533 /// Whether the widget can receive pointer events.
534 pub fn can_target(self, can_target: bool) -> Self {
535 Self {
536 builder: self.builder.property("can-target", can_target),
537 }
538 }
539
540 /// A list of css classes applied to this widget.
541 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
542 Self {
543 builder: self.builder.property("css-classes", css_classes.into()),
544 }
545 }
546
547 /// The name of this widget in the CSS tree.
548 ///
549 /// This property is meant to be set by widget implementations,
550 /// typically in their instance init function.
551 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
552 Self {
553 builder: self.builder.property("css-name", css_name.into()),
554 }
555 }
556
557 /// The cursor used by @widget.
558 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
559 Self {
560 builder: self.builder.property("cursor", cursor.clone()),
561 }
562 }
563
564 /// Whether the widget should grab focus when it is clicked with the mouse.
565 ///
566 /// This property is only relevant for widgets that can take focus.
567 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
568 Self {
569 builder: self.builder.property("focus-on-click", focus_on_click),
570 }
571 }
572
573 /// Whether this widget itself will accept the input focus.
574 pub fn focusable(self, focusable: bool) -> Self {
575 Self {
576 builder: self.builder.property("focusable", focusable),
577 }
578 }
579
580 /// How to distribute horizontal space if widget gets extra space.
581 pub fn halign(self, halign: Align) -> Self {
582 Self {
583 builder: self.builder.property("halign", halign),
584 }
585 }
586
587 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
588 /// signal on @widget.
589 ///
590 /// A true value indicates that @widget can have a tooltip, in this case
591 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
592 /// determine whether it will provide a tooltip or not.
593 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
594 Self {
595 builder: self.builder.property("has-tooltip", has_tooltip),
596 }
597 }
598
599 /// Overrides for height request of the widget.
600 ///
601 /// If this is -1, the natural request will be used.
602 pub fn height_request(self, height_request: i32) -> Self {
603 Self {
604 builder: self.builder.property("height-request", height_request),
605 }
606 }
607
608 /// Whether to expand horizontally.
609 pub fn hexpand(self, hexpand: bool) -> Self {
610 Self {
611 builder: self.builder.property("hexpand", hexpand),
612 }
613 }
614
615 /// Whether to use the `hexpand` property.
616 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
617 Self {
618 builder: self.builder.property("hexpand-set", hexpand_set),
619 }
620 }
621
622 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
623 /// the preferred size of the widget, and allocate its children.
624 ///
625 /// This property is meant to be set by widget implementations,
626 /// typically in their instance init function.
627 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
628 Self {
629 builder: self
630 .builder
631 .property("layout-manager", layout_manager.clone().upcast()),
632 }
633 }
634
635 /// Makes this widget act like a modal dialog, with respect to
636 /// event delivery.
637 ///
638 /// Global event controllers will not handle events with targets
639 /// inside the widget, unless they are set up to ignore propagation
640 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
641 #[cfg(feature = "v4_18")]
642 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
643 pub fn limit_events(self, limit_events: bool) -> Self {
644 Self {
645 builder: self.builder.property("limit-events", limit_events),
646 }
647 }
648
649 /// Margin on bottom side of widget.
650 ///
651 /// This property adds margin outside of the widget's normal size
652 /// request, the margin will be added in addition to the size from
653 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
654 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
655 Self {
656 builder: self.builder.property("margin-bottom", margin_bottom),
657 }
658 }
659
660 /// Margin on end of widget, horizontally.
661 ///
662 /// This property supports left-to-right and right-to-left text
663 /// directions.
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_end(self, margin_end: i32) -> Self {
669 Self {
670 builder: self.builder.property("margin-end", margin_end),
671 }
672 }
673
674 /// Margin on start 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_start(self, margin_start: i32) -> Self {
683 Self {
684 builder: self.builder.property("margin-start", margin_start),
685 }
686 }
687
688 /// Margin on top side of widget.
689 ///
690 /// This property adds margin outside of the widget's normal size
691 /// request, the margin will be added in addition to the size from
692 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
693 pub fn margin_top(self, margin_top: i32) -> Self {
694 Self {
695 builder: self.builder.property("margin-top", margin_top),
696 }
697 }
698
699 /// The name of the widget.
700 pub fn name(self, name: impl Into<glib::GString>) -> Self {
701 Self {
702 builder: self.builder.property("name", name.into()),
703 }
704 }
705
706 /// The requested opacity of the widget.
707 pub fn opacity(self, opacity: f64) -> Self {
708 Self {
709 builder: self.builder.property("opacity", opacity),
710 }
711 }
712
713 /// How content outside the widget's content area is treated.
714 ///
715 /// This property is meant to be set by widget implementations,
716 /// typically in their instance init function.
717 pub fn overflow(self, overflow: Overflow) -> Self {
718 Self {
719 builder: self.builder.property("overflow", overflow),
720 }
721 }
722
723 /// Whether the widget will receive the default action when it is focused.
724 pub fn receives_default(self, receives_default: bool) -> Self {
725 Self {
726 builder: self.builder.property("receives-default", receives_default),
727 }
728 }
729
730 /// Whether the widget responds to input.
731 pub fn sensitive(self, sensitive: bool) -> Self {
732 Self {
733 builder: self.builder.property("sensitive", sensitive),
734 }
735 }
736
737 /// Sets the text of tooltip to be the given string, which is marked up
738 /// with Pango markup.
739 ///
740 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
741 ///
742 /// This is a convenience property which will take care of getting the
743 /// tooltip shown if the given string is not `NULL`:
744 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
745 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
746 /// the default signal handler.
747 ///
748 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
749 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
750 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
751 Self {
752 builder: self
753 .builder
754 .property("tooltip-markup", tooltip_markup.into()),
755 }
756 }
757
758 /// Sets the text of tooltip to be the given string.
759 ///
760 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
761 ///
762 /// This is a convenience property which will take care of getting the
763 /// tooltip shown if the given string is not `NULL`:
764 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
765 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
766 /// the default signal handler.
767 ///
768 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
769 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
770 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
771 Self {
772 builder: self.builder.property("tooltip-text", tooltip_text.into()),
773 }
774 }
775
776 /// How to distribute vertical space if widget gets extra space.
777 pub fn valign(self, valign: Align) -> Self {
778 Self {
779 builder: self.builder.property("valign", valign),
780 }
781 }
782
783 /// Whether to expand vertically.
784 pub fn vexpand(self, vexpand: bool) -> Self {
785 Self {
786 builder: self.builder.property("vexpand", vexpand),
787 }
788 }
789
790 /// Whether to use the `vexpand` property.
791 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
792 Self {
793 builder: self.builder.property("vexpand-set", vexpand_set),
794 }
795 }
796
797 /// Whether the widget is visible.
798 pub fn visible(self, visible: bool) -> Self {
799 Self {
800 builder: self.builder.property("visible", visible),
801 }
802 }
803
804 /// Overrides for width request of the widget.
805 ///
806 /// If this is -1, the natural request will be used.
807 pub fn width_request(self, width_request: i32) -> Self {
808 Self {
809 builder: self.builder.property("width-request", width_request),
810 }
811 }
812
813 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
814 ///
815 /// The accessible role cannot be changed once set.
816 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
817 Self {
818 builder: self.builder.property("accessible-role", accessible_role),
819 }
820 }
821
822 // rustdoc-stripper-ignore-next
823 /// Build the [`PopoverMenuBar`].
824 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
825 pub fn build(self) -> PopoverMenuBar {
826 assert_initialized_main_thread!();
827 self.builder.build()
828 }
829}