gtk.info_bar
Module for InfoBar class
Types 3
#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.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 #GtkInfoBar, use gtk.info_bar.InfoBar.getContentArea 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.InfoBar.setMessageType. GTK+ may use the message type to determine how the message is displayed.
A simple example for using a #GtkInfoBar:
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.
InfoBarGidBuilder builder()Get builder for [gtk.info_bar.InfoBar] Returns: New builder objectgtk.types.MessageType messageType() @propertyGet `messageType` property. Returns: The type of the message.void messageType(gtk.types.MessageType propval) @propertySet `messageType` property. Params: propval = The type of the message.bool revealed() @propertyvoid revealed(bool propval) @propertybool showCloseButton() @propertyGet `showCloseButton` property. Returns: Whether to include a standard close button.void showCloseButton(bool propval) @propertySet `showCloseButton` property. Params: propval = Whether to include a standard close button.void addActionWidget(gtk.widget.Widget child, int responseId)Add an activatable widget to the action area of a #GtkInfoBar, connecting a signal handler that will emit the #GtkInfoBar::response signal on the message area when the widget is activated. The widg...gtk.button.Button addButton(string buttonText, int responseId)Adds a button with the given text and sets things up so that clicking the button will emit the “response” signal with the given response_id. The button is appended to the end of the info bars's...gtk.box.Box getActionArea()Returns the action area of info_bar. Returns: the action areagtk.box.Box getContentArea()Returns the content area of info_bar. Returns: the content areagtk.types.MessageType getMessageType()Returns the message type of the message area. Returns: the message type of the message area.bool getRevealed()bool getShowCloseButton()Returns whether the widget will display a standard close button. Returns: true if the widget displays standard close buttonvoid response(int responseId)Emits the “response” signal with the given response_id.void setDefaultResponse(int responseId)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.void setMessageType(gtk.types.MessageType messageType)Sets the message type of the message area.void setResponseSensitive(int responseId, bool setting)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 dialog buttons.void setRevealed(bool revealed)Sets the GtkInfoBar:revealed property to revealed. This will cause info_bar to show up with a slide-in transition.void setShowCloseButton(bool setting)If true, a standard close button is shown. When clicked it emits the response [gtk.types.ResponseType.Close].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)Connect 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)Connect to `Response` signal.Fluent builder implementation template for gtk.info_bar.InfoBar
T messageType(gtk.types.MessageType propval)Set `messageType` property. Params: propval = The type of the message.T revealed(bool propval)T showCloseButton(bool propval)Set `showCloseButton` property. Params: propval = Whether to include a standard close button. Returns: Builder instance for fluent chainingFluent builder for gtk.info_bar.InfoBar