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