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