gi-gtk-4.0.9: Gtk bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Gtk.Objects.InfoBar

Description

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 infoBarAddButton or InfoBar.new_with_buttons(). The sensitivity of action widgets can be controlled with infoBarSetResponseSensitive.

To add widgets to the main content area of a GtkInfoBar, use infoBarAddChild.

Similar to MessageDialog, the contents of a GtkInfoBar 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

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.

Synopsis

Exported types

newtype InfoBar Source #

Memory-managed wrapper type.

Constructors

InfoBar (ManagedPtr InfoBar) 

Instances

Instances details
Eq InfoBar Source # 
Instance details

Defined in GI.Gtk.Objects.InfoBar

Methods

(==) :: InfoBar -> InfoBar -> Bool #

(/=) :: InfoBar -> InfoBar -> Bool #

GObject InfoBar Source # 
Instance details

Defined in GI.Gtk.Objects.InfoBar

ManagedPtrNewtype InfoBar Source # 
Instance details

Defined in GI.Gtk.Objects.InfoBar

Methods

toManagedPtr :: InfoBar -> ManagedPtr InfoBar

TypedObject InfoBar Source # 
Instance details

Defined in GI.Gtk.Objects.InfoBar

Methods

glibType :: IO GType

HasParentTypes InfoBar Source # 
Instance details

Defined in GI.Gtk.Objects.InfoBar

IsGValue (Maybe InfoBar) Source #

Convert InfoBar to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gtk.Objects.InfoBar

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe InfoBar -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe InfoBar)

type ParentTypes InfoBar Source # 
Instance details

Defined in GI.Gtk.Objects.InfoBar

type ParentTypes InfoBar = '[Widget, Object, Accessible, Buildable, ConstraintTarget]

class (GObject o, IsDescendantOf InfoBar o) => IsInfoBar o Source #

Type class for types which can be safely cast to InfoBar, for instance with toInfoBar.

Instances

Instances details
(GObject o, IsDescendantOf InfoBar o) => IsInfoBar o Source # 
Instance details

Defined in GI.Gtk.Objects.InfoBar

toInfoBar :: (MonadIO m, IsInfoBar o) => o -> m InfoBar Source #

Cast to InfoBar, for types for which this is known to be safe. For general casts, use castTo.

Methods

Click to display all available methods, including inherited ones

Expand

Methods

actionSetEnabled, activate, activateAction, activateDefault, addActionWidget, addButton, addChild, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, announce, bindProperty, bindPropertyFull, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, disposeTemplate, dragCheckThreshold, errorBell, forceFloating, freezeNotify, getv, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFloating, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, notify, notifyByPspec, observeChildren, observeControllers, pick, queueAllocate, queueDraw, queueResize, realize, ref, refSink, removeActionWidget, removeChild, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, resetProperty, resetRelation, resetState, response, runDispose, shouldLayout, show, sizeAllocate, snapshotChild, stealData, stealQdata, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unsetStateFlags, updateNextAccessibleSibling, updateProperty, updateRelation, updateState, watchClosure.

Getters

getAccessibleParent, getAccessibleRole, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getAtContext, getBaseline, getBounds, getBuildableId, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getMessageType, getName, getNative, getNextAccessibleSibling, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPlatformState, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRevealed, getRoot, getScaleFactor, getSensitive, getSettings, getShowCloseButton, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth.

Setters

setAccessibleParent, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDefaultResponse, setDirection, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setMessageType, setName, setOpacity, setOverflow, setParent, setProperty, setReceivesDefault, setResponseSensitive, setRevealed, setSensitive, setShowCloseButton, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible.

addActionWidget

infoBarAddActionWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsInfoBar a, IsWidget b) 
=> a

infoBar: a GtkInfoBar

-> b

child: an activatable widget

-> Int32

responseId: response ID for child

-> m () 

Deprecated: (Since version 4.10)

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

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

addButton

infoBarAddButton Source #

Arguments

:: (HasCallStack, MonadIO m, IsInfoBar a) 
=> a

infoBar: a GtkInfoBar

-> Text

buttonText: text of button

-> Int32

responseId: response ID for the button

-> m Button

Returns: the GtkButton widget that was added

Deprecated: (Since version 4.10)

Adds a button with the given text.

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

addChild

infoBarAddChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsInfoBar a, IsWidget b) 
=> a

infoBar: a GtkInfoBar

-> b

widget: the child to be added

-> m () 

Deprecated: (Since version 4.10)

Adds a widget to the content area of the info bar.

getMessageType

infoBarGetMessageType Source #

Arguments

:: (HasCallStack, MonadIO m, IsInfoBar a) 
=> a

infoBar: a GtkInfoBar

-> m MessageType

Returns: the message type of the message area.

Deprecated: (Since version 4.10)

Returns the message type of the message area.

getRevealed

infoBarGetRevealed Source #

Arguments

:: (HasCallStack, MonadIO m, IsInfoBar a) 
=> a

infoBar: a GtkInfoBar

-> m Bool

Returns: the current value of the InfoBar:revealed property

Deprecated: (Since version 4.10)

Returns whether the info bar is currently revealed.

getShowCloseButton

infoBarGetShowCloseButton Source #

Arguments

:: (HasCallStack, MonadIO m, IsInfoBar a) 
=> a

infoBar: a GtkInfoBar

-> m Bool

Returns: True if the widget displays standard close button

Deprecated: (Since version 4.10)

Returns whether the widget will display a standard close button.

new

infoBarNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m InfoBar

Returns: a new GtkInfoBar object

Deprecated: (Since version 4.10)

Creates a new GtkInfoBar object.

removeActionWidget

infoBarRemoveActionWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsInfoBar a, IsWidget b) 
=> a

