Skip to main content

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    Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, LayoutManager, Overflow,
8    Widget, ffi,
9};
10use glib::{
11    object::ObjectType as _,
12    prelude::*,
13    signal::{SignalHandlerId, connect_raw},
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            unsafe {
366                let f: &F = &*(f as *const F);
367                f(
368                    &from_glib_borrow(this),
369                    context_id,
370                    &glib::GString::from_glib_borrow(text),
371                )
372            }
373        }
374        unsafe {
375            let f: Box_<F> = Box_::new(f);
376            connect_raw(
377                self.as_ptr() as *mut _,
378                c"text-popped".as_ptr() as *const _,
379                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
380                    text_popped_trampoline::<F> as *const (),
381                )),
382                Box_::into_raw(f),
383            )
384        }
385    }
386
387    /// Emitted whenever a new message gets pushed onto a statusbar's stack.
388    ///
389    /// # Deprecated since 4.10
390    ///
391    /// This widget will be removed in GTK 5
392    /// ## `context_id`
393    /// the context id of the relevant message/statusbar
394    /// ## `text`
395    /// the message that was pushed
396    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
397    #[doc(alias = "text-pushed")]
398    pub fn connect_text_pushed<F: Fn(&Self, u32, &str) + 'static>(&self, f: F) -> SignalHandlerId {
399        unsafe extern "C" fn text_pushed_trampoline<F: Fn(&Statusbar, u32, &str) + 'static>(
400            this: *mut ffi::GtkStatusbar,
401            context_id: std::ffi::c_uint,
402            text: *mut std::ffi::c_char,
403            f: glib::ffi::gpointer,
404        ) {
405            unsafe {
406                let f: &F = &*(f as *const F);
407                f(
408                    &from_glib_borrow(this),
409                    context_id,
410                    &glib::GString::from_glib_borrow(text),
411                )
412            }
413        }
414        unsafe {
415            let f: Box_<F> = Box_::new(f);
416            connect_raw(
417                self.as_ptr() as *mut _,
418                c"text-pushed".as_ptr() as *const _,
419                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
420                    text_pushed_trampoline::<F> as *const (),
421                )),
422                Box_::into_raw(f),
423            )
424        }
425    }
426}
427
428impl Default for Statusbar {
429    fn default() -> Self {
430        Self::new()
431    }
432}
433
434// rustdoc-stripper-ignore-next
435/// A [builder-pattern] type to construct [`Statusbar`] objects.
436///
437/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
438#[must_use = "The builder must be built to be used"]
439pub struct StatusbarBuilder {
440    builder: glib::object::ObjectBuilder<'static, Statusbar>,
441}
442
443impl StatusbarBuilder {
444    fn new() -> Self {
445        Self {
446            builder: glib::object::Object::builder(),
447        }
448    }
449
450    /// Whether the widget or any of its descendents can accept
451    /// the input focus.
452    ///
453    /// This property is meant to be set by widget implementations,
454    /// typically in their instance init function.
455    pub fn can_focus(self, can_focus: bool) -> Self {
456        Self {
457            builder: self.builder.property("can-focus", can_focus),
458        }
459    }
460
461    /// Whether the widget can receive pointer events.
462    pub fn can_target(self, can_target: bool) -> Self {
463        Self {
464            builder: self.builder.property("can-target", can_target),
465        }
466    }
467
468    /// A list of css classes applied to this widget.
469    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
470        Self {
471            builder: self.builder.property("css-classes", css_classes.into()),
472        }
473    }
474
475    /// The name of this widget in the CSS tree.
476    ///
477    /// This property is meant to be set by widget implementations,
478    /// typically in their instance init function.
479    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
480        Self {
481            builder: self.builder.property("css-name", css_name.into()),
482        }
483    }
484
485    /// The cursor used by @widget.
486    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
487        Self {
488            builder: self.builder.property("cursor", cursor.clone()),
489        }
490    }
491
492    /// Whether the widget should grab focus when it is clicked with the mouse.
493    ///
494    /// This property is only relevant for widgets that can take focus.
495    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
496        Self {
497            builder: self.builder.property("focus-on-click", focus_on_click),
498        }
499    }
500
501    /// Whether this widget itself will accept the input focus.
502    pub fn focusable(self, focusable: bool) -> Self {
503        Self {
504            builder: self.builder.property("focusable", focusable),
505        }
506    }
507
508    /// How to distribute horizontal space if widget gets extra space.
509    pub fn halign(self, halign: Align) -> Self {
510        Self {
511            builder: self.builder.property("halign", halign),
512        }
513    }
514
515    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
516    /// signal on @widget.
517    ///
518    /// A true value indicates that @widget can have a tooltip, in this case
519    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
520    /// determine whether it will provide a tooltip or not.
521    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
522        Self {
523            builder: self.builder.property("has-tooltip", has_tooltip),
524        }
525    }
526
527    /// Overrides for height request of the widget.
528    ///
529    /// If this is -1, the natural request will be used.
530    pub fn height_request(self, height_request: i32) -> Self {
531        Self {
532            builder: self.builder.property("height-request", height_request),
533        }
534    }
535
536    /// Whether to expand horizontally.
537    pub fn hexpand(self, hexpand: bool) -> Self {
538        Self {
539            builder: self.builder.property("hexpand", hexpand),
540        }
541    }
542
543    /// Whether to use the `hexpand` property.
544    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
545        Self {
546            builder: self.builder.property("hexpand-set", hexpand_set),
547        }
548    }
549
550    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
551    /// the preferred size of the widget, and allocate its children.
552    ///
553    /// This property is meant to be set by widget implementations,
554    /// typically in their instance init function.
555    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
556        Self {
557            builder: self
558                .builder
559                .property("layout-manager", layout_manager.clone().upcast()),
560        }
561    }
562
563    /// Makes this widget act like a modal dialog, with respect to
564    /// event delivery.
565    ///
566    /// Global event controllers will not handle events with targets
567    /// inside the widget, unless they are set up to ignore propagation
568    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
569    #[cfg(feature = "v4_18")]
570    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
571    pub fn limit_events(self, limit_events: bool) -> Self {
572        Self {
573            builder: self.builder.property("limit-events", limit_events),
574        }
575    }
576
577    /// Margin on bottom side of widget.
578    ///
579    /// This property adds margin outside of the widget's normal size
580    /// request, the margin will be added in addition to the size from
581    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
582    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
583        Self {
584            builder: self.builder.property("margin-bottom", margin_bottom),
585        }
586    }
587
588    /// Margin on end of widget, horizontally.
589    ///
590    /// This property supports left-to-right and right-to-left text
591    /// directions.
592    ///
593    /// This property adds margin outside of the widget's normal size
594    /// request, the margin will be added in addition to the size from
595    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
596    pub fn margin_end(self, margin_end: i32) -> Self {
597        Self {
598            builder: self.builder.property("margin-end", margin_end),
599        }
600    }
601
602    /// Margin on start of widget, horizontally.
603    ///
604    /// This property supports left-to-right and right-to-left text
605    /// directions.
606    ///
607    /// This property adds margin outside of the widget's normal size
608    /// request, the margin will be added in addition to the size from
609    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
610    pub fn margin_start(self, margin_start: i32) -> Self {
611        Self {
612            builder: self.builder.property("margin-start", margin_start),
613        }
614    }
615
616    /// Margin on top side of widget.
617    ///
618    /// This property adds margin outside of the widget's normal size
619    /// request, the margin will be added in addition to the size from
620    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
621    pub fn margin_top(self, margin_top: i32) -> Self {
622        Self {
623            builder: self.builder.property("margin-top", margin_top),
624        }
625    }
626
627    /// The name of the widget.
628    pub fn name(self, name: impl Into<glib::GString>) -> Self {
629        Self {
630            builder: self.builder.property("name", name.into()),
631        }
632    }
633
634    /// The requested opacity of the widget.
635    pub fn opacity(self, opacity: f64) -> Self {
636        Self {
637            builder: self.builder.property("opacity", opacity),
638        }
639    }
640
641    /// How content outside the widget's content area is treated.
642    ///
643    /// This property is meant to be set by widget implementations,
644    /// typically in their instance init function.
645    pub fn overflow(self, overflow: Overflow) -> Self {
646        Self {
647            builder: self.builder.property("overflow", overflow),
648        }
649    }
650
651    /// Whether the widget will receive the default action when it is focused.
652    pub fn receives_default(self, receives_default: bool) -> Self {
653        Self {
654            builder: self.builder.property("receives-default", receives_default),
655        }
656    }
657
658    /// Whether the widget responds to input.
659    pub fn sensitive(self, sensitive: bool) -> Self {
660        Self {
661            builder: self.builder.property("sensitive", sensitive),
662        }
663    }
664
665    /// Sets the text of tooltip to be the given string, which is marked up
666    /// with Pango markup.
667    ///
668    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
669    ///
670    /// This is a convenience property which will take care of getting the
671    /// tooltip shown if the given string is not `NULL`:
672    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
673    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
674    /// the default signal handler.
675    ///
676    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
677    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
678    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
679        Self {
680            builder: self
681                .builder
682                .property("tooltip-markup", tooltip_markup.into()),
683        }
684    }
685
686    /// Sets the text of tooltip to be the given string.
687    ///
688    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
689    ///
690    /// This is a convenience property which will take care of getting the
691    /// tooltip shown if the given string is not `NULL`:
692    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
693    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
694    /// the default signal handler.
695    ///
696    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
697    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
698    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
699        Self {
700            builder: self.builder.property("tooltip-text", tooltip_text.into()),
701        }
702    }
703
704    /// How to distribute vertical space if widget gets extra space.
705    pub fn valign(self, valign: Align) -> Self {
706        Self {
707            builder: self.builder.property("valign", valign),
708        }
709    }
710
711    /// Whether to expand vertically.
712    pub fn vexpand(self, vexpand: bool) -> Self {
713        Self {
714            builder: self.builder.property("vexpand", vexpand),
715        }
716    }
717
718    /// Whether to use the `vexpand` property.
719    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
720        Self {
721            builder: self.builder.property("vexpand-set", vexpand_set),
722        }
723    }
724
725    /// Whether the widget is visible.
726    pub fn visible(self, visible: bool) -> Self {
727        Self {
728            builder: self.builder.property("visible", visible),
729        }
730    }
731
732    /// Overrides for width request of the widget.
733    ///
734    /// If this is -1, the natural request will be used.
735    pub fn width_request(self, width_request: i32) -> Self {
736        Self {
737            builder: self.builder.property("width-request", width_request),
738        }
739    }
740
741    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
742    ///
743    /// The accessible role cannot be changed once set.
744    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
745        Self {
746            builder: self.builder.property("accessible-role", accessible_role),
747        }
748    }
749
750    // rustdoc-stripper-ignore-next
751    /// Build the [`Statusbar`].
752    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
753    pub fn build(self) -> Statusbar {
754        assert_initialized_main_thread!();
755        self.builder.build()
756    }
757}