| Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.Gtk.Objects.InfoBar
Contents
Description
InfoBar 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 Dialog, which
has a action area at the bottom, InfoBar has an action area
at the side.
The API of InfoBar is very similar to Dialog, allowing you
to add buttons to the action area with infoBarAddButton or
gtk_info_bar_new_with_buttons(). The sensitivity of action widgets
can be controlled with infoBarSetResponseSensitive.
To add widgets to the main content area of a InfoBar, use
infoBarGetContentArea and add your widgets to the container.
Similar to MessageDialog, the contents of a InfoBar can by
classified as error message, warning, informational message, etc,
by using infoBarSetMessageType. GTK+ may use the message type
to determine how the message is displayed.
A simple example for using a GtkInfoBar:
C code
// set up info bar
GtkWidget *widget;
GtkInfoBar *bar;
widget = gtk_info_bar_new ();
bar = GTK_INFO_BAR (bar);
gtk_widget_set_no_show_all (widget, TRUE);
message_label = gtk_label_new ("");
gtk_widget_show (message_label);
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), message);
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 actionArea).
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.
- newtype InfoBar = InfoBar (ManagedPtr InfoBar)
- class GObject o => IsInfoBar o
- toInfoBar :: IsInfoBar o => o -> IO InfoBar
- noInfoBar :: Maybe InfoBar
- data InfoBarAddActionWidgetMethodInfo
- infoBarAddActionWidget :: (HasCallStack, MonadIO m, IsInfoBar a, IsWidget b) => a -> b -> Int32 -> m ()
- data InfoBarAddButtonMethodInfo
- infoBarAddButton :: (HasCallStack, MonadIO m, IsInfoBar a) => a -> Text -> Int32 -> m Button
- data InfoBarGetActionAreaMethodInfo
- infoBarGetActionArea :: (HasCallStack, MonadIO m, IsInfoBar a) => a -> m Widget
- data InfoBarGetContentAreaMethodInfo
- infoBarGetContentArea :: (HasCallStack, MonadIO m, IsInfoBar a) => a -> m Widget
- data InfoBarGetMessageTypeMethodInfo
- infoBarGetMessageType :: (HasCallStack, MonadIO m, IsInfoBar a) => a -> m MessageType
- data InfoBarGetShowCloseButtonMethodInfo
- infoBarGetShowCloseButton :: (HasCallStack, MonadIO m, IsInfoBar a) => a -> m Bool
- infoBarNew :: (HasCallStack, MonadIO m) => m InfoBar
- data InfoBarResponseMethodInfo
- infoBarResponse :: (HasCallStack, MonadIO m, IsInfoBar a) => a -> Int32 -> m ()
- data InfoBarSetDefaultResponseMethodInfo
- infoBarSetDefaultResponse :: (HasCallStack, MonadIO m, IsInfoBar a) => a -> Int32 -> m ()
- data InfoBarSetMessageTypeMethodInfo
- infoBarSetMessageType :: (HasCallStack, MonadIO m, IsInfoBar a) => a -> MessageType -> m ()
- data InfoBarSetResponseSensitiveMethodInfo
- infoBarSetResponseSensitive :: (HasCallStack, MonadIO m, IsInfoBar a) => a -> Int32 -> Bool -> m ()
- data InfoBarSetShowCloseButtonMethodInfo
- infoBarSetShowCloseButton :: (HasCallStack, MonadIO m, IsInfoBar a) => a -> Bool -> m ()
- data InfoBarMessageTypePropertyInfo
- constructInfoBarMessageType :: IsInfoBar o => MessageType -> IO (GValueConstruct o)
- getInfoBarMessageType :: (MonadIO m, IsInfoBar o) => o -> m MessageType
- infoBarMessageType :: AttrLabelProxy "messageType"
- setInfoBarMessageType :: (MonadIO m, IsInfoBar o) => o -> MessageType -> m ()
- data InfoBarShowCloseButtonPropertyInfo
- constructInfoBarShowCloseButton :: IsInfoBar o => Bool -> IO (GValueConstruct o)
- getInfoBarShowCloseButton :: (MonadIO m, IsInfoBar o) => o -> m Bool
- infoBarShowCloseButton :: AttrLabelProxy "showCloseButton"
- setInfoBarShowCloseButton :: (MonadIO m, IsInfoBar o) => o -> Bool -> m ()
- type C_InfoBarCloseCallback = Ptr () -> Ptr () -> IO ()
- type InfoBarCloseCallback = IO ()
- data InfoBarCloseSignalInfo
- afterInfoBarClose :: (GObject a, MonadIO m) => a -> InfoBarCloseCallback -> m SignalHandlerId
- genClosure_InfoBarClose :: InfoBarCloseCallback -> IO Closure
- mk_InfoBarCloseCallback :: C_InfoBarCloseCallback -> IO (FunPtr C_InfoBarCloseCallback)
- noInfoBarCloseCallback :: Maybe InfoBarCloseCallback
- onInfoBarClose :: (GObject a, MonadIO m) => a -> InfoBarCloseCallback -> m SignalHandlerId
- wrap_InfoBarCloseCallback :: InfoBarCloseCallback -> Ptr () -> Ptr () -> IO ()
- type C_InfoBarResponseCallback = Ptr () -> Int32 -> Ptr () -> IO ()
- type InfoBarResponseCallback = Int32 -> IO ()
- data InfoBarResponseSignalInfo
- afterInfoBarResponse :: (GObject a, MonadIO m) => a -> InfoBarResponseCallback -> m SignalHandlerId
- genClosure_InfoBarResponse :: InfoBarResponseCallback -> IO Closure
- mk_InfoBarResponseCallback :: C_InfoBarResponseCallback -> IO (FunPtr C_InfoBarResponseCallback)
- noInfoBarResponseCallback :: Maybe InfoBarResponseCallback
- onInfoBarResponse :: (GObject a, MonadIO m) => a -> InfoBarResponseCallback -> m SignalHandlerId
- wrap_InfoBarResponseCallback :: InfoBarResponseCallback -> Ptr () -> Int32 -> Ptr () -> IO ()
Exported types
Constructors
| InfoBar (ManagedPtr InfoBar) |
Instances
| GObject InfoBar Source # | |
| IsImplementorIface InfoBar Source # | |
| IsObject InfoBar Source # | |
| IsWidget InfoBar Source # | |
| IsContainer InfoBar Source # | |
| IsBox InfoBar Source # | |
| IsOrientable InfoBar Source # | |
| IsBuildable InfoBar Source # | |
| IsInfoBar InfoBar Source # | |
| ((~) * info (ResolveInfoBarMethod t InfoBar), MethodInfo * info InfoBar p) => IsLabel t (InfoBar -> p) Source # | |
| ((~) * info (ResolveInfoBarMethod t InfoBar), MethodInfo * info InfoBar p) => IsLabelProxy t (InfoBar -> p) Source # | |
| HasAttributeList * InfoBar Source # | |
| type AttributeList InfoBar Source # | |
| type SignalList InfoBar Source # | |
Methods
addActionWidget
data InfoBarAddActionWidgetMethodInfo Source #
Instances
| ((~) * signature (b -> Int32 -> m ()), MonadIO m, IsInfoBar a, IsWidget b) => MethodInfo * InfoBarAddActionWidgetMethodInfo a signature Source # | |
addButton
Arguments
| :: (HasCallStack, MonadIO m, IsInfoBar a) | |
| => a |
|
| -> Text |
|
| -> Int32 |
|
| -> m Button | Returns: the |
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 action area. The button widget is returned, but usually you don't need it.
Since: 2.18
getActionArea
data InfoBarGetActionAreaMethodInfo Source #
Instances
| ((~) * signature (m Widget), MonadIO m, IsInfoBar a) => MethodInfo * InfoBarGetActionAreaMethodInfo a signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m, IsInfoBar a) | |
| => a |
|
| -> m Widget | Returns: the action area |
Returns the action area of infoBar.
Since: 2.18
getContentArea
data InfoBarGetContentAreaMethodInfo Source #
Instances
| ((~) * signature (m Widget), MonadIO m, IsInfoBar a) => MethodInfo * InfoBarGetContentAreaMethodInfo a signature Source # | |
infoBarGetContentArea Source #
Arguments
| :: (HasCallStack, MonadIO m, IsInfoBar a) | |
| => a |
|
| -> m Widget | Returns: the content area |
Returns the content area of infoBar.
Since: 2.18
getMessageType
data InfoBarGetMessageTypeMethodInfo Source #
Instances
| ((~) * signature (m MessageType), MonadIO m, IsInfoBar a) => MethodInfo * InfoBarGetMessageTypeMethodInfo a signature Source # | |
infoBarGetMessageType Source #
Arguments
| :: (HasCallStack, MonadIO m, IsInfoBar a) | |
| => a |
|
| -> m MessageType | Returns: the message type of the message area. |
Returns the message type of the message area.
Since: 2.18
getShowCloseButton
data InfoBarGetShowCloseButtonMethodInfo Source #
Instances
| ((~) * signature (m Bool), MonadIO m, IsInfoBar a) => MethodInfo * InfoBarGetShowCloseButtonMethodInfo a signature Source # | |
infoBarGetShowCloseButton Source #
Arguments
| :: (HasCallStack, MonadIO m, IsInfoBar a) | |
| => a |
|
| -> m Bool | Returns: |
Returns whether the widget will display a standard close button.
Since: 3.10
new
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m InfoBar | Returns: a new |
Creates a new InfoBar object.
Since: 2.18
response
data InfoBarResponseMethodInfo Source #
Instances
| ((~) * signature (Int32 -> m ()), MonadIO m, IsInfoBar a) => MethodInfo * InfoBarResponseMethodInfo a signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m, IsInfoBar a) | |
| => a |
|
| -> Int32 |
|
| -> m () |
Emits the “response” signal with the given responseId.
Since: 2.18
setDefaultResponse
data InfoBarSetDefaultResponseMethodInfo Source #
Instances
| ((~) * signature (Int32 -> m ()), MonadIO m, IsInfoBar a) => MethodInfo * InfoBarSetDefaultResponseMethodInfo a signature Source # | |
infoBarSetDefaultResponse Source #
Arguments
| :: (HasCallStack, MonadIO m, IsInfoBar a) | |
| => a |
|
| -> Int32 |
|
| -> m () |
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 infoBar to
be added to a widget hierarchy.
Since: 2.18
setMessageType
data InfoBarSetMessageTypeMethodInfo Source #
Instances
| ((~) * signature (MessageType -> m ()), MonadIO m, IsInfoBar a) => MethodInfo * InfoBarSetMessageTypeMethodInfo a signature Source # | |
infoBarSetMessageType Source #
Arguments
| :: (HasCallStack, MonadIO m, IsInfoBar a) | |
| => a |
|
| -> MessageType |
|
| -> m () |
Sets the message type of the message area.
GTK+ uses this type to determine how the message is displayed.
Since: 2.18
setResponseSensitive
data InfoBarSetResponseSensitiveMethodInfo Source #
Instances
| ((~) * signature (Int32 -> Bool -> m ()), MonadIO m, IsInfoBar a) => MethodInfo * InfoBarSetResponseSensitiveMethodInfo a signature Source # | |
infoBarSetResponseSensitive Source #
Arguments
| :: (HasCallStack, MonadIO m, IsInfoBar a) | |
| => a |
|
| -> Int32 |
|
| -> Bool |
|
| -> m () |
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.
Since: 2.18
setShowCloseButton
data InfoBarSetShowCloseButtonMethodInfo Source #
Instances
| ((~) * signature (Bool -> m ()), MonadIO m, IsInfoBar a) => MethodInfo * InfoBarSetShowCloseButtonMethodInfo a signature Source # | |
infoBarSetShowCloseButton Source #
Arguments
| :: (HasCallStack, MonadIO m, IsInfoBar a) | |
| => a |
|
| -> Bool |
|
| -> m () |
If true, a standard close button is shown. When clicked it emits
the response ResponseTypeClose.
Since: 3.10
Properties
messageType
data InfoBarMessageTypePropertyInfo Source #
Instances
constructInfoBarMessageType :: IsInfoBar o => MessageType -> IO (GValueConstruct o) Source #
getInfoBarMessageType :: (MonadIO m, IsInfoBar o) => o -> m MessageType Source #
infoBarMessageType :: AttrLabelProxy "messageType" Source #
setInfoBarMessageType :: (MonadIO m, IsInfoBar o) => o -> MessageType -> m () Source #
showCloseButton
data InfoBarShowCloseButtonPropertyInfo Source #
Instances
constructInfoBarShowCloseButton :: IsInfoBar o => Bool -> IO (GValueConstruct o) Source #
infoBarShowCloseButton :: AttrLabelProxy "showCloseButton" Source #
Signals
close
type InfoBarCloseCallback = IO () Source #
data InfoBarCloseSignalInfo Source #
Instances
afterInfoBarClose :: (GObject a, MonadIO m) => a -> InfoBarCloseCallback -> m SignalHandlerId Source #
onInfoBarClose :: (GObject a, MonadIO m) => a -> InfoBarCloseCallback -> m SignalHandlerId Source #
wrap_InfoBarCloseCallback :: InfoBarCloseCallback -> Ptr () -> Ptr () -> IO () Source #
response
type InfoBarResponseCallback = Int32 -> IO () Source #
afterInfoBarResponse :: (GObject a, MonadIO m) => a -> InfoBarResponseCallback -> m SignalHandlerId Source #
mk_InfoBarResponseCallback :: C_InfoBarResponseCallback -> IO (FunPtr C_InfoBarResponseCallback) Source #
onInfoBarResponse :: (GObject a, MonadIO m) => a -> InfoBarResponseCallback -> m SignalHandlerId Source #
wrap_InfoBarResponseCallback :: InfoBarResponseCallback -> Ptr () -> Int32 -> Ptr () -> IO () Source #