infoBar: a GtkInfoBar

-> b

widget: an action widget to remove

-> m () 

Deprecated: (Since version 4.10)

Removes a widget from the action area of infoBar.

The widget must have been put there by a call to infoBarAddActionWidget or infoBarAddButton.

removeChild

infoBarRemoveChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsInfoBar a, IsWidget b) 
=> a

infoBar: a GtkInfoBar

-> b

widget: a child that has been added to the content area

-> m () 

Deprecated: (Since version 4.10)

Removes a widget from the content area of the info bar.

response

infoBarResponse Source #

Arguments

:: (HasCallStack, MonadIO m, IsInfoBar a) 
=> a

infoBar: a GtkInfoBar

-> Int32

responseId: a response ID

-> m () 

Deprecated: (Since version 4.10)

Emits the “response” signal with the given responseId.

setDefaultResponse

infoBarSetDefaultResponse Source #

Arguments

:: (HasCallStack, MonadIO m, IsInfoBar a) 
=> a

infoBar: a GtkInfoBar

-> Int32

responseId: a response ID

-> m () 

Deprecated: (Since version 4.10)

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.

setMessageType

infoBarSetMessageType Source #

Arguments

:: (HasCallStack, MonadIO m, IsInfoBar a) 
=> a

infoBar: a GtkInfoBar

-> MessageType

messageType: a GtkMessageType

-> m () 

Deprecated: (Since version 4.10)

Sets the message type of the message area.

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

setResponseSensitive

infoBarSetResponseSensitive Source #

Arguments

:: (HasCallStack, MonadIO m, IsInfoBar a) 
=> a

infoBar: a GtkInfoBar

-> Int32

responseId: a response ID

-> Bool

setting: TRUE for sensitive

-> m () 

Deprecated: (Since version 4.10)

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.

setRevealed

infoBarSetRevealed Source #

Arguments

:: (HasCallStack, MonadIO m, IsInfoBar a) 
=> a

infoBar: a GtkInfoBar

-> Bool

revealed: The new value of the property

-> m () 

Deprecated: (Since version 4.10)

Sets whether the GtkInfoBar is revealed.

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

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

setShowCloseButton

infoBarSetShowCloseButton Source #

Arguments

:: (HasCallStack, MonadIO m, IsInfoBar a) 
=> a

infoBar: a GtkInfoBar

-> Bool

setting: True to include a close button

-> m () 

Deprecated: (Since version 4.10)

If true, a standard close button is shown.

When clicked it emits the response ResponseTypeClose.

Properties

messageType

The type of the message.

The type may be used to determine the appearance of the info bar.

constructInfoBarMessageType :: (IsInfoBar o, MonadIO m) => MessageType -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “message-type” property. This is rarely needed directly, but it is used by new.

getInfoBarMessageType :: (MonadIO m, IsInfoBar o) => o -> m MessageType Source #

Get the value of the “message-type” property. When overloading is enabled, this is equivalent to

get infoBar #messageType

setInfoBarMessageType :: (MonadIO m, IsInfoBar o) => o -> MessageType -> m () Source #

Set the value of the “message-type” property. When overloading is enabled, this is equivalent to

set infoBar [ #messageType := value ]

revealed

Whether the info bar shows its contents.

constructInfoBarRevealed :: (IsInfoBar o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “revealed” property. This is rarely needed directly, but it is used by new.

getInfoBarRevealed :: (MonadIO m, IsInfoBar o) => o -> m Bool Source #

Get the value of the “revealed” property. When overloading is enabled, this is equivalent to

get infoBar #revealed

setInfoBarRevealed :: (MonadIO m, IsInfoBar o) => o -> Bool -> m () Source #

Set the value of the “revealed” property. When overloading is enabled, this is equivalent to

set infoBar [ #revealed := value ]

showCloseButton

Whether to include a standard close button.

constructInfoBarShowCloseButton :: (IsInfoBar o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “show-close-button” property. This is rarely needed directly, but it is used by new.

getInfoBarShowCloseButton :: (MonadIO m, IsInfoBar o) => o -> m Bool Source #

Get the value of the “show-close-button” property. When overloading is enabled, this is equivalent to

get infoBar #showCloseButton

setInfoBarShowCloseButton :: (MonadIO m, IsInfoBar o) => o -> Bool -> m () Source #

Set the value of the “show-close-button” property. When overloading is enabled, this is equivalent to

set infoBar [ #showCloseButton := value ]

Signals

close

type InfoBarCloseCallback = IO () Source #

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.

afterInfoBarClose :: (IsInfoBar a, MonadIO m) => a -> ((?self :: a) => InfoBarCloseCallback) -> m SignalHandlerId Source #

Connect a signal handler for the close signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after infoBar #close callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onInfoBarClose :: (IsInfoBar a, MonadIO m) => a -> ((?self :: a) => InfoBarCloseCallback) -> m SignalHandlerId Source #

Connect a signal handler for the close signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on infoBar #close callback

response

type InfoBarResponseCallback Source #

Arguments

 = Int32

responseId: the response ID

-> IO () 

Emitted when an action widget is clicked.

The signal is also emitted when the application programmer calls infoBarResponse. The responseId depends on which action widget was clicked.

afterInfoBarResponse :: (IsInfoBar a, MonadIO m) => a -> ((?self :: a) => InfoBarResponseCallback) -> m SignalHandlerId Source #

Connect a signal handler for the response signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after infoBar #response callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onInfoBarResponse :: (IsInfoBar a, MonadIO m) => a -> ((?self :: a) => InfoBarResponseCallback) -> m SignalHandlerId Source #

Connect a signal handler for the response signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on infoBar #response callback