#[repr(transparent)]pub struct InfoBar { /* private fields */ }
Expand description
There is no replacement in GTK for an “info bar” widget;
you can use Revealer
with a Box
containing a
Label
and an optional Button
, according to
your application’s design.
InfoBar
can be show messages to the user without a dialog.
It is often temporarily shown at the top or bottom of a document.
In contrast to Dialog
, which has an action area at the
bottom, InfoBar
has an action area at the side.
The API of InfoBar
is very similar to Dialog
, allowing you
to add buttons to the action area with add_button()
or with_buttons()
. The sensitivity of action widgets
can be controlled with set_response_sensitive()
.
To add widgets to the main content area of a InfoBar
, use
add_child()
.
Similar to MessageDialog
, the contents of a InfoBar
can by classified as error message, warning, informational message, etc,
by using set_message_type()
. GTK may use the message
type to determine how the message is displayed.
A simple example for using a InfoBar
:
⚠️ The following code is in c ⚠️
GtkWidget *message_label;
GtkWidget *widget;
GtkWidget *grid;
GtkInfoBar *bar;
// set up info bar
widget = gtk_info_bar_new ();
bar = GTK_INFO_BAR (widget);
grid = gtk_grid_new ();
message_label = gtk_label_new ("");
gtk_info_bar_add_child (bar, message_label);
gtk_info_bar_add_button (bar,
_("_OK"),
GTK_RESPONSE_OK);
g_signal_connect (bar,
"response",
G_CALLBACK (gtk_widget_hide),
NULL);
gtk_grid_attach (GTK_GRID (grid),
widget,
0, 2, 1, 1);
// ...
// show an error message
gtk_label_set_text (GTK_LABEL (message_label), "An error occurred!");
gtk_info_bar_set_message_type (bar, GTK_MESSAGE_ERROR);
gtk_widget_show (bar);
GtkInfoBar as GtkBuildable
InfoBar
supports a custom <action-widgets>
element, which can contain
multiple <action-widget>
elements. The “response” attribute specifies a
numeric response, and the content of the element is the id of widget
(which should be a child of the dialogs @action_area).
InfoBar
supports adding action widgets by specifying “action” as
the “type” attribute of a <child>
element. The widget will be added
either to the action area. The response id has to be associated
with the action widget using the <action-widgets>
element.
CSS nodes
InfoBar
has a single CSS node with name infobar. The node may get
one of the style classes .info, .warning, .error or .question, depending
on the message type.
If the info bar shows a close button, that button will have the .close
style class applied.
Implements
WidgetExt
, glib::ObjectExt
, AccessibleExt
, BuildableExt
, ConstraintTargetExt
, WidgetExtManual
, AccessibleExtManual
Implementations§
source§impl InfoBar
impl InfoBar
sourcepub fn builder() -> InfoBarBuilder
pub fn builder() -> InfoBarBuilder
Creates a new builder-pattern struct instance to construct InfoBar
objects.
This method returns an instance of InfoBarBuilder
which can be used to create InfoBar
objects.
sourcepub fn add_action_widget(
&self,
child: &impl IsA<Widget>,
response_id: ResponseType
)
pub fn add_action_widget(
&self,
child: &impl IsA<Widget>,
response_id: ResponseType
)
Add an activatable widget to the action area of a InfoBar
.
This also connects a signal handler that will emit the
signal::InfoBar::response
signal on the message area
when the widget is activated. The widget is appended to the
end of the message areas action area.
Deprecated since 4.10
child
an activatable widget
response_id
response ID for @child
Adds a button with the given text.
Clicking the button will emit the signal::InfoBar::response
signal with the given response_id. The button is appended to the
end of the info bar’s action area. The button widget is returned,
but usually you don’t need it.
Deprecated since 4.10
button_text
text of button
response_id
response ID for the button
Returns
the Button
widget
that was added
sourcepub fn add_child(&self, widget: &impl IsA<Widget>)
pub fn add_child(&self, widget: &impl IsA<Widget>)
Adds a widget to the content area of the info bar.
Deprecated since 4.10
widget
the child to be added
sourcepub fn message_type(&self) -> MessageType
pub fn message_type(&self) -> MessageType
Returns the message type of the message area.
Deprecated since 4.10
Returns
the message type of the message area.
sourcepub fn is_revealed(&self) -> bool
pub fn is_revealed(&self) -> bool
Returns whether the info bar is currently revealed.
Deprecated since 4.10
Returns
the current value of the property::InfoBar::revealed
property
Returns whether the widget will display a standard close button.
Deprecated since 4.10
Returns
true
if the widget displays standard close button
sourcepub fn remove_action_widget(&self, widget: &impl IsA<Widget>)
pub fn remove_action_widget(&self, widget: &impl IsA<Widget>)
Removes a widget from the action area of @self.
The widget must have been put there by a call to
add_action_widget()
or add_button()
.
Deprecated since 4.10
widget
an action widget to remove
sourcepub fn remove_child(&self, widget: &impl IsA<Widget>)
pub fn remove_child(&self, widget: &impl IsA<Widget>)
Removes a widget from the content area of the info bar.
Deprecated since 4.10
widget
a child that has been added to the content area
sourcepub fn response(&self, response_id: ResponseType)
pub fn response(&self, response_id: ResponseType)
Emits the “response” signal with the given @response_id.
Deprecated since 4.10
response_id
a response ID
sourcepub fn set_default_response(&self, response_id: ResponseType)
pub fn set_default_response(&self, response_id: ResponseType)
Sets the last widget in the info bar’s action area with the given response_id as the default widget for the dialog.
Pressing “Enter” normally activates the default widget.
Note that this function currently requires @self to be added to a widget hierarchy.
Deprecated since 4.10
response_id
a response ID
sourcepub fn set_message_type(&self, message_type: MessageType)
pub fn set_message_type(&self, message_type: MessageType)
Sets the message type of the message area.
GTK uses this type to determine how the message is displayed.
Deprecated since 4.10
message_type
sourcepub fn set_response_sensitive(&self, response_id: ResponseType, setting: bool)
pub fn set_response_sensitive(&self, response_id: ResponseType, setting: bool)
Sets the sensitivity of action widgets for @response_id.
Calls gtk_widget_set_sensitive (widget, setting)
for each
widget in the info bars’s action area with the given @response_id.
A convenient way to sensitize/desensitize buttons.
Deprecated since 4.10
response_id
a response ID
setting
TRUE for sensitive
sourcepub fn set_revealed(&self, revealed: bool)
pub fn set_revealed(&self, revealed: bool)
Sets whether the InfoBar
is revealed.
Changing this will make @self reveal or conceal itself via a sliding transition.
Note: this does not show or hide @self in the
property::Widget::visible
sense, so revealing has no effect
if property::Widget::visible
is false
.
Deprecated since 4.10
revealed
The new value of the property
If true, a standard close button is shown.
When clicked it emits the response ResponseType::Close
.
Deprecated since 4.10
setting
true
to include a close button
sourcepub fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
pub fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Gets emitted when the user uses a keybinding to dismiss the info bar.
The ::close signal is a keybinding signal.
The default binding for this signal is the Escape key.
pub fn emit_close(&self)
sourcepub fn connect_response<F: Fn(&Self, ResponseType) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_response<F: Fn(&Self, ResponseType) + 'static>(
&self,
f: F
) -> SignalHandlerId
Emitted when an action widget is clicked.
The signal is also emitted when the application programmer
calls response()
. The @response_id depends
on which action widget was clicked.
response_id
the response ID
pub fn connect_message_type_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_revealed_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
source§impl InfoBar
impl InfoBar
Creates a new InfoBar
with buttons.
Button text/response ID pairs should be listed, with a None
pointer
ending the list. A response ID can be any positive number,
or one of the values in the ResponseType
enumeration. If the
user clicks one of these dialog buttons, GtkInfoBar will emit
the signal::InfoBar::response
signal with the corresponding
response ID.
Deprecated since 4.10
first_button_text
ext to go in first button
Returns
a new InfoBar
Adds multiple buttons.
This is the same as calling add_button()
repeatedly. The variable argument list should be None
-terminated
as with with_buttons()
. Each button must have both
text and response ID.
Deprecated since 4.10
first_button_text
button text
Trait Implementations§
source§impl Ord for InfoBar
impl Ord for InfoBar
source§impl<OT: ObjectType> PartialEq<OT> for InfoBar
impl<OT: ObjectType> PartialEq<OT> for InfoBar
source§impl<OT: ObjectType> PartialOrd<OT> for InfoBar
impl<OT: ObjectType> PartialOrd<OT> for InfoBar
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl StaticType for InfoBar
impl StaticType for InfoBar
source§fn static_type() -> Type
fn static_type() -> Type
Self
.impl Eq for InfoBar
impl IsA<Accessible> for InfoBar
impl IsA<Buildable> for InfoBar
impl IsA<ConstraintTarget> for InfoBar
impl IsA<Widget> for InfoBar
Auto Trait Implementations§
impl RefUnwindSafe for InfoBar
impl !Send for InfoBar
impl !Sync for InfoBar
impl Unpin for InfoBar
impl UnwindSafe for InfoBar
Blanket Implementations§
source§impl<O> AccessibleExtManual for Owhere
O: IsA<Accessible>,
impl<O> AccessibleExtManual for Owhere
O: IsA<Accessible>,
source§fn update_property(&self, properties: &[Property<'_>])
fn update_property(&self, properties: &[Property<'_>])
source§fn update_relation(&self, relations: &[Relation<'_>])
fn update_relation(&self, relations: &[Relation<'_>])
source§fn update_state(&self, states: &[State])
fn update_state(&self, states: &[State])
source§impl<T> Cast for Twhere
T: ObjectType,
impl<T> Cast for Twhere
T: ObjectType,
source§fn upcast<T>(self) -> Twhere
T: ObjectType,
Self: IsA<T>,
fn upcast<T>(self) -> Twhere
T: ObjectType,
Self: IsA<T>,
T
. Read moresource§fn upcast_ref<T>(&self) -> &Twhere
T: ObjectType,
Self: IsA<T>,
fn upcast_ref<T>(&self) -> &Twhere
T: ObjectType,
Self: IsA<T>,
T
. Read moresource§fn downcast<T>(self) -> Result<T, Self>where
T: ObjectType,
Self: CanDowncast<T>,
fn downcast<T>(self) -> Result<T, Self>where
T: ObjectType,
Self: CanDowncast<T>,
T
. Read moresource§fn downcast_ref<T>(&self) -> Option<&T>where
T: ObjectType,
Self: CanDowncast<T>,
fn downcast_ref<T>(&self) -> Option<&T>where
T: ObjectType,
Self: CanDowncast<T>,
T
. Read moresource§fn dynamic_cast<T>(self) -> Result<T, Self>where
T: ObjectType,
fn dynamic_cast<T>(self) -> Result<T, Self>where
T: ObjectType,
T
. This handles upcasting, downcasting
and casting between interface and interface implementors. All checks are performed at
runtime, while downcast
and upcast
will do many checks at compile-time already. Read moresource§fn dynamic_cast_ref<T>(&self) -> Option<&T>where
T: ObjectType,
fn dynamic_cast_ref<T>(&self) -> Option<&T>where
T: ObjectType,
T
. This handles upcasting, downcasting
and casting between interface and interface implementors. All checks are performed at
runtime, while downcast
and upcast
will do many checks at compile-time already. Read moresource§unsafe fn unsafe_cast<T>(self) -> Twhere
T: ObjectType,
unsafe fn unsafe_cast<T>(self) -> Twhere
T: ObjectType,
T
unconditionally. Read moresource§unsafe fn unsafe_cast_ref<T>(&self) -> &Twhere
T: ObjectType,
unsafe fn unsafe_cast_ref<T>(&self) -> &Twhere
T: ObjectType,
&T
unconditionally. Read moresource§impl<U> IsSubclassableExt for Uwhere
U: IsClass + ParentClassIs,
impl<U> IsSubclassableExt for Uwhere
U: IsClass + ParentClassIs,
fn parent_class_init<T>(class: &mut Class<U>)where
T: ObjectSubclass,
<U as ParentClassIs>::Parent: IsSubclassable<T>,
fn parent_instance_init<T>(instance: &mut InitializingObject<T>)where
T: ObjectSubclass,
<U as ParentClassIs>::Parent: IsSubclassable<T>,
source§impl<T> ObjectExt for Twhere
T: ObjectType,
impl<T> ObjectExt for Twhere
T: ObjectType,
source§fn is<U>(&self) -> boolwhere
U: StaticType,
fn is<U>(&self) -> boolwhere
U: StaticType,
true
if the object is an instance of (can be cast to) T
.source§fn object_class(&self) -> &Class<Object>
fn object_class(&self) -> &Class<Object>
ObjectClass
of the object. Read moresource§fn class_of<U>(&self) -> Option<&Class<U>>where
U: IsClass,
fn class_of<U>(&self) -> Option<&Class<U>>where
U: IsClass,
T
. Read moresource§fn interface<U>(&self) -> Option<InterfaceRef<'_, U>>where
U: IsInterface,
fn interface<U>(&self) -> Option<InterfaceRef<'_, U>>where
U: IsInterface,
T
of the object. Read moresource§fn set_property<V>(&self, property_name: &str, value: V)where
V: ToValue,
fn set_property<V>(&self, property_name: &str, value: V)where
V: ToValue,
source§fn set_property_from_value(&self, property_name: &str, value: &Value)
fn set_property_from_value(&self, property_name: &str, value: &Value)
source§fn set_properties(&self, property_values: &[(&str, &dyn ToValue)])
fn set_properties(&self, property_values: &[(&str, &dyn ToValue)])
source§fn set_properties_from_value(&self, property_values: &[(&str, Value)])
fn set_properties_from_value(&self, property_values: &[(&str, Value)])
source§fn property<V>(&self, property_name: &str) -> Vwhere
V: 'static + for<'b> FromValue<'b>,
fn property<V>(&self, property_name: &str) -> Vwhere
V: 'static + for<'b> FromValue<'b>,
property_name
of the object and cast it to the type V. Read moresource§fn property_value(&self, property_name: &str) -> Value
fn property_value(&self, property_name: &str) -> Value
property_name
of the object. Read moresource§fn property_type(&self, property_name: &str) -> Option<Type>
fn property_type(&self, property_name: &str) -> Option<Type>
property_name
of this object. Read moresource§fn find_property(&self, property_name: &str) -> Option<ParamSpec>
fn find_property(&self, property_name: &str) -> Option<ParamSpec>
ParamSpec
of the property property_name
of this object.source§fn list_properties(&self) -> PtrSlice<ParamSpec>
fn list_properties(&self) -> PtrSlice<ParamSpec>
ParamSpec
of the properties of this object.source§fn freeze_notify(&self) -> PropertyNotificationFreezeGuard
fn freeze_notify(&self) -> PropertyNotificationFreezeGuard
source§unsafe fn set_qdata<QD>(&self, key: Quark, value: QD)where
QD: 'static,
unsafe fn set_qdata<QD>(&self, key: Quark, value: QD)where
QD: 'static,
key
. Read moresource§unsafe fn qdata<QD>(&self, key: Quark) -> Option<NonNull<QD>>where
QD: 'static,
unsafe fn qdata<QD>(&self, key: Quark) -> Option<NonNull<QD>>where
QD: 'static,
key
. Read moresource§unsafe fn steal_qdata<QD>(&self, key: Quark) -> Option<QD>where
QD: 'static,
unsafe fn steal_qdata<QD>(&self, key: Quark) -> Option<QD>where
QD: 'static,
key
. Read moresource§unsafe fn set_data<QD>(&self, key: &str, value: QD)where
QD: 'static,
unsafe fn set_data<QD>(&self, key: &str, value: QD)where
QD: 'static,
key
. Read moresource§unsafe fn data<QD>(&self, key: &str) -> Option<NonNull<QD>>where
QD: 'static,
unsafe fn data<QD>(&self, key: &str) -> Option<NonNull<QD>>where
QD: 'static,
key
. Read moresource§unsafe fn steal_data<QD>(&self, key: &str) -> Option<QD>where
QD: 'static,
unsafe fn steal_data<QD>(&self, key: &str) -> Option<QD>where
QD: 'static,
key
. Read moresource§fn block_signal(&self, handler_id: &SignalHandlerId)
fn block_signal(&self, handler_id: &SignalHandlerId)
source§fn unblock_signal(&self, handler_id: &SignalHandlerId)
fn unblock_signal(&self, handler_id: &SignalHandlerId)
source§fn stop_signal_emission(&self, signal_id: SignalId, detail: Option<Quark>)
fn stop_signal_emission(&self, signal_id: SignalId, detail: Option<Quark>)
source§fn stop_signal_emission_by_name(&self, signal_name: &str)
fn stop_signal_emission_by_name(&self, signal_name: &str)
source§fn connect<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: 'static + Fn(&[Value]) -> Option<Value> + Send + Sync,
fn connect<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: 'static + Fn(&[Value]) -> Option<Value> + Send + Sync,
signal_name
on this object. Read moresource§fn connect_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: 'static + Fn(&[Value]) -> Option<Value> + Send + Sync,
fn connect_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: 'static + Fn(&[Value]) -> Option<Value> + Send + Sync,
signal_id
on this object. Read moresource§fn connect_local<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: 'static + Fn(&[Value]) -> Option<Value>,
fn connect_local<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: 'static + Fn(&[Value]) -> Option<Value>,
signal_name
on this object. Read moresource§fn connect_local_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: 'static + Fn(&[Value]) -> Option<Value>,
fn connect_local_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: 'static + Fn(&[Value]) -> Option<Value>,
signal_id
on this object. Read moresource§unsafe fn connect_unsafe<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: Fn(&[Value]) -> Option<Value>,
unsafe fn connect_unsafe<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: Fn(&[Value]) -> Option<Value>,
signal_name
on this object. Read moresource§unsafe fn connect_unsafe_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: Fn(&[Value]) -> Option<Value>,
unsafe fn connect_unsafe_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: Fn(&[Value]) -> Option<Value>,
signal_id
on this object. Read moresource§fn connect_closure(
&self,
signal_name: &str,
after: bool,
closure: RustClosure
) -> SignalHandlerId
fn connect_closure(
&self,
signal_name: &str,
after: bool,
closure: RustClosure
) -> SignalHandlerId
signal_name
on this object. Read moresource§fn connect_closure_id(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
closure: RustClosure
) -> SignalHandlerId
fn connect_closure_id(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
closure: RustClosure
) -> SignalHandlerId
signal_id
on this object. Read moresource§fn watch_closure(&self, closure: &impl AsRef<Closure>)
fn watch_closure(&self, closure: &impl AsRef<Closure>)
closure
to the lifetime of the object. When
the object’s reference count drops to zero, the closure will be
invalidated. An invalidated closure will ignore any calls to
invoke_with_values
, or
invoke
when using Rust closures.source§fn emit<R>(&self, signal_id: SignalId, args: &[&dyn ToValue]) -> Rwhere
R: TryFromClosureReturnValue,
fn emit<R>(&self, signal_id: SignalId, args: &[&dyn ToValue]) -> Rwhere
R: TryFromClosureReturnValue,
source§fn emit_with_values(&self, signal_id: SignalId, args: &[Value]) -> Option<Value>
fn emit_with_values(&self, signal_id: SignalId, args: &[Value]) -> Option<Value>
Self::emit
but takes Value
for the arguments.source§fn emit_by_name<R>(&self, signal_name: &str, args: &[&dyn ToValue]) -> Rwhere
R: TryFromClosureReturnValue,
fn emit_by_name<R>(&self, signal_name: &str, args: &[&dyn ToValue]) -> Rwhere
R: TryFromClosureReturnValue,
source§fn emit_by_name_with_values(
&self,
signal_name: &str,
args: &[Value]
) -> Option<Value>
fn emit_by_name_with_values(
&self,
signal_name: &str,
args: &[Value]
) -> Option<Value>
source§fn emit_by_name_with_details<R>(
&self,
signal_name: &str,
details: Quark,
args: &[&dyn ToValue]
) -> Rwhere
R: TryFromClosureReturnValue,
fn emit_by_name_with_details<R>(
&self,
signal_name: &str,
details: Quark,
args: &[&dyn ToValue]
) -> Rwhere
R: TryFromClosureReturnValue,
source§fn emit_by_name_with_details_and_values(
&self,
signal_name: &str,
details: Quark,
args: &[Value]
) -> Option<Value>
fn emit_by_name_with_details_and_values(
&self,
signal_name: &str,
details: Quark,
args: &[Value]
) -> Option<Value>
source§fn emit_with_details<R>(
&self,
signal_id: SignalId,
details: Quark,
args: &[&dyn ToValue]
) -> Rwhere
R: TryFromClosureReturnValue,
fn emit_with_details<R>(
&self,
signal_id: SignalId,
details: Quark,
args: &[&dyn ToValue]
) -> Rwhere
R: TryFromClosureReturnValue,
source§fn emit_with_details_and_values(
&self,
signal_id: SignalId,
details: Quark,
args: &[Value]
) -> Option<Value>
fn emit_with_details_and_values(
&self,
signal_id: SignalId,
details: Quark,
args: &[Value]
) -> Option<Value>
source§fn disconnect(&self, handler_id: SignalHandlerId)
fn disconnect(&self, handler_id: SignalHandlerId)
source§fn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerIdwhere
F: 'static + Fn(&T, &ParamSpec) + Send + Sync,
fn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerIdwhere
F: 'static + Fn(&T, &ParamSpec) + Send + Sync,
notify
signal of the object. Read moresource§fn connect_notify_local<F>(&self, name: Option<&str>, f: F) -> SignalHandlerIdwhere
F: 'static + Fn(&T, &ParamSpec),
fn connect_notify_local<F>(&self, name: Option<&str>, f: F) -> SignalHandlerIdwhere
F: 'static + Fn(&T, &ParamSpec),
notify
signal of the object. Read moresource§unsafe fn connect_notify_unsafe<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerIdwhere
F: Fn(&T, &ParamSpec),
unsafe fn connect_notify_unsafe<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerIdwhere
F: Fn(&T, &ParamSpec),
notify
signal of the object. Read more