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