InfoBar
open class InfoBar : Box, InfoBarProtocol
GtkInfoBar
is a widget that can be used to show messages to
the user without showing a dialog. It is often temporarily shown
at the top or bottom of a document. In contrast to GtkDialog
, which
has a action area at the bottom, GtkInfoBar
has an action area
at the side.
The API of GtkInfoBar
is very similar to GtkDialog
, allowing you
to add buttons to the action area with gtk_info_bar_add_button()
or
gtk_info_bar_new_with_buttons()
. The sensitivity of action widgets
can be controlled with gtk_info_bar_set_response_sensitive()
.
To add widgets to the main content area of a GtkInfoBar
, use
gtk_info_bar_get_content_area()
and add your widgets to the container.
Similar to GtkMessageDialog
, the contents of a GtkInfoBar
can by
classified as error message, warning, informational message, etc,
by using gtk_info_bar_set_message_type()
. GTK+ may use the message type
to determine how the message is displayed.
A simple example for using a GtkInfoBar:
(C Language Example):
GtkWidget *widget, *message_label, *content_area;
GtkWidget *grid;
GtkInfoBar *bar;
// set up info bar
widget = gtk_info_bar_new ();
bar = GTK_INFO_BAR (widget);
grid = gtk_grid_new ();
gtk_widget_set_no_show_all (widget, TRUE);
message_label = gtk_label_new ("");
content_area = gtk_info_bar_get_content_area (bar);
gtk_container_add (GTK_CONTAINER (content_area),
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
The GtkInfoBar implementation of the GtkBuildable interface exposes the content area and action area as internal children with the names “content_area” and “action_area”.
GtkInfoBar 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
).
CSS nodes
GtkInfoBar 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.
The InfoBar
type acts as a reference-counted owner of an underlying GtkInfoBar
instance.
It provides the methods that can operate on this data type through InfoBarProtocol
conformance.
Use InfoBar
as a strong reference or owner of a GtkInfoBar
instance.
-
Designated initialiser from the underlying `C` data type.
This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the
InfoBar
instance.Declaration
Swift
@inlinable public init(_ op: UnsafeMutablePointer<GtkInfoBar>)
Parameters
op
pointer to the underlying object
-
Designated initialiser from a constant pointer to the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theInfoBar
instance.Declaration
Swift
@inlinable public init(_ op: UnsafePointer<GtkInfoBar>)
Parameters
op
pointer to the underlying object
-
Optional initialiser from a non-mutating
gpointer
to the underlyingC
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theInfoBar
instance.Declaration
Swift
@inlinable override public init!(gpointer op: gpointer?)
Parameters
op
gpointer to the underlying object
-
Optional initialiser from a non-mutating
gconstpointer
to the underlyingC
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theInfoBar
instance.Declaration
Swift
@inlinable override public init!(gconstpointer op: gconstpointer?)
Parameters
op
pointer to the underlying object
-
Optional initialiser from a constant pointer to the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theInfoBar
instance.Declaration
Swift
@inlinable public init!(_ op: UnsafePointer<GtkInfoBar>?)
Parameters
op
pointer to the underlying object
-
Optional initialiser from the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theInfoBar
instance.Declaration
Swift
@inlinable public init!(_ op: UnsafeMutablePointer<GtkInfoBar>?)
Parameters
op
pointer to the underlying object
-
Designated initialiser from the underlying
C
data type. Will retainGtkInfoBar
. i.e., ownership is transferred to theInfoBar
instance.Declaration
Swift
@inlinable public init(retaining op: UnsafeMutablePointer<GtkInfoBar>)
Parameters
op
pointer to the underlying object
-
Reference intialiser for a related type that implements
InfoBarProtocol
Will retainGtkInfoBar
.Declaration
Swift
@inlinable public init<T>(infoBar other: T) where T : InfoBarProtocol
Parameters
other
an instance of a related type that implements
InfoBarProtocol
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
InfoBarProtocol
.Declaration
Swift
@inlinable override public init<T>(cPointer p: UnsafeMutablePointer<T>)
Parameters
cPointer
pointer to the underlying object
-
Unsafe typed, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
InfoBarProtocol
.Declaration
Swift
@inlinable override public init<T>(retainingCPointer cPointer: UnsafeMutablePointer<T>)
Parameters
cPointer
pointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
InfoBarProtocol
.Declaration
Swift
@inlinable override public init(raw p: UnsafeRawPointer)
Parameters
p
raw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
InfoBarProtocol
.Declaration
Swift
@inlinable override public init(retainingRaw raw: UnsafeRawPointer)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
InfoBarProtocol
.Declaration
Swift
@inlinable public required init(raw p: UnsafeMutableRawPointer)
Parameters
p
mutable raw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
InfoBarProtocol
.Declaration
Swift
@inlinable required public init(retainingRaw raw: UnsafeMutableRawPointer)
Parameters
raw
mutable raw pointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
InfoBarProtocol
.Declaration
Swift
@inlinable override public init(opaquePointer p: OpaquePointer)
Parameters
p
opaque pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
InfoBarProtocol
.Declaration
Swift
@inlinable override public init(retainingOpaquePointer p: OpaquePointer)
Parameters
p
opaque pointer to the underlying object
-
Creates a new
GtkInfoBar
object.Declaration
Swift
@inlinable public init()