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