Skip to main content

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