gtk4/auto/
statusbar.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#![allow(deprecated)]
5
6use crate::{
7    ffi, Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, LayoutManager, Overflow,
8    Widget,
9};
10use glib::{
11    object::ObjectType as _,
12    prelude::*,
13    signal::{connect_raw, SignalHandlerId},
14    translate::*,
15};
16use std::boxed::Box as Box_;
17
18glib::wrapper! {
19    /// This widget will be removed in GTK 5
20    /// A [`Statusbar`][crate::Statusbar] widget is usually placed along the bottom of an application's
21    /// main [`Window`][crate::Window].
22    ///
23    /// picture>
24    ///   <source srcset="statusbar-dark.png" media="(prefers-color-scheme: dark)">
25    ///   <img alt="An example GtkStatusbar" src="statusbar.png">
26    /// </picture>
27    ///
28    /// A `GtkStatusBar` may provide a regular commentary of the application's
29    /// status (as is usually the case in a web browser, for example), or may be
30    /// used to simply output a message when the status changes, (when an upload
31    /// is complete in an FTP client, for example).
32    ///
33    /// Status bars in GTK maintain a stack of messages. The message at
34    /// the top of the each bar’s stack is the one that will currently be displayed.
35    ///
36    /// Any messages added to a statusbar’s stack must specify a context id that
37    /// is used to uniquely identify the source of a message. This context id can
38    /// be generated by [`context_id()`][Self::context_id()], given a message and
39    /// the statusbar that it will be added to. Note that messages are stored in a
40    /// stack, and when choosing which message to display, the stack structure is
41    /// adhered to, regardless of the context identifier of a message.
42    ///
43    /// One could say that a statusbar maintains one stack of messages for
44    /// display purposes, but allows multiple message producers to maintain
45    /// sub-stacks of the messages they produced (via context ids).
46    ///
47    /// Status bars are created using [`new()`][Self::new()].
48    ///
49    /// Messages are added to the bar’s stack with [`push()`][Self::push()].
50    ///
51    /// The message at the top of the stack can be removed using
52    /// [`pop()`][Self::pop()]. A message can be removed from anywhere in the
53    /// stack if its message id was recorded at the time it was added. This is done
54    /// using [`remove()`][Self::remove()].
55    ///
56    /// ## CSS node
57    ///
58    /// [`Statusbar`][crate::Statusbar] has a single CSS node with name `statusbar`.
59    ///
60    /// ## Signals
61    ///
62    ///
63    /// #### `text-popped`
64    ///  Emitted whenever a new message is popped off a statusbar's stack.
65    ///
66    ///
67    ///
68    ///
69    /// #### `text-pushed`
70    ///  Emitted whenever a new message gets pushed onto a statusbar's stack.
71    ///
72    ///
73    /// <details><summary><h4>Widget</h4></summary>
74    ///
75    ///
76    /// #### `destroy`
77    ///  Signals that all holders of a reference to the widget should release
78    /// the reference that they hold.
79    ///
80    /// May result in finalization of the widget if all references are released.
81    ///
82    /// This signal is not suitable for saving widget state.
83    ///
84    ///
85    ///
86    ///
87    /// #### `direction-changed`
88    ///  Emitted when the text direction of a widget changes.
89    ///
90    ///
91    ///
92    ///
93    /// #### `hide`
94    ///  Emitted when @widget is hidden.
95    ///
96    ///
97    ///
98    ///
99    /// #### `keynav-failed`
100    ///  Emitted if keyboard navigation fails.
101    ///
102    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
103    ///
104    ///
105    ///
106    ///
107    /// #### `map`
108    ///  Emitted when @widget is going to be mapped.
109    ///
110    /// A widget is mapped when the widget is visible (which is controlled with
111    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
112    /// are also visible.
113    ///
114    /// The `::map` signal can be used to determine whether a widget will be drawn,
115    /// for instance it can resume an animation that was stopped during the
116    /// emission of [`unmap`][struct@crate::Widget#unmap].
117    ///
118    ///
119    ///
120    ///
121    /// #### `mnemonic-activate`
122    ///  Emitted when a widget is activated via a mnemonic.
123    ///
124    /// The default handler for this signal activates @widget if @group_cycling
125    /// is false, or just makes @widget grab focus if @group_cycling is true.
126    ///
127    ///
128    ///
129    ///
130    /// #### `move-focus`
131    ///  Emitted when the focus is moved.
132    ///
133    /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
134    ///
135    /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
136    /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
137    ///
138    /// Action
139    ///
140    ///
141    /// #### `query-tooltip`
142    ///  Emitted when the widget’s tooltip is about to be shown.
143    ///
144    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
145    /// is true and the hover timeout has expired with the cursor hovering
146    /// above @widget; or emitted when @widget got focus in keyboard mode.
147    ///
148    /// Using the given coordinates, the signal handler should determine
149    /// whether a tooltip should be shown for @widget. If this is the case
150    /// true should be returned, false otherwise. Note that if @keyboard_mode
151    /// is true, the values of @x and @y are undefined and should not be used.
152    ///
153    /// The signal handler is free to manipulate @tooltip with the therefore
154    /// destined function calls.
155    ///
156    ///
157    ///
158    ///
159    /// #### `realize`
160    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
161    ///
162    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
163    /// or the widget has been mapped (that is, it is going to be drawn).
164    ///
165    ///
166    ///
167    ///
168    /// #### `show`
169    ///  Emitted when @widget is shown.
170    ///
171    ///
172    ///
173    ///
174    /// #### `state-flags-changed`
175    ///  Emitted when the widget state changes.
176    ///
177    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
178    ///
179    ///
180    ///
181    ///
182    /// #### `unmap`
183    ///  Emitted when @widget is going to be unmapped.
184    ///
185    /// A widget is unmapped when either it or any of its parents up to the
186    /// toplevel widget have been set as hidden.
187    ///
188    /// As `::unmap` indicates that a widget will not be shown any longer,
189    /// it can be used to, for example, stop an animation on the widget.
190    ///
191    ///
192    ///
193    ///
194    /// #### `unrealize`
195    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
196    ///
197    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
198    /// or the widget has been unmapped (that is, it is going to be hidden).
199    ///
200    ///
201    /// </details>
202    ///
203    /// # Implements
204    ///
205    /// [`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]
206    #[doc(alias = "GtkStatusbar")]
207    pub struct Statusbar(Object<ffi::GtkStatusbar>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget;
208
209    match fn {
210        type_ => || ffi::gtk_statusbar_get_type(),
211    }
212}
213
214impl Statusbar {
215    /// Creates a new [`Statusbar`][crate::Statusbar] ready for messages.
216    ///
217    /// # Deprecated since 4.10
218    ///
219    /// This widget will be removed in GTK 5
220    ///
221    /// # Returns
222    ///
223    /// the new [`Statusbar`][crate::Statusbar]
224    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
225    #[allow(deprecated)]
226    #[doc(alias = "gtk_statusbar_new")]
227    pub fn new() -> Statusbar {
228        assert_initialized_main_thread!();
229        unsafe { Widget::from_glib_none(ffi::gtk_statusbar_new()).unsafe_cast() }
230    }
231
232    // rustdoc-stripper-ignore-next
233    /// Creates a new builder-pattern struct instance to construct [`Statusbar`] objects.
234    ///
235    /// This method returns an instance of [`StatusbarBuilder`](crate::builders::StatusbarBuilder) which can be used to create [`Statusbar`] objects.
236    pub fn builder() -> StatusbarBuilder {
237        StatusbarBuilder::new()
238    }
239
240    /// Returns a new context identifier, given a description
241    /// of the actual context.
242    ///
243    /// Note that the description is not shown in the UI.
244    ///
245    /// # Deprecated since 4.10
246    ///
247    /// This widget will be removed in GTK 5
248    /// ## `context_description`
249    /// textual description of what context
250    ///   the new message is being used in
251    ///
252    /// # Returns
253    ///
254    /// an integer id
255    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
256    #[allow(deprecated)]
257    #[doc(alias = "gtk_statusbar_get_context_id")]
258    #[doc(alias = "get_context_id")]
259    pub fn context_id(&self, context_description: &str) -> u32 {
260        unsafe {
261            ffi::gtk_statusbar_get_context_id(
262                self.to_glib_none().0,
263                context_description.to_glib_none().0,
264            )
265        }
266    }
267
268    /// Removes the first message in the [`Statusbar`][crate::Statusbar]’s stack
269    /// with the given context id.
270    ///
271    /// Note that this may not change the displayed message,
272    /// if the message at the top of the stack has a different
273    /// context id.
274    ///
275    /// # Deprecated since 4.10
276    ///
277    /// This widget will be removed in GTK 5
278    /// ## `context_id`
279    /// a context identifier
280    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
281    #[allow(deprecated)]
282    #[doc(alias = "gtk_statusbar_pop")]
283    pub fn pop(&self, context_id: u32) {
284        unsafe {
285            ffi::gtk_statusbar_pop(self.to_glib_none().0, context_id);
286        }
287    }
288
289    /// Pushes a new message onto a statusbar’s stack.
290    ///
291    /// # Deprecated since 4.10
292    ///
293    /// This widget will be removed in GTK 5
294    /// ## `context_id`
295    /// the message’s context id, as returned by
296    ///    gtk_statusbar_get_context_id()
297    /// ## `text`
298    /// the message to add to the statusbar
299    ///
300    /// # Returns
301    ///
302    /// a message id that can be used with
303    ///   [`remove()`][Self::remove()].
304    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
305    #[allow(deprecated)]
306    #[doc(alias = "gtk_statusbar_push")]
307    pub fn push(&self, context_id: u32, text: &str) -> u32 {
308        unsafe { ffi::gtk_statusbar_push(self.to_glib_none().0, context_id, text.to_glib_none().0) }
309    }
310
311    /// Forces the removal of a message from a statusbar’s stack.
312    /// The exact @context_id and @message_id must be specified.
313    ///
314    /// # Deprecated since 4.10
315    ///
316    /// This widget will be removed in GTK 5
317    /// ## `context_id`
318    /// a context identifier
319    /// ## `message_id`
320    /// a message identifier, as returned by [`push()`][Self::push()]
321    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
322    #[allow(deprecated)]
323    #[doc(alias = "gtk_statusbar_remove")]
324    pub fn remove(&self, context_id: u32, message_id: u32) {
325        unsafe {
326            ffi::gtk_statusbar_remove(self.to_glib_none().0, context_id, message_id);
327        }
328    }
329
330    /// Forces the removal of all messages from a statusbar's
331    /// stack with the exact @context_id.
332    ///
333    /// # Deprecated since 4.10
334    ///
335    /// This widget will be removed in GTK 5
336    /// ## `context_id`
337    /// a context identifier
338    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
339    #[allow(deprecated)]
340    #[doc(alias = "gtk_statusbar_remove_all")]
341    pub fn remove_all(&self, context_id: u32) {
342        unsafe {
343            ffi::gtk_statusbar_remove_all(self.to_glib_none().0, context_id);
344        }
345    }
346
347    /// Emitted whenever a new message is popped off a statusbar's stack.
348    ///
349    /// # Deprecated since 4.10
350    ///
351    /// This widget will be removed in GTK 5
352    /// ## `context_id`
353    /// the context id of the relevant message/statusbar
354    /// ## `text`
355    /// the message that was just popped
356    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
357    #[doc(alias = "text-popped")]
358    pub fn connect_text_popped<F: Fn(&Self, u32, &str) + 'static>(&self, f: F) -> SignalHandlerId {
359        unsafe extern "C" fn text_popped_trampoline<F: Fn(&Statusbar, u32, &str) + 'static>(
360            this: *mut ffi::GtkStatusbar,
361            context_id: std::ffi::c_uint,
362            text: *mut std::ffi::c_char,
363            f: glib::ffi::gpointer,
364        ) {
365            let f: &F = &*(f as *const F);
366            f(
367                &from_glib_borrow(this),
368                context_id,
369                &glib::GString::from_glib_borrow(text),
370            )
371        }
372        unsafe {
373            let f: Box_<F> = Box_::new(f);
374            connect_raw(
375                self.as_ptr() as *mut _,
376                c"text-popped".as_ptr() as *const _,
377                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
378                    text_popped_trampoline::<F> as *const (),
379                )),
380                Box_::into_raw(f),
381            )
382        }
383    }
384
385    /// Emitted whenever a new message gets pushed onto a statusbar's stack.
386    ///
387    /// # Deprecated since 4.10
388    ///
389    /// This widget will be removed in GTK 5
390    /// ## `context_id`
391    /// the context id of the relevant message/statusbar
392    /// ## `text`
393    /// the message that was pushed
394    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
395    #[doc(alias = "text-pushed")]
396    pub fn connect_text_pushed<F: Fn(&Self, u32, &str) + 'static>(&self, f: F) -> SignalHandlerId {
397        unsafe extern "C" fn text_pushed_trampoline<F: Fn(&Statusbar, u32, &str) + 'static>(
398            this: *mut ffi::GtkStatusbar,
399            context_id: std::ffi::c_uint,
400            text: *mut std::ffi::c_char,
401            f: glib::ffi::gpointer,
402        ) {
403            let f: &F = &*(f as *const F);
404            f(
405                &from_glib_borrow(this),
406                context_id,
407                &glib::GString::from_glib_borrow(text),
408            )
409        }
410        unsafe {
411            let f: Box_<F> = Box_::new(f);
412            connect_raw(
413                self.as_ptr() as *mut _,
414                c"text-pushed".as_ptr() as *const _,
415                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
416                    text_pushed_trampoline::<F> as *const (),
417                )),
418                Box_::into_raw(f),
419            )
420        }
421    }
422}
423
424impl Default for Statusbar {
425    fn default() -> Self {
426        Self::new()
427    }
428}
429
430// rustdoc-stripper-ignore-next
431/// A [builder-pattern] type to construct [`Statusbar`] objects.
432///
433/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
434#[must_use = "The builder must be built to be used"]
435pub struct StatusbarBuilder {
436    builder: glib::object::ObjectBuilder<'static, Statusbar>,
437}
438
439impl StatusbarBuilder {
440    fn new() -> Self {
441        Self {
442            builder: glib::object::Object::builder(),
443        }
444    }
445
446    /// Whether the widget or any of its descendents can accept
447    /// the input focus.
448    ///
449    /// This property is meant to be set by widget implementations,
450    /// typically in their instance init function.
451    pub fn can_focus(self, can_focus: bool) -> Self {
452        Self {
453            builder: self.builder.property("can-focus", can_focus),
454        }
455    }
456
457    /// Whether the widget can receive pointer events.
458    pub fn can_target(self, can_target: bool) -> Self {
459        Self {
460            builder: self.builder.property("can-target", can_target),
461        }
462    }
463
464    /// A list of css classes applied to this widget.
465    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
466        Self {
467            builder: self.builder.property("css-classes", css_classes.into()),
468        }
469    }
470
471    /// The name of this widget in the CSS tree.
472    ///
473    /// This property is meant to be set by widget implementations,
474    /// typically in their instance init function.
475    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
476        Self {
477            builder: self.builder.property("css-name", css_name.into()),
478        }
479    }
480
481    /// The cursor used by @widget.
482    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
483        Self {
484            builder: self.builder.property("cursor", cursor.clone()),
485        }
486    }
487
488    /// Whether the widget should grab focus when it is clicked with the mouse.
489    ///
490    /// This property is only relevant for widgets that can take focus.
491    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
492        Self {
493            builder: self.builder.property("focus-on-click", focus_on_click),
494        }
495    }
496
497    /// Whether this widget itself will accept the input focus.
498    pub fn focusable(self, focusable: bool) -> Self {
499        Self {
500            builder: self.builder.property("focusable", focusable),
501        }
502    }
503
504    /// How to distribute horizontal space if widget gets extra space.
505    pub fn halign(self, halign: Align) -> Self {
506        Self {
507            builder: self.builder.property("halign", halign),
508        }
509    }
510
511    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
512    /// signal on @widget.
513    ///
514    /// A true value indicates that @widget can have a tooltip, in this case
515    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
516    /// determine whether it will provide a tooltip or not.
517    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
518        Self {
519            builder: self.builder.property("has-tooltip", has_tooltip),
520        }
521    }
522
523    /// Overrides for height request of the widget.
524    ///
525    /// If this is -1, the natural request will be used.
526    pub fn height_request(self, height_request: i32) -> Self {
527        Self {
528            builder: self.builder.property("height-request", height_request),
529        }
530    }
531
532    /// Whether to expand horizontally.
533    pub fn hexpand(self, hexpand: bool) -> Self {
534        Self {
535            builder: self.builder.property("hexpand", hexpand),
536        }
537    }
538
539    /// Whether to use the `hexpand` property.
540    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
541        Self {
542            builder: self.builder.property("hexpand-set", hexpand_set),
543        }
544    }
545
546    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
547    /// the preferred size of the widget, and allocate its children.
548    ///
549    /// This property is meant to be set by widget implementations,
550    /// typically in their instance init function.
551    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
552        Self {
553            builder: self
554                .builder
555                .property("layout-manager", layout_manager.clone().upcast()),
556        }
557    }
558
559    /// Makes this widget act like a modal dialog, with respect to
560    /// event delivery.
561    ///
562    /// Global event controllers will not handle events with targets
563    /// inside the widget, unless they are set up to ignore propagation
564    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
565    #[cfg(feature = "v4_18")]
566    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
567    pub fn limit_events(self, limit_events: bool) -> Self {
568        Self {
569            builder: self.builder.property("limit-events", limit_events),
570        }
571    }
572
573    /// Margin on bottom side of widget.
574    ///
575    /// This property adds margin outside of the widget's normal size
576    /// request, the margin will be added in addition to the size from
577    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
578    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
579        Self {
580            builder: self.builder.property("margin-bottom", margin_bottom),
581        }
582    }
583
584    /// Margin on end of widget, horizontally.
585    ///
586    /// This property supports left-to-right and right-to-left text
587    /// directions.
588    ///
589    /// This property adds margin outside of the widget's normal size
590    /// request, the margin will be added in addition to the size from
591    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
592    pub fn margin_end(self, margin_end: i32) -> Self {
593        Self {
594            builder: self.builder.property("margin-end", margin_end),
595        }
596    }
597
598    /// Margin on start of widget, horizontally.
599    ///
600    /// This property supports left-to-right and right-to-left text
601    /// directions.
602    ///
603    /// This property adds margin outside of the widget's normal size
604    /// request, the margin will be added in addition to the size from
605    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
606    pub fn margin_start(self, margin_start: i32) -> Self {
607        Self {
608            builder: self.builder.property("margin-start", margin_start),
609        }
610    }
611
612    /// Margin on top side of widget.
613    ///
614    /// This property adds margin outside of the widget's normal size
615    /// request, the margin will be added in addition to the size from
616    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
617    pub fn margin_top(self, margin_top: i32) -> Self {
618        Self {
619            builder: self.builder.property("margin-top", margin_top),
620        }
621    }
622
623    /// The name of the widget.
624    pub fn name(self, name: impl Into<glib::GString>) -> Self {
625        Self {
626            builder: self.builder.property("name", name.into()),
627        }
628    }
629
630    /// The requested opacity of the widget.
631    pub fn opacity(self, opacity: f64) -> Self {
632        Self {
633            builder: self.builder.property("opacity", opacity),
634        }
635    }
636
637    /// How content outside the widget's content area is treated.
638    ///
639    /// This property is meant to be set by widget implementations,
640    /// typically in their instance init function.
641    pub fn overflow(self, overflow: Overflow) -> Self {
642        Self {
643            builder: self.builder.property("overflow", overflow),
644        }
645    }
646
647    /// Whether the widget will receive the default action when it is focused.
648    pub fn receives_default(self, receives_default: bool) -> Self {
649        Self {
650            builder: self.builder.property("receives-default", receives_default),
651        }
652    }
653
654    /// Whether the widget responds to input.
655    pub fn sensitive(self, sensitive: bool) -> Self {
656        Self {
657            builder: self.builder.property("sensitive", sensitive),
658        }
659    }
660
661    /// Sets the text of tooltip to be the given string, which is marked up
662    /// with Pango markup.
663    ///
664    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
665    ///
666    /// This is a convenience property which will take care of getting the
667    /// tooltip shown if the given string is not `NULL`:
668    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
669    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
670    /// the default signal handler.
671    ///
672    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
673    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
674    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
675        Self {
676            builder: self
677                .builder
678                .property("tooltip-markup", tooltip_markup.into()),
679        }
680    }
681
682    /// Sets the text of tooltip to be the given string.
683    ///
684    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
685    ///
686    /// This is a convenience property which will take care of getting the
687    /// tooltip shown if the given string is not `NULL`:
688    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
689    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
690    /// the default signal handler.
691    ///
692    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
693    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
694    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
695        Self {
696            builder: self.builder.property("tooltip-text", tooltip_text.into()),
697        }
698    }
699
700    /// How to distribute vertical space if widget gets extra space.
701    pub fn valign(self, valign: Align) -> Self {
702        Self {
703            builder: self.builder.property("valign", valign),
704        }
705    }
706
707    /// Whether to expand vertically.
708    pub fn vexpand(self, vexpand: bool) -> Self {
709        Self {
710            builder: self.builder.property("vexpand", vexpand),
711        }
712    }
713
714    /// Whether to use the `vexpand` property.
715    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
716        Self {
717            builder: self.builder.property("vexpand-set", vexpand_set),
718        }
719    }
720
721    /// Whether the widget is visible.
722    pub fn visible(self, visible: bool) -> Self {
723        Self {
724            builder: self.builder.property("visible", visible),
725        }
726    }
727
728    /// Overrides for width request of the widget.
729    ///
730    /// If this is -1, the natural request will be used.
731    pub fn width_request(self, width_request: i32) -> Self {
732        Self {
733            builder: self.builder.property("width-request", width_request),
734        }
735    }
736
737    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
738    ///
739    /// The accessible role cannot be changed once set.
740    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
741        Self {
742            builder: self.builder.property("accessible-role", accessible_role),
743        }
744    }
745
746    // rustdoc-stripper-ignore-next
747    /// Build the [`Statusbar`].
748    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
749    pub fn build(self) -> Statusbar {
750        assert_initialized_main_thread!();
751        self.builder.build()
752    }
753}