Class InfoBar
- All Implemented Interfaces:
Proxy
,Accessible
,Buildable
,ConstraintTarget
GtkInfoBar
can be used to 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, 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(java.lang.String, int)
or withButtons(java.lang.String, java.lang.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(org.gnome.gtk.Widget)
.
Similar to MessageDialog
, the contents of a GtkInfoBar
can by classified as error message, warning, informational message, etc,
by using setMessageType(org.gnome.gtk.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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
InfoBar.Builder<B extends InfoBar.Builder<B>>
Deprecated.Inner class implementing a builder pattern to construct a GObject with properties.static interface
Deprecated.Functional interface declaration of theCloseCallback
callback.static interface
Deprecated.Functional interface declaration of theResponseCallback
callback.Nested classes/interfaces inherited from class org.gnome.gtk.Widget
Widget.DestroyCallback, Widget.DirectionChangedCallback, Widget.HideCallback, Widget.KeynavFailedCallback, Widget.MapCallback, Widget.MnemonicActivateCallback, Widget.MoveFocusCallback, Widget.QueryTooltipCallback, Widget.RealizeCallback, Widget.ShowCallback, Widget.StateFlagsChangedCallback, Widget.UnmapCallback, Widget.UnrealizeCallback, Widget.WidgetClass, Widget.WidgetImpl
Nested classes/interfaces inherited from class org.gnome.gobject.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClass
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
Nested classes/interfaces inherited from interface org.gnome.gtk.Accessible
Accessible.AccessibleImpl, Accessible.AccessibleInterface
Nested classes/interfaces inherited from interface org.gnome.gtk.Buildable
Buildable.BuildableIface, Buildable.BuildableImpl
Nested classes/interfaces inherited from interface org.gnome.gtk.ConstraintTarget
ConstraintTarget.ConstraintTargetImpl, ConstraintTarget.ConstraintTargetInterface
-
Constructor Summary
ConstructorDescriptionInfoBar()
Deprecated.InfoBar
(MemorySegment address) Deprecated.Create a InfoBar proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addActionWidget
(Widget child, int responseId) Deprecated.Deprecated.void
addButtons
(String firstButtonText, Object... varargs) Deprecated.void
Deprecated.protected InfoBar
asParent()
Deprecated.Returns this instance as if it were its parent type.static InfoBar.Builder
<? extends InfoBar.Builder> builder()
Deprecated.AInfoBar.Builder
object constructs aInfoBar
with the specified properties.void
Deprecated.Emits the "close" signal.void
emitResponse
(int responseId) Deprecated.Emits the "response" signal.Deprecated.boolean
Deprecated.boolean
Deprecated.static Type
getType()
Deprecated.Get the GType of the InfoBar classonClose
(InfoBar.CloseCallback handler) Deprecated.Gets emitted when the user uses a keybinding to dismiss the info bar.onResponse
(InfoBar.ResponseCallback handler) Deprecated.Emitted when an action widget is clicked.void
removeActionWidget
(Widget widget) Deprecated.void
removeChild
(Widget widget) Deprecated.void
response
(int responseId) Deprecated.void
setDefaultResponse
(int responseId) Deprecated.void
setMessageType
(MessageType messageType) Deprecated.void
setResponseSensitive
(int responseId, boolean setting) Deprecated.void
setRevealed
(boolean revealed) Deprecated.void
setShowCloseButton
(boolean setting) Deprecated.static InfoBar
withButtons
(@Nullable String firstButtonText, Object... varargs) Deprecated.Methods inherited from class org.gnome.gtk.Widget
actionSetEnabled, activateActionIfExists, activateDefault, activateWidget, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, childFocus, computeBounds, computeExpand, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, cssChanged, directionChanged, disposeTemplate, dragCheckThreshold, emitDestroy, emitDirectionChanged, emitHide, emitKeynavFailed, emitMap, emitMnemonicActivate, emitMoveFocus, emitQueryTooltip, emitRealize, emitShow, emitStateFlagsChanged, emitUnmap, emitUnrealize, errorBell, focus, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getBaseline, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getDefaultDirection, getDirection, getDisplay, getFirstChild, getFocusable, getFocusChild, getFocusOnClick, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getMemoryLayout, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, moveFocus, observeChildren, observeControllers, onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, pick, pick, queryTooltip, queueAllocate, queueDraw, queueResize, realize, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, root, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setDefaultDirection, setDirection, setFocusable, setFocusChild, setFocusOnClick, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, shouldLayout, show, sizeAllocate, sizeAllocate, snapshot, snapshotChild, stateFlagsChanged, systemSettingChanged, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unroot, unsetStateFlags, unsetStateFlags
Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newInstance, newInstance, newv, notify_, notify_, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.gnome.gtk.Accessible
announce, getAccessibleParent, getAccessibleRole, getAtContext, getBounds, getFirstAccessibleChild, getNextAccessibleSibling, getPlatformState, resetProperty, resetRelation, resetState, setAccessibleParent, updateNextAccessibleSibling, updateProperty, updateRelation, updateState
Methods inherited from interface org.gnome.gtk.Buildable
getBuildableId
-
Constructor Details
-
InfoBar
Deprecated.Create a InfoBar proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
InfoBar
-
-
Method Details
-
getType
-
asParent
Deprecated.Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type. -
withButtons
@Deprecated public static InfoBar withButtons(@Nullable @Nullable String firstButtonText, Object... varargs) Deprecated.Creates a newGtkInfoBar
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 theGtkResponseType
enumeration. If the user clicks one of these dialog buttons, GtkInfoBar will emit theGtk.InfoBar::response
signal with the corresponding response ID.- Parameters:
firstButtonText
- ext to go in first buttonvarargs
- response ID for first button, then additional buttons, ending withnull
- Returns:
- a new
GtkInfoBar
-
addActionWidget
Deprecated.Add an activatable widget to the action area of aGtkInfoBar
.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 widgetresponseId
- response ID forchild
-
addButton
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 buttonresponseId
- response ID for the button- Returns:
- the
GtkButton
widget that was added
-
addButtons
Deprecated.Adds multiple buttons.This is the same as calling
addButton(java.lang.String, int)
repeatedly. The variable argument list should benull
-terminated as withwithButtons(java.lang.String, java.lang.Object...)
. Each button must have both text and response ID.- Parameters:
firstButtonText
- button textvarargs
- response ID for first button, then more text-response_id pairs, ending withnull
-
addChild
Deprecated.Adds a widget to the content area of the info bar.- Parameters:
widget
- the child to be added
-
getMessageType
Deprecated.Returns the message type of the message area.- Returns:
- the message type of the message area.
-
getRevealed
Deprecated.Returns whether the info bar is currently revealed.- Returns:
- the current value of the
Gtk.InfoBar:revealed
property
-
getShowCloseButton
Deprecated.Returns whether the widget will display a standard close button.- Returns:
true
if the widget displays standard close button
-
removeActionWidget
Deprecated.Removes a widget from the action area of this InfoBar.The widget must have been put there by a call to
addActionWidget(org.gnome.gtk.Widget, int)
oraddButton(java.lang.String, int)
.- Parameters:
widget
- an action widget to remove
-
removeChild
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.Emits the “response” signal with the givenresponseId
.- Parameters:
responseId
- a response ID
-
setDefaultResponse
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.Sets the message type of the message area.GTK uses this type to determine how the message is displayed.
- Parameters:
messageType
- aGtkMessageType
-
setResponseSensitive
Deprecated.Sets the sensitivity of action widgets forresponseId
.Calls
gtk_widget_set_sensitive (widget, setting)
for each widget in the info bars’s action area with the givenresponseId
. A convenient way to sensitize/desensitize buttons.- Parameters:
responseId
- a response IDsetting
- TRUE for sensitive
-
setRevealed
Deprecated.Sets whether theGtkInfoBar
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 ifGtk.Widget:visible
isfalse
.- Parameters:
revealed
- The new value of the property
-
setShowCloseButton
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. SeeonClose(org.gnome.gtk.InfoBar.CloseCallback)
. -
onResponse
Deprecated.Emitted when an action widget is clicked.The signal is also emitted when the application programmer calls
response(int)
. TheresponseId
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. SeeonResponse(org.gnome.gtk.InfoBar.ResponseCallback)
. -
builder
Deprecated.AInfoBar.Builder
object constructs aInfoBar
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withInfoBar.Builder.build()
.
-