gtk4/auto/
info_bar.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, Button, ConstraintTarget, LayoutManager,
8    MessageType, Overflow, ResponseType, 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    /// There is no replacement in GTK for an "info bar" widget;
20    ///   you can use [`Revealer`][crate::Revealer] with a [`Box`][crate::Box] containing a
21    ///   [`Label`][crate::Label] and an optional [`Button`][crate::Button], according to
22    ///   your application's design.
23    /// [`InfoBar`][crate::InfoBar] can be used to show messages to the user without a dialog.
24    ///
25    /// <picture>
26    ///   <source srcset="info-bar-dark.png" media="(prefers-color-scheme: dark)">
27    ///   <img alt="An example GtkInfoBar" src="info-bar.png">
28    /// </picture>
29    ///
30    /// It is often temporarily shown at the top or bottom of a document.
31    /// In contrast to [`Dialog`][crate::Dialog], which has an action area at the
32    /// bottom, [`InfoBar`][crate::InfoBar] has an action area at the side.
33    ///
34    /// The API of [`InfoBar`][crate::InfoBar] is very similar to [`Dialog`][crate::Dialog], allowing you
35    /// to add buttons to the action area with [`add_button()`][Self::add_button()]
36    /// or [`with_buttons()`][Self::with_buttons()]. The sensitivity of action widgets
37    /// can be controlled with [`set_response_sensitive()`][Self::set_response_sensitive()].
38    ///
39    /// To add widgets to the main content area of a [`InfoBar`][crate::InfoBar], use
40    /// [`add_child()`][Self::add_child()].
41    ///
42    /// Similar to [`MessageDialog`][crate::MessageDialog], the contents of a [`InfoBar`][crate::InfoBar]
43    /// can by classified as error message, warning, informational message, etc,
44    /// by using [`set_message_type()`][Self::set_message_type()]. GTK may use the message
45    /// type to determine how the message is displayed.
46    ///
47    /// A simple example for using a [`InfoBar`][crate::InfoBar]:
48    /// **⚠️ The following code is in c ⚠️**
49    ///
50    /// ```c
51    /// GtkWidget *message_label;
52    /// GtkWidget *widget;
53    /// GtkWidget *grid;
54    /// GtkInfoBar *bar;
55    ///
56    /// // set up info bar
57    /// widget = gtk_info_bar_new ();
58    /// bar = GTK_INFO_BAR (widget);
59    /// grid = gtk_grid_new ();
60    ///
61    /// message_label = gtk_label_new ("");
62    /// gtk_info_bar_add_child (bar, message_label);
63    /// gtk_info_bar_add_button (bar,
64    ///                          _("_OK"),
65    ///                          GTK_RESPONSE_OK);
66    /// g_signal_connect (bar,
67    ///                   "response",
68    ///                   G_CALLBACK (gtk_widget_hide),
69    ///                   NULL);
70    /// gtk_grid_attach (GTK_GRID (grid),
71    ///                  widget,
72    ///                  0, 2, 1, 1);
73    ///
74    /// // ...
75    ///
76    /// // show an error message
77    /// gtk_label_set_text (GTK_LABEL (message_label), "An error occurred!");
78    /// gtk_info_bar_set_message_type (bar, GTK_MESSAGE_ERROR);
79    /// gtk_widget_show (bar);
80    /// ```
81    ///
82    /// # GtkInfoBar as GtkBuildable
83    ///
84    /// [`InfoBar`][crate::InfoBar] supports a custom `<action-widgets>` element, which can contain
85    /// multiple `<action-widget>` elements. The “response” attribute specifies a
86    /// numeric response, and the content of the element is the id of widget
87    /// (which should be a child of the dialogs @action_area).
88    ///
89    /// [`InfoBar`][crate::InfoBar] supports adding action widgets by specifying “action” as
90    /// the “type” attribute of a `<child>` element. The widget will be added
91    /// either to the action area. The response id has to be associated
92    /// with the action widget using the `<action-widgets>` element.
93    ///
94    /// # CSS nodes
95    ///
96    /// [`InfoBar`][crate::InfoBar] has a single CSS node with name infobar. The node may get
97    /// one of the style classes .info, .warning, .error or .question, depending
98    /// on the message type.
99    /// If the info bar shows a close button, that button will have the .close
100    /// style class applied.
101    ///
102    /// ## Properties
103    ///
104    ///
105    /// #### `message-type`
106    ///  The type of the message.
107    ///
108    /// The type may be used to determine the appearance of the info bar.
109    ///
110    /// Readable | Writeable | Construct
111    ///
112    ///
113    /// #### `revealed`
114    ///  Whether the info bar shows its contents.
115    ///
116    /// Readable | Writeable
117    ///
118    ///
119    /// #### `show-close-button`
120    ///  Whether to include a standard close button.
121    ///
122    /// Readable | Writeable | Construct
123    /// <details><summary><h4>Widget</h4></summary>
124    ///
125    ///
126    /// #### `can-focus`
127    ///  Whether the widget or any of its descendents can accept
128    /// the input focus.
129    ///
130    /// This property is meant to be set by widget implementations,
131    /// typically in their instance init function.
132    ///
133    /// Readable | Writeable
134    ///
135    ///
136    /// #### `can-target`
137    ///  Whether the widget can receive pointer events.
138    ///
139    /// Readable | Writeable
140    ///
141    ///
142    /// #### `css-classes`
143    ///  A list of css classes applied to this widget.
144    ///
145    /// Readable | Writeable
146    ///
147    ///
148    /// #### `css-name`
149    ///  The name of this widget in the CSS tree.
150    ///
151    /// This property is meant to be set by widget implementations,
152    /// typically in their instance init function.
153    ///
154    /// Readable | Writeable | Construct Only
155    ///
156    ///
157    /// #### `cursor`
158    ///  The cursor used by @widget.
159    ///
160    /// Readable | Writeable
161    ///
162    ///
163    /// #### `focus-on-click`
164    ///  Whether the widget should grab focus when it is clicked with the mouse.
165    ///
166    /// This property is only relevant for widgets that can take focus.
167    ///
168    /// Readable | Writeable
169    ///
170    ///
171    /// #### `focusable`
172    ///  Whether this widget itself will accept the input focus.
173    ///
174    /// Readable | Writeable
175    ///
176    ///
177    /// #### `halign`
178    ///  How to distribute horizontal space if widget gets extra space.
179    ///
180    /// Readable | Writeable
181    ///
182    ///
183    /// #### `has-default`
184    ///  Whether the widget is the default widget.
185    ///
186    /// Readable
187    ///
188    ///
189    /// #### `has-focus`
190    ///  Whether the widget has the input focus.
191    ///
192    /// Readable
193    ///
194    ///
195    /// #### `has-tooltip`
196    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
197    /// signal on @widget.
198    ///
199    /// A true value indicates that @widget can have a tooltip, in this case
200    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
201    /// determine whether it will provide a tooltip or not.
202    ///
203    /// Readable | Writeable
204    ///
205    ///
206    /// #### `height-request`
207    ///  Overrides for height request of the widget.
208    ///
209    /// If this is -1, the natural request will be used.
210    ///
211    /// Readable | Writeable
212    ///
213    ///
214    /// #### `hexpand`
215    ///  Whether to expand horizontally.
216    ///
217    /// Readable | Writeable
218    ///
219    ///
220    /// #### `hexpand-set`
221    ///  Whether to use the `hexpand` property.
222    ///
223    /// Readable | Writeable
224    ///
225    ///
226    /// #### `layout-manager`
227    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
228    /// the preferred size of the widget, and allocate its children.
229    ///
230    /// This property is meant to be set by widget implementations,
231    /// typically in their instance init function.
232    ///
233    /// Readable | Writeable
234    ///
235    ///
236    /// #### `limit-events`
237    ///  Makes this widget act like a modal dialog, with respect to
238    /// event delivery.
239    ///
240    /// Global event controllers will not handle events with targets
241    /// inside the widget, unless they are set up to ignore propagation
242    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
243    ///
244    /// Readable | Writeable
245    ///
246    ///
247    /// #### `margin-bottom`
248    ///  Margin on bottom side of widget.
249    ///
250    /// This property adds margin outside of the widget's normal size
251    /// request, the margin will be added in addition to the size from
252    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
253    ///
254    /// Readable | Writeable
255    ///
256    ///
257    /// #### `margin-end`
258    ///  Margin on end of widget, horizontally.
259    ///
260    /// This property supports left-to-right and right-to-left text
261    /// directions.
262    ///
263    /// This property adds margin outside of the widget's normal size
264    /// request, the margin will be added in addition to the size from
265    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
266    ///
267    /// Readable | Writeable
268    ///
269    ///
270    /// #### `margin-start`
271    ///  Margin on start of widget, horizontally.
272    ///
273    /// This property supports left-to-right and right-to-left text
274    /// directions.
275    ///
276    /// This property adds margin outside of the widget's normal size
277    /// request, the margin will be added in addition to the size from
278    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
279    ///
280    /// Readable | Writeable
281    ///
282    ///
283    /// #### `margin-top`
284    ///  Margin on top side of widget.
285    ///
286    /// This property adds margin outside of the widget's normal size
287    /// request, the margin will be added in addition to the size from
288    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
289    ///
290    /// Readable | Writeable
291    ///
292    ///
293    /// #### `name`
294    ///  The name of the widget.
295    ///
296    /// Readable | Writeable
297    ///
298    ///
299    /// #### `opacity`
300    ///  The requested opacity of the widget.
301    ///
302    /// Readable | Writeable
303    ///
304    ///
305    /// #### `overflow`
306    ///  How content outside the widget's content area is treated.
307    ///
308    /// This property is meant to be set by widget implementations,
309    /// typically in their instance init function.
310    ///
311    /// Readable | Writeable
312    ///
313    ///
314    /// #### `parent`
315    ///  The parent widget of this widget.
316    ///
317    /// Readable
318    ///
319    ///
320    /// #### `receives-default`
321    ///  Whether the widget will receive the default action when it is focused.
322    ///
323    /// Readable | Writeable
324    ///
325    ///
326    /// #### `root`
327    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
328    ///
329    /// This will be `NULL` if the widget is not contained in a root widget.
330    ///
331    /// Readable
332    ///
333    ///
334    /// #### `scale-factor`
335    ///  The scale factor of the widget.
336    ///
337    /// Readable
338    ///
339    ///
340    /// #### `sensitive`
341    ///  Whether the widget responds to input.
342    ///
343    /// Readable | Writeable
344    ///
345    ///
346    /// #### `tooltip-markup`
347    ///  Sets the text of tooltip to be the given string, which is marked up
348    /// with Pango markup.
349    ///
350    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
351    ///
352    /// This is a convenience property which will take care of getting the
353    /// tooltip shown if the given string is not `NULL`:
354    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
355    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
356    /// the default signal handler.
357    ///
358    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
359    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
360    ///
361    /// Readable | Writeable
362    ///
363    ///
364    /// #### `tooltip-text`
365    ///  Sets the text of tooltip to be the given string.
366    ///
367    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
368    ///
369    /// This is a convenience property which will take care of getting the
370    /// tooltip shown if the given string is not `NULL`:
371    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
372    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
373    /// the default signal handler.
374    ///
375    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
376    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
377    ///
378    /// Readable | Writeable
379    ///
380    ///
381    /// #### `valign`
382    ///  How to distribute vertical space if widget gets extra space.
383    ///
384    /// Readable | Writeable
385    ///
386    ///
387    /// #### `vexpand`
388    ///  Whether to expand vertically.
389    ///
390    /// Readable | Writeable
391    ///
392    ///
393    /// #### `vexpand-set`
394    ///  Whether to use the `vexpand` property.
395    ///
396    /// Readable | Writeable
397    ///
398    ///
399    /// #### `visible`
400    ///  Whether the widget is visible.
401    ///
402    /// Readable | Writeable
403    ///
404    ///
405    /// #### `width-request`
406    ///  Overrides for width request of the widget.
407    ///
408    /// If this is -1, the natural request will be used.
409    ///
410    /// Readable | Writeable
411    /// </details>
412    /// <details><summary><h4>Accessible</h4></summary>
413    ///
414    ///
415    /// #### `accessible-role`
416    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
417    ///
418    /// The accessible role cannot be changed once set.
419    ///
420    /// Readable | Writeable
421    /// </details>
422    ///
423    /// ## Signals
424    ///
425    ///
426    /// #### `close`
427    ///  Gets emitted when the user uses a keybinding to dismiss the info bar.
428    ///
429    /// The ::close signal is a [keybinding signal](class.SignalAction.html).
430    ///
431    /// The default binding for this signal is the Escape key.
432    ///
433    /// Action
434    ///
435    ///
436    /// #### `response`
437    ///  Emitted when an action widget is clicked.
438    ///
439    /// The signal is also emitted when the application programmer
440    /// calls [`InfoBar::response()`][crate::InfoBar::response()]. The @response_id depends
441    /// on which action widget was clicked.
442    ///
443    ///
444    /// <details><summary><h4>Widget</h4></summary>
445    ///
446    ///
447    /// #### `destroy`
448    ///  Signals that all holders of a reference to the widget should release
449    /// the reference that they hold.
450    ///
451    /// May result in finalization of the widget if all references are released.
452    ///
453    /// This signal is not suitable for saving widget state.
454    ///
455    ///
456    ///
457    ///
458    /// #### `direction-changed`
459    ///  Emitted when the text direction of a widget changes.
460    ///
461    ///
462    ///
463    ///
464    /// #### `hide`
465    ///  Emitted when @widget is hidden.
466    ///
467    ///
468    ///
469    ///
470    /// #### `keynav-failed`
471    ///  Emitted if keyboard navigation fails.
472    ///
473    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
474    ///
475    ///
476    ///
477    ///
478    /// #### `map`
479    ///  Emitted when @widget is going to be mapped.
480    ///
481    /// A widget is mapped when the widget is visible (which is controlled with
482    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
483    /// are also visible.
484    ///
485    /// The `::map` signal can be used to determine whether a widget will be drawn,
486    /// for instance it can resume an animation that was stopped during the
487    /// emission of [`unmap`][struct@crate::Widget#unmap].
488    ///
489    ///
490    ///
491    ///
492    /// #### `mnemonic-activate`
493    ///  Emitted when a widget is activated via a mnemonic.
494    ///
495    /// The default handler for this signal activates @widget if @group_cycling
496    /// is false, or just makes @widget grab focus if @group_cycling is true.
497    ///
498    ///
499    ///
500    ///
501    /// #### `move-focus`
502    ///  Emitted when the focus is moved.
503    ///
504    /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
505    ///
506    /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
507    /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
508    ///
509    /// Action
510    ///
511    ///
512    /// #### `query-tooltip`
513    ///  Emitted when the widget’s tooltip is about to be shown.
514    ///
515    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
516    /// is true and the hover timeout has expired with the cursor hovering
517    /// above @widget; or emitted when @widget got focus in keyboard mode.
518    ///
519    /// Using the given coordinates, the signal handler should determine
520    /// whether a tooltip should be shown for @widget. If this is the case
521    /// true should be returned, false otherwise. Note that if @keyboard_mode
522    /// is true, the values of @x and @y are undefined and should not be used.
523    ///
524    /// The signal handler is free to manipulate @tooltip with the therefore
525    /// destined function calls.
526    ///
527    ///
528    ///
529    ///
530    /// #### `realize`
531    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
532    ///
533    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
534    /// or the widget has been mapped (that is, it is going to be drawn).
535    ///
536    ///
537    ///
538    ///
539    /// #### `show`
540    ///  Emitted when @widget is shown.
541    ///
542    ///
543    ///
544    ///
545    /// #### `state-flags-changed`
546    ///  Emitted when the widget state changes.
547    ///
548    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
549    ///
550    ///
551    ///
552    ///
553    /// #### `unmap`
554    ///  Emitted when @widget is going to be unmapped.
555    ///
556    /// A widget is unmapped when either it or any of its parents up to the
557    /// toplevel widget have been set as hidden.
558    ///
559    /// As `::unmap` indicates that a widget will not be shown any longer,
560    /// it can be used to, for example, stop an animation on the widget.
561    ///
562    ///
563    ///
564    ///
565    /// #### `unrealize`
566    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
567    ///
568    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
569    /// or the widget has been unmapped (that is, it is going to be hidden).
570    ///
571    ///
572    /// </details>
573    ///
574    /// # Implements
575    ///
576    /// [`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]
577    #[doc(alias = "GtkInfoBar")]
578    pub struct InfoBar(Object<ffi::GtkInfoBar>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget;
579
580    match fn {
581        type_ => || ffi::gtk_info_bar_get_type(),
582    }
583}
584
585impl InfoBar {
586    /// Creates a new [`InfoBar`][crate::InfoBar] object.
587    ///
588    /// # Deprecated since 4.10
589    ///
590    ///
591    /// # Returns
592    ///
593    /// a new [`InfoBar`][crate::InfoBar] object
594    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
595    #[allow(deprecated)]
596    #[doc(alias = "gtk_info_bar_new")]
597    pub fn new() -> InfoBar {
598        assert_initialized_main_thread!();
599        unsafe { Widget::from_glib_none(ffi::gtk_info_bar_new()).unsafe_cast() }
600    }
601
602    // rustdoc-stripper-ignore-next
603    /// Creates a new builder-pattern struct instance to construct [`InfoBar`] objects.
604    ///
605    /// This method returns an instance of [`InfoBarBuilder`](crate::builders::InfoBarBuilder) which can be used to create [`InfoBar`] objects.
606    pub fn builder() -> InfoBarBuilder {
607        InfoBarBuilder::new()
608    }
609
610    /// Add an activatable widget to the action area of a [`InfoBar`][crate::InfoBar].
611    ///
612    /// This also connects a signal handler that will emit the
613    /// [`response`][struct@crate::InfoBar#response] signal on the message area
614    /// when the widget is activated. The widget is appended to the
615    /// end of the message areas action area.
616    ///
617    /// # Deprecated since 4.10
618    ///
619    /// ## `child`
620    /// an activatable widget
621    /// ## `response_id`
622    /// response ID for @child
623    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
624    #[allow(deprecated)]
625    #[doc(alias = "gtk_info_bar_add_action_widget")]
626    pub fn add_action_widget(&self, child: &impl IsA<Widget>, response_id: ResponseType) {
627        unsafe {
628            ffi::gtk_info_bar_add_action_widget(
629                self.to_glib_none().0,
630                child.as_ref().to_glib_none().0,
631                response_id.into_glib(),
632            );
633        }
634    }
635
636    /// Adds a button with the given text.
637    ///
638    /// Clicking the button will emit the [`response`][struct@crate::InfoBar#response]
639    /// signal with the given response_id. The button is appended to the
640    /// end of the info bar's action area. The button widget is returned,
641    /// but usually you don't need it.
642    ///
643    /// # Deprecated since 4.10
644    ///
645    /// ## `button_text`
646    /// text of button
647    /// ## `response_id`
648    /// response ID for the button
649    ///
650    /// # Returns
651    ///
652    /// the [`Button`][crate::Button] widget
653    /// that was added
654    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
655    #[allow(deprecated)]
656    #[doc(alias = "gtk_info_bar_add_button")]
657    pub fn add_button(&self, button_text: &str, response_id: ResponseType) -> Button {
658        unsafe {
659            from_glib_none(ffi::gtk_info_bar_add_button(
660                self.to_glib_none().0,
661                button_text.to_glib_none().0,
662                response_id.into_glib(),
663            ))
664        }
665    }
666
667    /// Adds a widget to the content area of the info bar.
668    ///
669    /// # Deprecated since 4.10
670    ///
671    /// ## `widget`
672    /// the child to be added
673    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
674    #[allow(deprecated)]
675    #[doc(alias = "gtk_info_bar_add_child")]
676    pub fn add_child(&self, widget: &impl IsA<Widget>) {
677        unsafe {
678            ffi::gtk_info_bar_add_child(self.to_glib_none().0, widget.as_ref().to_glib_none().0);
679        }
680    }
681
682    /// Returns the message type of the message area.
683    ///
684    /// # Deprecated since 4.10
685    ///
686    ///
687    /// # Returns
688    ///
689    /// the message type of the message area.
690    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
691    #[allow(deprecated)]
692    #[doc(alias = "gtk_info_bar_get_message_type")]
693    #[doc(alias = "get_message_type")]
694    #[doc(alias = "message-type")]
695    pub fn message_type(&self) -> MessageType {
696        unsafe { from_glib(ffi::gtk_info_bar_get_message_type(self.to_glib_none().0)) }
697    }
698
699    /// Returns whether the info bar is currently revealed.
700    ///
701    /// # Deprecated since 4.10
702    ///
703    ///
704    /// # Returns
705    ///
706    /// the current value of the [`revealed`][struct@crate::InfoBar#revealed] property
707    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
708    #[allow(deprecated)]
709    #[doc(alias = "gtk_info_bar_get_revealed")]
710    #[doc(alias = "get_revealed")]
711    #[doc(alias = "revealed")]
712    pub fn is_revealed(&self) -> bool {
713        unsafe { from_glib(ffi::gtk_info_bar_get_revealed(self.to_glib_none().0)) }
714    }
715
716    /// Returns whether the widget will display a standard close button.
717    ///
718    /// # Deprecated since 4.10
719    ///
720    ///
721    /// # Returns
722    ///
723    /// [`true`] if the widget displays standard close button
724    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
725    #[allow(deprecated)]
726    #[doc(alias = "gtk_info_bar_get_show_close_button")]
727    #[doc(alias = "get_show_close_button")]
728    #[doc(alias = "show-close-button")]
729    pub fn shows_close_button(&self) -> bool {
730        unsafe {
731            from_glib(ffi::gtk_info_bar_get_show_close_button(
732                self.to_glib_none().0,
733            ))
734        }
735    }
736
737    /// Removes a widget from the action area of @self.
738    ///
739    /// The widget must have been put there by a call to
740    /// [`add_action_widget()`][Self::add_action_widget()] or [`add_button()`][Self::add_button()].
741    ///
742    /// # Deprecated since 4.10
743    ///
744    /// ## `widget`
745    /// an action widget to remove
746    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
747    #[allow(deprecated)]
748    #[doc(alias = "gtk_info_bar_remove_action_widget")]
749    pub fn remove_action_widget(&self, widget: &impl IsA<Widget>) {
750        unsafe {
751            ffi::gtk_info_bar_remove_action_widget(
752                self.to_glib_none().0,
753                widget.as_ref().to_glib_none().0,
754            );
755        }
756    }
757
758    /// Removes a widget from the content area of the info bar.
759    ///
760    /// # Deprecated since 4.10
761    ///
762    /// ## `widget`
763    /// a child that has been added to the content area
764    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
765    #[allow(deprecated)]
766    #[doc(alias = "gtk_info_bar_remove_child")]
767    pub fn remove_child(&self, widget: &impl IsA<Widget>) {
768        unsafe {
769            ffi::gtk_info_bar_remove_child(self.to_glib_none().0, widget.as_ref().to_glib_none().0);
770        }
771    }
772
773    /// Emits the “response” signal with the given @response_id.
774    ///
775    /// # Deprecated since 4.10
776    ///
777    /// ## `response_id`
778    /// a response ID
779    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
780    #[allow(deprecated)]
781    #[doc(alias = "gtk_info_bar_response")]
782    pub fn response(&self, response_id: ResponseType) {
783        unsafe {
784            ffi::gtk_info_bar_response(self.to_glib_none().0, response_id.into_glib());
785        }
786    }
787
788    /// Sets the last widget in the info bar’s action area with
789    /// the given response_id as the default widget for the dialog.
790    ///
791    /// Pressing “Enter” normally activates the default widget.
792    ///
793    /// Note that this function currently requires @self to
794    /// be added to a widget hierarchy.
795    ///
796    /// # Deprecated since 4.10
797    ///
798    /// ## `response_id`
799    /// a response ID
800    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
801    #[allow(deprecated)]
802    #[doc(alias = "gtk_info_bar_set_default_response")]
803    pub fn set_default_response(&self, response_id: ResponseType) {
804        unsafe {
805            ffi::gtk_info_bar_set_default_response(self.to_glib_none().0, response_id.into_glib());
806        }
807    }
808
809    /// Sets the message type of the message area.
810    ///
811    /// GTK uses this type to determine how the message is displayed.
812    ///
813    /// # Deprecated since 4.10
814    ///
815    /// ## `message_type`
816    /// a [`MessageType`][crate::MessageType]
817    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
818    #[allow(deprecated)]
819    #[doc(alias = "gtk_info_bar_set_message_type")]
820    #[doc(alias = "message-type")]
821    pub fn set_message_type(&self, message_type: MessageType) {
822        unsafe {
823            ffi::gtk_info_bar_set_message_type(self.to_glib_none().0, message_type.into_glib());
824        }
825    }
826
827    /// Sets the sensitivity of action widgets for @response_id.
828    ///
829    /// Calls `gtk_widget_set_sensitive (widget, setting)` for each
830    /// widget in the info bars’s action area with the given @response_id.
831    /// A convenient way to sensitize/desensitize buttons.
832    ///
833    /// # Deprecated since 4.10
834    ///
835    /// ## `response_id`
836    /// a response ID
837    /// ## `setting`
838    /// TRUE for sensitive
839    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
840    #[allow(deprecated)]
841    #[doc(alias = "gtk_info_bar_set_response_sensitive")]
842    pub fn set_response_sensitive(&self, response_id: ResponseType, setting: bool) {
843        unsafe {
844            ffi::gtk_info_bar_set_response_sensitive(
845                self.to_glib_none().0,
846                response_id.into_glib(),
847                setting.into_glib(),
848            );
849        }
850    }
851
852    /// Sets whether the [`InfoBar`][crate::InfoBar] is revealed.
853    ///
854    /// Changing this will make @self reveal or conceal
855    /// itself via a sliding transition.
856    ///
857    /// Note: this does not show or hide @self in the
858    /// [`visible`][struct@crate::Widget#visible] sense, so revealing has no effect
859    /// if [`visible`][struct@crate::Widget#visible] is [`false`].
860    ///
861    /// # Deprecated since 4.10
862    ///
863    /// ## `revealed`
864    /// The new value of the property
865    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
866    #[allow(deprecated)]
867    #[doc(alias = "gtk_info_bar_set_revealed")]
868    #[doc(alias = "revealed")]
869    pub fn set_revealed(&self, revealed: bool) {
870        unsafe {
871            ffi::gtk_info_bar_set_revealed(self.to_glib_none().0, revealed.into_glib());
872        }
873    }
874
875    /// If true, a standard close button is shown.
876    ///
877    /// When clicked it emits the response [`ResponseType::Close`][crate::ResponseType::Close].
878    ///
879    /// # Deprecated since 4.10
880    ///
881    /// ## `setting`
882    /// [`true`] to include a close button
883    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
884    #[allow(deprecated)]
885    #[doc(alias = "gtk_info_bar_set_show_close_button")]
886    #[doc(alias = "show-close-button")]
887    pub fn set_show_close_button(&self, setting: bool) {
888        unsafe {
889            ffi::gtk_info_bar_set_show_close_button(self.to_glib_none().0, setting.into_glib());
890        }
891    }
892
893    /// Gets emitted when the user uses a keybinding to dismiss the info bar.
894    ///
895    /// The ::close signal is a [keybinding signal](class.SignalAction.html).
896    ///
897    /// The default binding for this signal is the Escape key.
898    #[doc(alias = "close")]
899    pub fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
900        unsafe extern "C" fn close_trampoline<F: Fn(&InfoBar) + 'static>(
901            this: *mut ffi::GtkInfoBar,
902            f: glib::ffi::gpointer,
903        ) {
904            let f: &F = &*(f as *const F);
905            f(&from_glib_borrow(this))
906        }
907        unsafe {
908            let f: Box_<F> = Box_::new(f);
909            connect_raw(
910                self.as_ptr() as *mut _,
911                c"close".as_ptr() as *const _,
912                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
913                    close_trampoline::<F> as *const (),
914                )),
915                Box_::into_raw(f),
916            )
917        }
918    }
919
920    pub fn emit_close(&self) {
921        self.emit_by_name::<()>("close", &[]);
922    }
923
924    /// Emitted when an action widget is clicked.
925    ///
926    /// The signal is also emitted when the application programmer
927    /// calls [`response()`][Self::response()]. The @response_id depends
928    /// on which action widget was clicked.
929    /// ## `response_id`
930    /// the response ID
931    #[doc(alias = "response")]
932    pub fn connect_response<F: Fn(&Self, ResponseType) + 'static>(&self, f: F) -> SignalHandlerId {
933        unsafe extern "C" fn response_trampoline<F: Fn(&InfoBar, ResponseType) + 'static>(
934            this: *mut ffi::GtkInfoBar,
935            response_id: ffi::GtkResponseType,
936            f: glib::ffi::gpointer,
937        ) {
938            let f: &F = &*(f as *const F);
939            f(&from_glib_borrow(this), from_glib(response_id))
940        }
941        unsafe {
942            let f: Box_<F> = Box_::new(f);
943            connect_raw(
944                self.as_ptr() as *mut _,
945                c"response".as_ptr() as *const _,
946                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
947                    response_trampoline::<F> as *const (),
948                )),
949                Box_::into_raw(f),
950            )
951        }
952    }
953
954    #[doc(alias = "message-type")]
955    pub fn connect_message_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
956        unsafe extern "C" fn notify_message_type_trampoline<F: Fn(&InfoBar) + 'static>(
957            this: *mut ffi::GtkInfoBar,
958            _param_spec: glib::ffi::gpointer,
959            f: glib::ffi::gpointer,
960        ) {
961            let f: &F = &*(f as *const F);
962            f(&from_glib_borrow(this))
963        }
964        unsafe {
965            let f: Box_<F> = Box_::new(f);
966            connect_raw(
967                self.as_ptr() as *mut _,
968                c"notify::message-type".as_ptr() as *const _,
969                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
970                    notify_message_type_trampoline::<F> as *const (),
971                )),
972                Box_::into_raw(f),
973            )
974        }
975    }
976
977    #[doc(alias = "revealed")]
978    pub fn connect_revealed_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
979        unsafe extern "C" fn notify_revealed_trampoline<F: Fn(&InfoBar) + 'static>(
980            this: *mut ffi::GtkInfoBar,
981            _param_spec: glib::ffi::gpointer,
982            f: glib::ffi::gpointer,
983        ) {
984            let f: &F = &*(f as *const F);
985            f(&from_glib_borrow(this))
986        }
987        unsafe {
988            let f: Box_<F> = Box_::new(f);
989            connect_raw(
990                self.as_ptr() as *mut _,
991                c"notify::revealed".as_ptr() as *const _,
992                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
993                    notify_revealed_trampoline::<F> as *const (),
994                )),
995                Box_::into_raw(f),
996            )
997        }
998    }
999
1000    #[doc(alias = "show-close-button")]
1001    pub fn connect_show_close_button_notify<F: Fn(&Self) + 'static>(
1002        &self,
1003        f: F,
1004    ) -> SignalHandlerId {
1005        unsafe extern "C" fn notify_show_close_button_trampoline<F: Fn(&InfoBar) + 'static>(
1006            this: *mut ffi::GtkInfoBar,
1007            _param_spec: glib::ffi::gpointer,
1008            f: glib::ffi::gpointer,
1009        ) {
1010            let f: &F = &*(f as *const F);
1011            f(&from_glib_borrow(this))
1012        }
1013        unsafe {
1014            let f: Box_<F> = Box_::new(f);
1015            connect_raw(
1016                self.as_ptr() as *mut _,
1017                c"notify::show-close-button".as_ptr() as *const _,
1018                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1019                    notify_show_close_button_trampoline::<F> as *const (),
1020                )),
1021                Box_::into_raw(f),
1022            )
1023        }
1024    }
1025}
1026
1027impl Default for InfoBar {
1028    fn default() -> Self {
1029        Self::new()
1030    }
1031}
1032
1033// rustdoc-stripper-ignore-next
1034/// A [builder-pattern] type to construct [`InfoBar`] objects.
1035///
1036/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1037#[must_use = "The builder must be built to be used"]
1038pub struct InfoBarBuilder {
1039    builder: glib::object::ObjectBuilder<'static, InfoBar>,
1040}
1041
1042impl InfoBarBuilder {
1043    fn new() -> Self {
1044        Self {
1045            builder: glib::object::Object::builder(),
1046        }
1047    }
1048
1049    /// The type of the message.
1050    ///
1051    /// The type may be used to determine the appearance of the info bar.
1052    pub fn message_type(self, message_type: MessageType) -> Self {
1053        Self {
1054            builder: self.builder.property("message-type", message_type),
1055        }
1056    }
1057
1058    /// Whether the info bar shows its contents.
1059    pub fn revealed(self, revealed: bool) -> Self {
1060        Self {
1061            builder: self.builder.property("revealed", revealed),
1062        }
1063    }
1064
1065    /// Whether to include a standard close button.
1066    pub fn show_close_button(self, show_close_button: bool) -> Self {
1067        Self {
1068            builder: self
1069                .builder
1070                .property("show-close-button", show_close_button),
1071        }
1072    }
1073
1074    /// Whether the widget or any of its descendents can accept
1075    /// the input focus.
1076    ///
1077    /// This property is meant to be set by widget implementations,
1078    /// typically in their instance init function.
1079    pub fn can_focus(self, can_focus: bool) -> Self {
1080        Self {
1081            builder: self.builder.property("can-focus", can_focus),
1082        }
1083    }
1084
1085    /// Whether the widget can receive pointer events.
1086    pub fn can_target(self, can_target: bool) -> Self {
1087        Self {
1088            builder: self.builder.property("can-target", can_target),
1089        }
1090    }
1091
1092    /// A list of css classes applied to this widget.
1093    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1094        Self {
1095            builder: self.builder.property("css-classes", css_classes.into()),
1096        }
1097    }
1098
1099    /// The name of this widget in the CSS tree.
1100    ///
1101    /// This property is meant to be set by widget implementations,
1102    /// typically in their instance init function.
1103    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1104        Self {
1105            builder: self.builder.property("css-name", css_name.into()),
1106        }
1107    }
1108
1109    /// The cursor used by @widget.
1110    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1111        Self {
1112            builder: self.builder.property("cursor", cursor.clone()),
1113        }
1114    }
1115
1116    /// Whether the widget should grab focus when it is clicked with the mouse.
1117    ///
1118    /// This property is only relevant for widgets that can take focus.
1119    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1120        Self {
1121            builder: self.builder.property("focus-on-click", focus_on_click),
1122        }
1123    }
1124
1125    /// Whether this widget itself will accept the input focus.
1126    pub fn focusable(self, focusable: bool) -> Self {
1127        Self {
1128            builder: self.builder.property("focusable", focusable),
1129        }
1130    }
1131
1132    /// How to distribute horizontal space if widget gets extra space.
1133    pub fn halign(self, halign: Align) -> Self {
1134        Self {
1135            builder: self.builder.property("halign", halign),
1136        }
1137    }
1138
1139    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1140    /// signal on @widget.
1141    ///
1142    /// A true value indicates that @widget can have a tooltip, in this case
1143    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1144    /// determine whether it will provide a tooltip or not.
1145    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1146        Self {
1147            builder: self.builder.property("has-tooltip", has_tooltip),
1148        }
1149    }
1150
1151    /// Overrides for height request of the widget.
1152    ///
1153    /// If this is -1, the natural request will be used.
1154    pub fn height_request(self, height_request: i32) -> Self {
1155        Self {
1156            builder: self.builder.property("height-request", height_request),
1157        }
1158    }
1159
1160    /// Whether to expand horizontally.
1161    pub fn hexpand(self, hexpand: bool) -> Self {
1162        Self {
1163            builder: self.builder.property("hexpand", hexpand),
1164        }
1165    }
1166
1167    /// Whether to use the `hexpand` property.
1168    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1169        Self {
1170            builder: self.builder.property("hexpand-set", hexpand_set),
1171        }
1172    }
1173
1174    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1175    /// the preferred size of the widget, and allocate its children.
1176    ///
1177    /// This property is meant to be set by widget implementations,
1178    /// typically in their instance init function.
1179    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1180        Self {
1181            builder: self
1182                .builder
1183                .property("layout-manager", layout_manager.clone().upcast()),
1184        }
1185    }
1186
1187    /// Makes this widget act like a modal dialog, with respect to
1188    /// event delivery.
1189    ///
1190    /// Global event controllers will not handle events with targets
1191    /// inside the widget, unless they are set up to ignore propagation
1192    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1193    #[cfg(feature = "v4_18")]
1194    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1195    pub fn limit_events(self, limit_events: bool) -> Self {
1196        Self {
1197            builder: self.builder.property("limit-events", limit_events),
1198        }
1199    }
1200
1201    /// Margin on bottom side of widget.
1202    ///
1203    /// This property adds margin outside of the widget's normal size
1204    /// request, the margin will be added in addition to the size from
1205    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1206    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1207        Self {
1208            builder: self.builder.property("margin-bottom", margin_bottom),
1209        }
1210    }
1211
1212    /// Margin on end of widget, horizontally.
1213    ///
1214    /// This property supports left-to-right and right-to-left text
1215    /// directions.
1216    ///
1217    /// This property adds margin outside of the widget's normal size
1218    /// request, the margin will be added in addition to the size from
1219    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1220    pub fn margin_end(self, margin_end: i32) -> Self {
1221        Self {
1222            builder: self.builder.property("margin-end", margin_end),
1223        }
1224    }
1225
1226    /// Margin on start of widget, horizontally.
1227    ///
1228    /// This property supports left-to-right and right-to-left text
1229    /// directions.
1230    ///
1231    /// This property adds margin outside of the widget's normal size
1232    /// request, the margin will be added in addition to the size from
1233    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1234    pub fn margin_start(self, margin_start: i32) -> Self {
1235        Self {
1236            builder: self.builder.property("margin-start", margin_start),
1237        }
1238    }
1239
1240    /// Margin on top side of widget.
1241    ///
1242    /// This property adds margin outside of the widget's normal size
1243    /// request, the margin will be added in addition to the size from
1244    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1245    pub fn margin_top(self, margin_top: i32) -> Self {
1246        Self {
1247            builder: self.builder.property("margin-top", margin_top),
1248        }
1249    }
1250
1251    /// The name of the widget.
1252    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1253        Self {
1254            builder: self.builder.property("name", name.into()),
1255        }
1256    }
1257
1258    /// The requested opacity of the widget.
1259    pub fn opacity(self, opacity: f64) -> Self {
1260        Self {
1261            builder: self.builder.property("opacity", opacity),
1262        }
1263    }
1264
1265    /// How content outside the widget's content area is treated.
1266    ///
1267    /// This property is meant to be set by widget implementations,
1268    /// typically in their instance init function.
1269    pub fn overflow(self, overflow: Overflow) -> Self {
1270        Self {
1271            builder: self.builder.property("overflow", overflow),
1272        }
1273    }
1274
1275    /// Whether the widget will receive the default action when it is focused.
1276    pub fn receives_default(self, receives_default: bool) -> Self {
1277        Self {
1278            builder: self.builder.property("receives-default", receives_default),
1279        }
1280    }
1281
1282    /// Whether the widget responds to input.
1283    pub fn sensitive(self, sensitive: bool) -> Self {
1284        Self {
1285            builder: self.builder.property("sensitive", sensitive),
1286        }
1287    }
1288
1289    /// Sets the text of tooltip to be the given string, which is marked up
1290    /// with Pango markup.
1291    ///
1292    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1293    ///
1294    /// This is a convenience property which will take care of getting the
1295    /// tooltip shown if the given string is not `NULL`:
1296    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1297    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1298    /// the default signal handler.
1299    ///
1300    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1301    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1302    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1303        Self {
1304            builder: self
1305                .builder
1306                .property("tooltip-markup", tooltip_markup.into()),
1307        }
1308    }
1309
1310    /// Sets the text of tooltip to be the given string.
1311    ///
1312    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1313    ///
1314    /// This is a convenience property which will take care of getting the
1315    /// tooltip shown if the given string is not `NULL`:
1316    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1317    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1318    /// the default signal handler.
1319    ///
1320    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1321    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1322    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1323        Self {
1324            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1325        }
1326    }
1327
1328    /// How to distribute vertical space if widget gets extra space.
1329    pub fn valign(self, valign: Align) -> Self {
1330        Self {
1331            builder: self.builder.property("valign", valign),
1332        }
1333    }
1334
1335    /// Whether to expand vertically.
1336    pub fn vexpand(self, vexpand: bool) -> Self {
1337        Self {
1338            builder: self.builder.property("vexpand", vexpand),
1339        }
1340    }
1341
1342    /// Whether to use the `vexpand` property.
1343    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1344        Self {
1345            builder: self.builder.property("vexpand-set", vexpand_set),
1346        }
1347    }
1348
1349    /// Whether the widget is visible.
1350    pub fn visible(self, visible: bool) -> Self {
1351        Self {
1352            builder: self.builder.property("visible", visible),
1353        }
1354    }
1355
1356    /// Overrides for width request of the widget.
1357    ///
1358    /// If this is -1, the natural request will be used.
1359    pub fn width_request(self, width_request: i32) -> Self {
1360        Self {
1361            builder: self.builder.property("width-request", width_request),
1362        }
1363    }
1364
1365    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1366    ///
1367    /// The accessible role cannot be changed once set.
1368    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1369        Self {
1370            builder: self.builder.property("accessible-role", accessible_role),
1371        }
1372    }
1373
1374    // rustdoc-stripper-ignore-next
1375    /// Build the [`InfoBar`].
1376    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1377    pub fn build(self) -> InfoBar {
1378        assert_initialized_main_thread!();
1379        self.builder.build()
1380    }
1381}