gtk.info_bar

Module for [InfoBar] class

Types 3

gtk.info_bar.InfoBar can be used to show messages to the user without a dialog.

!An example GtkInfoBar

It is often temporarily shown at the top or bottom of a document. In contrast to gtk.dialog.Dialog, which has an action area at the bottom, gtk.info_bar.InfoBar has an action area at the side.

The API of gtk.info_bar.InfoBar is very similar to gtk.dialog.Dialog, allowing you to add buttons to the action area with gtk.info_bar.InfoBar.addButton or gtk.info_bar.InfoBar.newWithButtons. The sensitivity of action widgets can be controlled with gtk.info_bar.InfoBar.setResponseSensitive.

To add widgets to the main content area of a gtk.info_bar.InfoBar, use gtk.info_bar.InfoBar.addChild.

Similar to gtk.message_dialog.MessageDialog, the contents of a gtk.info_bar.InfoBar can by classified as error message, warning, informational message, etc, by using gtk.info_bar.InfoBar.setMessageType. GTK may use the message type to determine how the message is displayed.

A simple example for using a gtk.info_bar.InfoBar:

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

gtk.info_bar.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).

gtk.info_bar.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

gtk.info_bar.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.

Deprecated

There is no replacement in GTK for an "info bar" widget;

you can use gtk.revealer.Revealer with a gtk.box.Box containing a gtk.label.Label and an optional gtk.button.Button, according to your application's design.

Methods
GType _getGType() static nothrow
GType _gType() @property nothrow
InfoBar self() nothrowReturns `this`, for use in `with` statements.
InfoBarGidBuilder builder() static nothrowGet builder for [gtk.info_bar.InfoBar] Returns: New builder object
gtk.types.MessageType messageType() @property nothrowGet `messageType` property. Returns: The type of the message.
void messageType(gtk.types.MessageType propval) @property nothrowSet `messageType` property. Params: propval = The type of the message.
bool revealed() @property nothrowGet `revealed` property. Returns: Whether the info bar shows its contents.
void revealed(bool propval) @property nothrowSet `revealed` property. Params: propval = Whether the info bar shows its contents.
bool showCloseButton() @property nothrowGet `showCloseButton` property. Returns: Whether to include a standard close button.
void showCloseButton(bool propval) @property nothrowSet `showCloseButton` property. Params: propval = Whether to include a standard close button.
void addActionWidget(gtk.widget.Widget child, int responseId) nothrowAdd an activatable widget to the action area of a [gtk.info_bar.InfoBar].
gtk.button.Button addButton(string buttonText, int responseId) nothrowAdds a button with the given text.
void addChild(gtk.widget.Widget widget) nothrowAdds a widget to the content area of the info bar.
gtk.types.MessageType getMessageType() nothrowReturns the message type of the message area. Returns: the message type of the message area.
bool getRevealed() nothrowReturns whether the info bar is currently revealed. Returns: the current value of the [gtk.info_bar.InfoBar.revealed] property
bool getShowCloseButton() nothrowReturns whether the widget will display a standard close button. Returns: true if the widget displays standard close button
void removeActionWidget(gtk.widget.Widget widget) nothrowRemoves a widget from the action area of info_bar.
void removeChild(gtk.widget.Widget widget) nothrowRemoves a widget from the content area of the info bar.
void response(int responseId) nothrowEmits the “response” signal with the given response_id.
void setDefaultResponse(int responseId) nothrowSets the last widget in the info bar’s action area with the given response_id as the default widget for the dialog.
void setMessageType(gtk.types.MessageType messageType) nothrowSets the message type of the message area.
void setResponseSensitive(int responseId, bool setting) nothrowSets the sensitivity of action widgets for response_id.
void setRevealed(bool revealed) nothrowSets whether the [gtk.info_bar.InfoBar] is revealed.
void setShowCloseButton(bool setting) nothrowIf true, a standard close button is shown.
gulong connectClose(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.info_bar.InfoBar))) && Parameters!T.length < 2) nothrowConnect to `Close` signal.
gulong connectResponse(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == int))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.info_bar.InfoBar))) && Parameters!T.length < 3) nothrowConnect to `Response` signal.
Constructors
this(void * ptr, Flag!"Take" take)
this()Creates a new [gtk.info_bar.InfoBar] object. Returns: a new [gtk.info_bar.InfoBar] object

Fluent builder implementation template for gtk.info_bar.InfoBar

Methods
T messageType(gtk.types.MessageType propval) nothrowSet `messageType` property. Params: propval = The type of the message.
T revealed(bool propval) nothrowSet `revealed` property. Params: propval = Whether the info bar shows its contents. Returns: Builder instance for fluent chaining
T showCloseButton(bool propval) nothrowSet `showCloseButton` property. Params: propval = Whether to include a standard close button. Returns: Builder instance for fluent chaining

Fluent builder for gtk.info_bar.InfoBar

Methods
InfoBar build() nothrowCreate object from builder. Returns: New object