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