Skip to main content

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    Accessible, AccessibleRole, Align, Buildable, Button, ConstraintTarget, LayoutManager,
8    MessageType, Overflow, ResponseType, Widget, ffi,
9};
10use glib::{
11    object::ObjectType as _,
12    prelude::*,
13    signal::{SignalHandlerId, connect_raw},
14    translate::*,
15};
16use std::boxed::Box as Box_;
17
18glib::wrapper! {
19    /// 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            unsafe {
905                let f: &F = &*(f as *const F);
906                f(&from_glib_borrow(this))
907            }
908        }
909        unsafe {
910            let f: Box_<F> = Box_::new(f);
911            connect_raw(
912                self.as_ptr() as *mut _,
913                c"close".as_ptr() as *const _,
914                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
915                    close_trampoline::<F> as *const (),
916                )),
917                Box_::into_raw(f),
918            )
919        }
920    }
921
922    pub fn emit_close(&self) {
923        self.emit_by_name::<()>("close", &[]);
924    }
925
926    /// Emitted when an action widget is clicked.
927    ///
928    /// The signal is also emitted when the application programmer
929    /// calls [`response()`][Self::response()]. The @response_id depends
930    /// on which action widget was clicked.
931    /// ## `response_id`
932    /// the response ID
933    #[doc(alias = "response")]
934    pub fn connect_response<F: Fn(&Self, ResponseType) + 'static>(&self, f: F) -> SignalHandlerId {
935        unsafe extern "C" fn response_trampoline<F: Fn(&InfoBar, ResponseType) + 'static>(
936            this: *mut ffi::GtkInfoBar,
937            response_id: ffi::GtkResponseType,
938            f: glib::ffi::gpointer,
939        ) {
940            unsafe {
941                let f: &F = &*(f as *const F);
942                f(&from_glib_borrow(this), from_glib(response_id))
943            }
944        }
945        unsafe {
946            let f: Box_<F> = Box_::new(f);
947            connect_raw(
948                self.as_ptr() as *mut _,
949                c"response".as_ptr() as *const _,
950                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
951                    response_trampoline::<F> as *const (),
952                )),
953                Box_::into_raw(f),
954            )
955        }
956    }
957
958    #[doc(alias = "message-type")]
959    pub fn connect_message_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
960        unsafe extern "C" fn notify_message_type_trampoline<F: Fn(&InfoBar) + 'static>(
961            this: *mut ffi::GtkInfoBar,
962            _param_spec: glib::ffi::gpointer,
963            f: glib::ffi::gpointer,
964        ) {
965            unsafe {
966                let f: &F = &*(f as *const F);
967                f(&from_glib_borrow(this))
968            }
969        }
970        unsafe {
971            let f: Box_<F> = Box_::new(f);
972            connect_raw(
973                self.as_ptr() as *mut _,
974                c"notify::message-type".as_ptr() as *const _,
975                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
976                    notify_message_type_trampoline::<F> as *const (),
977                )),
978                Box_::into_raw(f),
979            )
980        }
981    }
982
983    #[doc(alias = "revealed")]
984    pub fn connect_revealed_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
985        unsafe extern "C" fn notify_revealed_trampoline<F: Fn(&InfoBar) + 'static>(
986            this: *mut ffi::GtkInfoBar,
987            _param_spec: glib::ffi::gpointer,
988            f: glib::ffi::gpointer,
989        ) {
990            unsafe {
991                let f: &F = &*(f as *const F);
992                f(&from_glib_borrow(this))
993            }
994        }
995        unsafe {
996            let f: Box_<F> = Box_::new(f);
997            connect_raw(
998                self.as_ptr() as *mut _,
999                c"notify::revealed".as_ptr() as *const _,
1000                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1001                    notify_revealed_trampoline::<F> as *const (),
1002                )),
1003                Box_::into_raw(f),
1004            )
1005        }
1006    }
1007
1008    #[doc(alias = "show-close-button")]
1009    pub fn connect_show_close_button_notify<F: Fn(&Self) + 'static>(
1010        &self,
1011        f: F,
1012    ) -> SignalHandlerId {
1013        unsafe extern "C" fn notify_show_close_button_trampoline<F: Fn(&InfoBar) + 'static>(
1014            this: *mut ffi::GtkInfoBar,
1015            _param_spec: glib::ffi::gpointer,
1016            f: glib::ffi::gpointer,
1017        ) {
1018            unsafe {
1019                let f: &F = &*(f as *const F);
1020                f(&from_glib_borrow(this))
1021            }
1022        }
1023        unsafe {
1024            let f: Box_<F> = Box_::new(f);
1025            connect_raw(
1026                self.as_ptr() as *mut _,
1027                c"notify::show-close-button".as_ptr() as *const _,
1028                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1029                    notify_show_close_button_trampoline::<F> as *const (),
1030                )),
1031                Box_::into_raw(f),
1032            )
1033        }
1034    }
1035}
1036
1037impl Default for InfoBar {
1038    fn default() -> Self {
1039        Self::new()
1040    }
1041}
1042
1043// rustdoc-stripper-ignore-next
1044/// A [builder-pattern] type to construct [`InfoBar`] objects.
1045///
1046/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1047#[must_use = "The builder must be built to be used"]
1048pub struct InfoBarBuilder {
1049    builder: glib::object::ObjectBuilder<'static, InfoBar>,
1050}
1051
1052impl InfoBarBuilder {
1053    fn new() -> Self {
1054        Self {
1055            builder: glib::object::Object::builder(),
1056        }
1057    }
1058
1059    /// The type of the message.
1060    ///
1061    /// The type may be used to determine the appearance of the info bar.
1062    pub fn message_type(self, message_type: MessageType) -> Self {
1063        Self {
1064            builder: self.builder.property("message-type", message_type),
1065        }
1066    }
1067
1068    /// Whether the info bar shows its contents.
1069    pub fn revealed(self, revealed: bool) -> Self {
1070        Self {
1071            builder: self.builder.property("revealed", revealed),
1072        }
1073    }
1074
1075    /// Whether to include a standard close button.
1076    pub fn show_close_button(self, show_close_button: bool) -> Self {
1077        Self {
1078            builder: self
1079                .builder
1080                .property("show-close-button", show_close_button),
1081        }
1082    }
1083
1084    /// Whether the widget or any of its descendents can accept
1085    /// the input focus.
1086    ///
1087    /// This property is meant to be set by widget implementations,
1088    /// typically in their instance init function.
1089    pub fn can_focus(self, can_focus: bool) -> Self {
1090        Self {
1091            builder: self.builder.property("can-focus", can_focus),
1092        }
1093    }
1094
1095    /// Whether the widget can receive pointer events.
1096    pub fn can_target(self, can_target: bool) -> Self {
1097        Self {
1098            builder: self.builder.property("can-target", can_target),
1099        }
1100    }
1101
1102    /// A list of css classes applied to this widget.
1103    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1104        Self {
1105            builder: self.builder.property("css-classes", css_classes.into()),
1106        }
1107    }
1108
1109    /// The name of this widget in the CSS tree.
1110    ///
1111    /// This property is meant to be set by widget implementations,
1112    /// typically in their instance init function.
1113    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1114        Self {
1115            builder: self.builder.property("css-name", css_name.into()),
1116        }
1117    }
1118
1119    /// The cursor used by @widget.
1120    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1121        Self {
1122            builder: self.builder.property("cursor", cursor.clone()),
1123        }
1124    }
1125
1126    /// Whether the widget should grab focus when it is clicked with the mouse.
1127    ///
1128    /// This property is only relevant for widgets that can take focus.
1129    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1130        Self {
1131            builder: self.builder.property("focus-on-click", focus_on_click),
1132        }
1133    }
1134
1135    /// Whether this widget itself will accept the input focus.
1136    pub fn focusable(self, focusable: bool) -> Self {
1137        Self {
1138            builder: self.builder.property("focusable", focusable),
1139        }
1140    }
1141
1142    /// How to distribute horizontal space if widget gets extra space.
1143    pub fn halign(self, halign: Align) -> Self {
1144        Self {
1145            builder: self.builder.property("halign", halign),
1146        }
1147    }
1148
1149    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1150    /// signal on @widget.
1151    ///
1152    /// A true value indicates that @widget can have a tooltip, in this case
1153    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1154    /// determine whether it will provide a tooltip or not.
1155    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1156        Self {
1157            builder: self.builder.property("has-tooltip", has_tooltip),
1158        }
1159    }
1160
1161    /// Overrides for height request of the widget.
1162    ///
1163    /// If this is -1, the natural request will be used.
1164    pub fn height_request(self, height_request: i32) -> Self {
1165        Self {
1166            builder: self.builder.property("height-request", height_request),
1167        }
1168    }
1169
1170    /// Whether to expand horizontally.
1171    pub fn hexpand(self, hexpand: bool) -> Self {
1172        Self {
1173            builder: self.builder.property("hexpand", hexpand),
1174        }
1175    }
1176
1177    /// Whether to use the `hexpand` property.
1178    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1179        Self {
1180            builder: self.builder.property("hexpand-set", hexpand_set),
1181        }
1182    }
1183
1184    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1185    /// the preferred size of the widget, and allocate its children.
1186    ///
1187    /// This property is meant to be set by widget implementations,
1188    /// typically in their instance init function.
1189    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1190        Self {
1191            builder: self
1192                .builder
1193                .property("layout-manager", layout_manager.clone().upcast()),
1194        }
1195    }
1196
1197    /// Makes this widget act like a modal dialog, with respect to
1198    /// event delivery.
1199    ///
1200    /// Global event controllers will not handle events with targets
1201    /// inside the widget, unless they are set up to ignore propagation
1202    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1203    #[cfg(feature = "v4_18")]
1204    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1205    pub fn limit_events(self, limit_events: bool) -> Self {
1206        Self {
1207            builder: self.builder.property("limit-events", limit_events),
1208        }
1209    }
1210
1211    /// Margin on bottom side of widget.
1212    ///
1213    /// This property adds margin outside of the widget's normal size
1214    /// request, the margin will be added in addition to the size from
1215    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1216    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1217        Self {
1218            builder: self.builder.property("margin-bottom", margin_bottom),
1219        }
1220    }
1221
1222    /// Margin on end of widget, horizontally.
1223    ///
1224    /// This property supports left-to-right and right-to-left text
1225    /// directions.
1226    ///
1227    /// This property adds margin outside of the widget's normal size
1228    /// request, the margin will be added in addition to the size from
1229    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1230    pub fn margin_end(self, margin_end: i32) -> Self {
1231        Self {
1232            builder: self.builder.property("margin-end", margin_end),
1233        }
1234    }
1235
1236    /// Margin on start of widget, horizontally.
1237    ///
1238    /// This property supports left-to-right and right-to-left text
1239    /// directions.
1240    ///
1241    /// This property adds margin outside of the widget's normal size
1242    /// request, the margin will be added in addition to the size from
1243    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1244    pub fn margin_start(self, margin_start: i32) -> Self {
1245        Self {
1246            builder: self.builder.property("margin-start", margin_start),
1247        }
1248    }
1249
1250    /// Margin on top side of widget.
1251    ///
1252    /// This property adds margin outside of the widget's normal size
1253    /// request, the margin will be added in addition to the size from
1254    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1255    pub fn margin_top(self, margin_top: i32) -> Self {
1256        Self {
1257            builder: self.builder.property("margin-top", margin_top),
1258        }
1259    }
1260
1261    /// The name of the widget.
1262    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1263        Self {
1264            builder: self.builder.property("name", name.into()),
1265        }
1266    }
1267
1268    /// The requested opacity of the widget.
1269    pub fn opacity(self, opacity: f64) -> Self {
1270        Self {
1271            builder: self.builder.property("opacity", opacity),
1272        }
1273    }
1274
1275    /// How content outside the widget's content area is treated.
1276    ///
1277    /// This property is meant to be set by widget implementations,
1278    /// typically in their instance init function.
1279    pub fn overflow(self, overflow: Overflow) -> Self {
1280        Self {
1281            builder: self.builder.property("overflow", overflow),
1282        }
1283    }
1284
1285    /// Whether the widget will receive the default action when it is focused.
1286    pub fn receives_default(self, receives_default: bool) -> Self {
1287        Self {
1288            builder: self.builder.property("receives-default", receives_default),
1289        }
1290    }
1291
1292    /// Whether the widget responds to input.
1293    pub fn sensitive(self, sensitive: bool) -> Self {
1294        Self {
1295            builder: self.builder.property("sensitive", sensitive),
1296        }
1297    }
1298
1299    /// Sets the text of tooltip to be the given string, which is marked up
1300    /// with Pango markup.
1301    ///
1302    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1303    ///
1304    /// This is a convenience property which will take care of getting the
1305    /// tooltip shown if the given string is not `NULL`:
1306    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1307    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1308    /// the default signal handler.
1309    ///
1310    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1311    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1312    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1313        Self {
1314            builder: self
1315                .builder
1316                .property("tooltip-markup", tooltip_markup.into()),
1317        }
1318    }
1319
1320    /// Sets the text of tooltip to be the given string.
1321    ///
1322    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1323    ///
1324    /// This is a convenience property which will take care of getting the
1325    /// tooltip shown if the given string is not `NULL`:
1326    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1327    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1328    /// the default signal handler.
1329    ///
1330    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1331    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1332    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1333        Self {
1334            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1335        }
1336    }
1337
1338    /// How to distribute vertical space if widget gets extra space.
1339    pub fn valign(self, valign: Align) -> Self {
1340        Self {
1341            builder: self.builder.property("valign", valign),
1342        }
1343    }
1344
1345    /// Whether to expand vertically.
1346    pub fn vexpand(self, vexpand: bool) -> Self {
1347        Self {
1348            builder: self.builder.property("vexpand", vexpand),
1349        }
1350    }
1351
1352    /// Whether to use the `vexpand` property.
1353    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1354        Self {
1355            builder: self.builder.property("vexpand-set", vexpand_set),
1356        }
1357    }
1358
1359    /// Whether the widget is visible.
1360    pub fn visible(self, visible: bool) -> Self {
1361        Self {
1362            builder: self.builder.property("visible", visible),
1363        }
1364    }
1365
1366    /// Overrides for width request of the widget.
1367    ///
1368    /// If this is -1, the natural request will be used.
1369    pub fn width_request(self, width_request: i32) -> Self {
1370        Self {
1371            builder: self.builder.property("width-request", width_request),
1372        }
1373    }
1374
1375    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1376    ///
1377    /// The accessible role cannot be changed once set.
1378    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1379        Self {
1380            builder: self.builder.property("accessible-role", accessible_role),
1381        }
1382    }
1383
1384    // rustdoc-stripper-ignore-next
1385    /// Build the [`InfoBar`].
1386    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1387    pub fn build(self) -> InfoBar {
1388        assert_initialized_main_thread!();
1389        self.builder.build()
1390    }
1391}