Class InfoBar

All Implemented Interfaces:
Accessible, Buildable, ConstraintTarget, Proxy

@Generated("org.javagi.JavaGI") @Deprecated public class InfoBar extends Widget implements Accessible, Buildable, ConstraintTarget
Deprecated.
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.

GtkInfoBar 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 Dialog, which has an 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 addButton(String, int) or withButtons(String, Object...). The sensitivity of action widgets can be controlled with setResponseSensitive(int, boolean).

To add widgets to the main content area of a GtkInfoBar, use addChild(Widget).

Similar to MessageDialog, the contents of a GtkInfoBar can by classified as error message, warning, informational message, etc, by using setMessageType(MessageType). GTK may use the message type to determine how the message is displayed.

A simple example for using a GtkInfoBar:

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

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 actionArea).

GtkInfoBar 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

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. If the info bar shows a close button, that button will have the .close style class applied.

  • Constructor Details

    • InfoBar

      public InfoBar(MemorySegment address)
      Deprecated.
      Create a InfoBar instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • InfoBar

      public InfoBar()
      Deprecated.
      Create a new InfoBar.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Deprecated.
      Get the GType of the InfoBar class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      Deprecated.
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected InfoBar asParent()
      Deprecated.
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class Widget
      Returns:
      the instance as if it were its parent type
    • withButtons

      @Deprecated public static InfoBar withButtons(@Nullable String firstButtonText, Object... varargs)
      Deprecated.

      Creates a new GtkInfoBar with buttons.

      Button text/response ID pairs should be listed, with a null pointer ending the list. A response ID can be any positive number, or one of the values in the GtkResponseType enumeration. If the user clicks one of these dialog buttons, GtkInfoBar will emit the Gtk.InfoBar::response signal with the corresponding response ID.

      Parameters:
      firstButtonText - ext to go in first button
      varargs - response ID for first button, then additional buttons, ending with null
      Returns:
      a new GtkInfoBar
    • addActionWidget

      @Deprecated public void addActionWidget(Widget child, int responseId)
      Deprecated.

      Add an activatable widget to the action area of a GtkInfoBar.

      This also connects a signal handler that will emit the Gtk.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.

      Parameters:
      child - an activatable widget
      responseId - response ID for child
    • addButton

      @Deprecated public Button addButton(String buttonText, int responseId)
      Deprecated.

      Adds a button with the given text.

      Clicking the button will emit the Gtk.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.

      Parameters:
      buttonText - text of button
      responseId - response ID for the button
      Returns:
      the GtkButton widget that was added
    • addButtons

      @Deprecated public void addButtons(String firstButtonText, Object... varargs)
      Deprecated.

      Adds multiple buttons.

      This is the same as calling addButton(String, int) repeatedly. The variable argument list should be null-terminated as with withButtons(String, Object...). Each button must have both text and response ID.

      Parameters:
      firstButtonText - button text
      varargs - response ID for first button, then more text-response_id pairs, ending with null
    • addChild

      @Deprecated public void addChild(Widget widget)
      Deprecated.
      Adds a widget to the content area of the info bar.
      Parameters:
      widget - the child to be added
    • getMessageType

      @Deprecated public MessageType getMessageType()
      Deprecated.
      Returns the message type of the message area.
      Returns:
      the message type of the message area.
    • getRevealed

      @Deprecated public boolean getRevealed()
      Deprecated.
      Returns whether the info bar is currently revealed.
      Returns:
      the current value of the Gtk.InfoBar:revealed property
    • getShowCloseButton

      @Deprecated public boolean getShowCloseButton()
      Deprecated.
      Returns whether the widget will display a standard close button.
      Returns:
      true if the widget displays standard close button
    • removeActionWidget

      @Deprecated public void removeActionWidget(Widget widget)
      Deprecated.

      Removes a widget from the action area of infoBar.

      The widget must have been put there by a call to addActionWidget(Widget, int) or addButton(String, int).

      Parameters:
      widget - an action widget to remove
    • removeChild

      @Deprecated public void removeChild(Widget widget)
      Deprecated.
      Removes a widget from the content area of the info bar.
      Parameters:
      widget - a child that has been added to the content area
    • response

      @Deprecated public void response(int responseId)
      Deprecated.
      Emits the “response” signal with the given responseId.
      Parameters:
      responseId - a response ID
    • setDefaultResponse

      @Deprecated public void setDefaultResponse(int responseId)
      Deprecated.

      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 this InfoBar to be added to a widget hierarchy.

      Parameters:
      responseId - a response ID
    • setMessageType

      @Deprecated public void setMessageType(MessageType messageType)
      Deprecated.

      Sets the message type of the message area.

      GTK uses this type to determine how the message is displayed.

      Parameters:
      messageType - a GtkMessageType
    • setResponseSensitive

      @Deprecated public void setResponseSensitive(int responseId, boolean setting)
      Deprecated.

      Sets the sensitivity of action widgets for responseId.

      Calls gtk_widget_set_sensitive (widget, setting) for each widget in the info bars’s action area with the given responseId. A convenient way to sensitize/desensitize buttons.

      Parameters:
      responseId - a response ID
      setting - TRUE for sensitive
    • setRevealed

      @Deprecated public void setRevealed(boolean revealed)
      Deprecated.

      Sets whether the GtkInfoBar is revealed.

      Changing this will make this InfoBar reveal or conceal itself via a sliding transition.

      Note: this does not show or hide this InfoBar in the Gtk.Widget:visible sense, so revealing has no effect if Gtk.Widget:visible is false.

      Parameters:
      revealed - The new value of the property
    • setShowCloseButton

      @Deprecated public void setShowCloseButton(boolean setting)
      Deprecated.

      If true, a standard close button is shown.

      When clicked it emits the response ResponseType.CLOSE.

      Parameters:
      setting - true to include a close button
    • onClose

      Deprecated.

      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.

      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      See Also:
    • emitClose

      public void emitClose()
      Deprecated.
      Emits the "close" signal. See onClose(InfoBar.CloseCallback).
    • onResponse

      Deprecated.

      Emitted when an action widget is clicked.

      The signal is also emitted when the application programmer calls response(int). The responseId depends on which action widget was clicked.

      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      See Also:
    • emitResponse

      public void emitResponse(int responseId)
      Deprecated.
      Emits the "response" signal. See onResponse(InfoBar.ResponseCallback).
    • builder

      public static InfoBar.Builder<? extends InfoBar.Builder> builder()
      Deprecated.
      A InfoBar.Builder object constructs a InfoBar with the specified properties. Use the various set...() methods to set properties, and finish construction with InfoBar.Builder.build().
      Returns:
      the builder object