Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
MessageDialog
presents a dialog with some message text. It’s simply a
convenience widget; you could construct the equivalent of MessageDialog
from Dialog
without too much effort, but MessageDialog
saves typing.
One difference from Dialog
is that MessageDialog
sets the
Window
:skip-taskbar-hint
property to True
, so that the dialog is hidden
from the taskbar by default.
The easiest way to do a modal message dialog is to use dialogRun
, though
you can also pass in the DialogFlagsModal
flag, dialogRun
automatically
makes the dialog modal and waits for the user to respond to it. dialogRun
returns when any dialog button is clicked.
An example for using a modal dialog:
C code
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; dialog = gtk_message_dialog_new (parent_window, flags, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Error reading “%s”: %s", filename, g_strerror (errno)); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog);
You might do a non-modal MessageDialog
as follows:
An example for a non-modal dialog:
C code
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; dialog = gtk_message_dialog_new (parent_window, flags, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Error reading “%s”: %s", filename, g_strerror (errno)); // Destroy the dialog when the user responds to it // (e.g. clicks a button) g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
GtkMessageDialog as GtkBuildable
The GtkMessageDialog implementation of the GtkBuildable interface exposes the message area as an internal child with the name “message_area”.
Synopsis
- newtype MessageDialog = MessageDialog (ManagedPtr MessageDialog)
- class (GObject o, IsDescendantOf MessageDialog o) => IsMessageDialog o
- toMessageDialog :: (MonadIO m, IsMessageDialog o) => o -> m MessageDialog
- messageDialogGetImage :: (HasCallStack, MonadIO m, IsMessageDialog a) => a -> m Widget
- messageDialogGetMessageArea :: (HasCallStack, MonadIO m, IsMessageDialog a) => a -> m Widget
- messageDialogSetImage :: (HasCallStack, MonadIO m, IsMessageDialog a, IsWidget b) => a -> b -> m ()
- messageDialogSetMarkup :: (HasCallStack, MonadIO m, IsMessageDialog a) => a -> Text -> m ()
- constructMessageDialogButtons :: (IsMessageDialog o, MonadIO m) => ButtonsType -> m (GValueConstruct o)
- constructMessageDialogImage :: (IsMessageDialog o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getMessageDialogImage :: (MonadIO m, IsMessageDialog o) => o -> m Widget
- setMessageDialogImage :: (MonadIO m, IsMessageDialog o, IsWidget a) => o -> a -> m ()
- getMessageDialogMessageArea :: (MonadIO m, IsMessageDialog o) => o -> m Widget
- constructMessageDialogMessageType :: (IsMessageDialog o, MonadIO m) => MessageType -> m (GValueConstruct o)
- getMessageDialogMessageType :: (MonadIO m, IsMessageDialog o) => o -> m MessageType
- setMessageDialogMessageType :: (MonadIO m, IsMessageDialog o) => o -> MessageType -> m ()
- clearMessageDialogSecondaryText :: (MonadIO m, IsMessageDialog o) => o -> m ()
- constructMessageDialogSecondaryText :: (IsMessageDialog o, MonadIO m) => Text -> m (GValueConstruct o)
- getMessageDialogSecondaryText :: (MonadIO m, IsMessageDialog o) => o -> m (Maybe Text)
- setMessageDialogSecondaryText :: (MonadIO m, IsMessageDialog o) => o -> Text -> m ()
- constructMessageDialogSecondaryUseMarkup :: (IsMessageDialog o, MonadIO m) => Bool -> m (GValueConstruct o)
- getMessageDialogSecondaryUseMarkup :: (MonadIO m, IsMessageDialog o) => o -> m Bool
- setMessageDialogSecondaryUseMarkup :: (MonadIO m, IsMessageDialog o) => o -> Bool -> m ()
- clearMessageDialogText :: (MonadIO m, IsMessageDialog o) => o -> m ()
- constructMessageDialogText :: (IsMessageDialog o, MonadIO m) => Text -> m (GValueConstruct o)
- getMessageDialogText :: (MonadIO m, IsMessageDialog o) => o -> m (Maybe Text)
- setMessageDialogText :: (MonadIO m, IsMessageDialog o) => o -> Text -> m ()
- constructMessageDialogUseMarkup :: (IsMessageDialog o, MonadIO m) => Bool -> m (GValueConstruct o)
- getMessageDialogUseMarkup :: (MonadIO m, IsMessageDialog o) => o -> m Bool
- setMessageDialogUseMarkup :: (MonadIO m, IsMessageDialog o) => o -> Bool -> m ()
Exported types
newtype MessageDialog Source #
Memory-managed wrapper type.
MessageDialog (ManagedPtr MessageDialog) |
Instances
Eq MessageDialog Source # | |
Defined in GI.Gtk.Objects.MessageDialog (==) :: MessageDialog -> MessageDialog -> Bool # (/=) :: MessageDialog -> MessageDialog -> Bool # | |
GObject MessageDialog Source # | |
Defined in GI.Gtk.Objects.MessageDialog | |
ManagedPtrNewtype MessageDialog Source # | |
Defined in GI.Gtk.Objects.MessageDialog toManagedPtr :: MessageDialog -> ManagedPtr MessageDialog | |
TypedObject MessageDialog Source # | |
Defined in GI.Gtk.Objects.MessageDialog | |
HasParentTypes MessageDialog Source # | |
Defined in GI.Gtk.Objects.MessageDialog | |
IsGValue (Maybe MessageDialog) Source # | Convert |
Defined in GI.Gtk.Objects.MessageDialog gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe MessageDialog -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe MessageDialog) | |
type ParentTypes MessageDialog Source # | |
Defined in GI.Gtk.Objects.MessageDialog |
class (GObject o, IsDescendantOf MessageDialog o) => IsMessageDialog o Source #
Type class for types which can be safely cast to MessageDialog
, for instance with toMessageDialog
.
Instances
(GObject o, IsDescendantOf MessageDialog o) => IsMessageDialog o Source # | |
Defined in GI.Gtk.Objects.MessageDialog |
toMessageDialog :: (MonadIO m, IsMessageDialog o) => o -> m MessageDialog Source #
Cast to MessageDialog
, 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
Methods
activate, activateDefault, activateFocus, activateKey, add, addAccelGroup, addAccelerator, addActionWidget, addButton, addChild, addDeviceEvents, addEvents, addMnemonic, addMnemonicLabel, addTickCallback, beginMoveDrag, beginResizeDrag, bindProperty, bindPropertyFull, canActivateAccel, checkResize, childFocus, childGetProperty, childNotify, childNotifyByPspec, childSetProperty, childType, classPath, close, computeExpand, constructChild, createPangoContext, createPangoLayout, customFinished, customTagEnd, customTagStart, deiconify, destroy, destroyed, deviceIsShadowed, dragBegin, dragBeginWithCoordinates, dragCheckThreshold, dragDestAddImageTargets, dragDestAddTextTargets, dragDestAddUriTargets, dragDestFindTarget, dragDestGetTargetList, dragDestGetTrackMotion, dragDestSet, dragDestSetProxy, dragDestSetTargetList, dragDestSetTrackMotion, dragDestUnset, dragGetData, dragHighlight, dragSourceAddImageTargets, dragSourceAddTextTargets, dragSourceAddUriTargets, dragSourceGetTargetList, dragSourceSet, dragSourceSetIconGicon, dragSourceSetIconName, dragSourceSetIconPixbuf, dragSourceSetIconStock, dragSourceSetTargetList, dragSourceUnset, dragUnhighlight, draw, ensureStyle, errorBell, event, forall, forceFloating, foreach, freezeChildNotify, freezeNotify, fullscreen, fullscreenOnMonitor, getv, grabAdd, grabDefault, grabFocus, grabRemove, hasDefault, hasFocus, hasGrab, hasGroup, hasRcStyle, hasScreen, hasToplevelFocus, hasVisibleFocus, hide, hideOnDelete, iconify, inDestruction, initTemplate, inputShapeCombineRegion, insertActionGroup, intersect, isActive, isAncestor, isComposited, isDrawable, isFloating, isFocus, isMaximized, isSensitive, isToplevel, isVisible, keynavFailed, listAccelClosures, listActionPrefixes, listMnemonicLabels, map, maximize, mnemonicActivate, modifyBase, modifyBg, modifyCursor, modifyFg, modifyFont, modifyStyle, modifyText, move, notify, notifyByPspec, overrideBackgroundColor, overrideColor, overrideCursor, overrideFont, overrideSymbolicColor, parseGeometry, parserFinished, path, present, presentWithTime, propagateDraw, propagateKeyEvent, queueAllocate, queueComputeExpand, queueDraw, queueDrawArea, queueDrawRegion, queueResize, queueResizeNoRedraw, realize, ref, refSink, regionIntersect, registerWindow, remove, removeAccelGroup, removeAccelerator, removeMnemonic, removeMnemonicLabel, removeTickCallback, renderIcon, renderIconPixbuf, reparent, resetRcStyles, resetStyle, reshowWithInitialSize, resize, resizeChildren, resizeGripIsVisible, resizeToGeometry, response, run, runDispose, sendExpose, sendFocusChange, shapeCombineRegion, show, showAll, showNow, sizeAllocate, sizeAllocateWithBaseline, sizeRequest, stealData, stealQdata, stick, styleAttach, styleGetProperty, thawChildNotify, thawNotify, translateCoordinates, triggerTooltipQuery, unfullscreen, unmap, unmaximize, unparent, unrealize, unref, unregisterWindow, unsetFocusChain, unsetStateFlags, unstick, watchClosure.
Getters
getAcceptFocus, getAccessible, getActionArea, getActionGroup, getAllocatedBaseline, getAllocatedHeight, getAllocatedSize, getAllocatedWidth, getAllocation, getAncestor, getAppPaintable, getApplication, getAttachedTo, getBorderWidth, getCanDefault, getCanFocus, getChild, getChildRequisition, getChildVisible, getChildren, getClip, getClipboard, getCompositeName, getContentArea, getData, getDecorated, getDefaultSize, getDefaultWidget, getDeletable, getDestroyWithParent, getDeviceEnabled, getDeviceEvents, getDirection, getDisplay, getDoubleBuffered, getEvents, getFocus, getFocusChain, getFocusChild, getFocusHadjustment, getFocusOnClick, getFocusOnMap, getFocusVadjustment, getFocusVisible, getFontMap, getFontOptions, getFrameClock, getGravity, getGroup, getHalign, getHasResizeGrip, getHasTooltip, getHasWindow, getHeaderBar, getHexpand, getHexpandSet, getHideTitlebarWhenMaximized, getIcon, getIconList, getIconName, getImage, getInternalChild, getMapped, getMarginBottom, getMarginEnd, getMarginLeft, getMarginRight, getMarginStart, getMarginTop, getMessageArea, getMnemonicModifier, getMnemonicsVisible, getModal, getModifierMask, getModifierStyle, getName, getNoShowAll, getOpacity, getPangoContext, getParent, getParentWindow, getPath, getPathForChild, getPointer, getPosition, getPreferredHeight, getPreferredHeightAndBaselineForWidth, getPreferredHeightForWidth, getPreferredSize, getPreferredWidth, getPreferredWidthForHeight, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRequisition, getResizable, getResizeGripArea, getResizeMode, getResponseForWidget, getRole, getRootWindow, getScaleFactor, getScreen, getSensitive, getSettings, getSize, getSizeRequest, getSkipPagerHint, getSkipTaskbarHint, getState, getStateFlags, getStyle, getStyleContext, getSupportMultidevice, getTemplateChild, getTitle, getTitlebar, getTooltipMarkup, getTooltipText, getTooltipWindow, getToplevel, getTransientFor, getTypeHint, getUrgencyHint, getValign, getValignWithBaseline, getVexpand, getVexpandSet, getVisible, getVisual, getWidgetForResponse, getWindow, getWindowType.
Setters
setAccelPath, setAcceptFocus, setAllocation, setAlternativeButtonOrderFromArray, setAppPaintable, setApplication, setAttachedTo, setBorderWidth, setBuildableProperty, setCanDefault, setCanFocus, setChildVisible, setClip, setCompositeName, setData, setDataFull, setDecorated, setDefault, setDefaultGeometry, setDefaultResponse, setDefaultSize, setDeletable, setDestroyWithParent, setDeviceEnabled, setDeviceEvents, setDirection, setDoubleBuffered, setEvents, setFocus, setFocusChain, setFocusChild, setFocusHadjustment, setFocusOnClick, setFocusOnMap, setFocusVadjustment, setFocusVisible, setFontMap, setFontOptions, setGeometryHints, setGravity, setHalign, setHasResizeGrip, setHasTooltip, setHasUserRefCount, setHasWindow, setHexpand, setHexpandSet, setHideTitlebarWhenMaximized, setIcon, setIconFromFile, setIconList, setIconName, setImage, setKeepAbove, setKeepBelow, setMapped, setMarginBottom, setMarginEnd, setMarginLeft, setMarginRight, setMarginStart, setMarginTop, setMarkup, setMnemonicModifier, setMnemonicsVisible, setModal, setName, setNoShowAll, setOpacity, setParent, setParentWindow, setPosition, setProperty, setRealized, setReallocateRedraws, setReceivesDefault, setRedrawOnAllocate, setResizable, setResizeMode, setResponseSensitive, setRole, setScreen, setSensitive, setSizeRequest, setSkipPagerHint, setSkipTaskbarHint, setStartupId, setState, setStateFlags, setStyle, setSupportMultidevice, setTitle, setTitlebar, setTooltipMarkup, setTooltipText, setTooltipWindow, setTransientFor, setTypeHint, setUrgencyHint, setValign, setVexpand, setVexpandSet, setVisible, setVisual, setWindow, setWmclass.
getImage
messageDialogGetImage Source #
:: (HasCallStack, MonadIO m, IsMessageDialog a) | |
=> a |
|
-> m Widget | Returns: the dialog’s image |
Deprecated: (Since version 3.12)Use Dialog
for dialogs with images
Gets the dialog’s image.
Since: 2.14
getMessageArea
messageDialogGetMessageArea Source #
:: (HasCallStack, MonadIO m, IsMessageDialog a) | |
=> a |
|
-> m Widget | Returns: A |
Returns the message area of the dialog. This is the box where the
dialog’s primary and secondary labels are packed. You can add your
own extra content to that box and it will appear below those labels.
See dialogGetContentArea
for the corresponding
function in the parent Dialog
.
Since: 2.22
setImage
messageDialogSetImage Source #
:: (HasCallStack, MonadIO m, IsMessageDialog a, IsWidget b) | |
=> a |
|
-> b |
|
-> m () |
Deprecated: (Since version 3.12)Use Dialog
to create dialogs with images
Sets the dialog’s image to image
.
Since: 2.10
setMarkup
messageDialogSetMarkup Source #
:: (HasCallStack, MonadIO m, IsMessageDialog a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the text of the message dialog to be str
, which is marked
up with the [Pango text markup language][PangoMarkupFormat].
Since: 2.4
Properties
buttons
No description available in the introspection data.
constructMessageDialogButtons :: (IsMessageDialog o, MonadIO m) => ButtonsType -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “buttons
” property. This is rarely needed directly, but it is used by new
.
image
The image for this dialog.
Since: 2.10
constructMessageDialogImage :: (IsMessageDialog o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “image
” property. This is rarely needed directly, but it is used by new
.
getMessageDialogImage :: (MonadIO m, IsMessageDialog o) => o -> m Widget Source #
Get the value of the “image
” property.
When overloading is enabled, this is equivalent to
get
messageDialog #image
setMessageDialogImage :: (MonadIO m, IsMessageDialog o, IsWidget a) => o -> a -> m () Source #
Set the value of the “image
” property.
When overloading is enabled, this is equivalent to
set
messageDialog [ #image:=
value ]
messageArea
The Box
that corresponds to the message area of this dialog. See
messageDialogGetMessageArea
for a detailed description of this
area.
Since: 2.22
getMessageDialogMessageArea :: (MonadIO m, IsMessageDialog o) => o -> m Widget Source #
Get the value of the “message-area
” property.
When overloading is enabled, this is equivalent to
get
messageDialog #messageArea
messageType
The type of the message.
constructMessageDialogMessageType :: (IsMessageDialog 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
.
getMessageDialogMessageType :: (MonadIO m, IsMessageDialog o) => o -> m MessageType Source #
Get the value of the “message-type
” property.
When overloading is enabled, this is equivalent to
get
messageDialog #messageType
setMessageDialogMessageType :: (MonadIO m, IsMessageDialog o) => o -> MessageType -> m () Source #
Set the value of the “message-type
” property.
When overloading is enabled, this is equivalent to
set
messageDialog [ #messageType:=
value ]
secondaryText
The secondary text of the message dialog.
Since: 2.10
clearMessageDialogSecondaryText :: (MonadIO m, IsMessageDialog o) => o -> m () Source #
Set the value of the “secondary-text
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#secondaryText
constructMessageDialogSecondaryText :: (IsMessageDialog o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “secondary-text
” property. This is rarely needed directly, but it is used by new
.
getMessageDialogSecondaryText :: (MonadIO m, IsMessageDialog o) => o -> m (Maybe Text) Source #
Get the value of the “secondary-text
” property.
When overloading is enabled, this is equivalent to
get
messageDialog #secondaryText
setMessageDialogSecondaryText :: (MonadIO m, IsMessageDialog o) => o -> Text -> m () Source #
Set the value of the “secondary-text
” property.
When overloading is enabled, this is equivalent to
set
messageDialog [ #secondaryText:=
value ]
secondaryUseMarkup
True
if the secondary text of the dialog includes Pango markup.
See parseMarkup
.
Since: 2.10
constructMessageDialogSecondaryUseMarkup :: (IsMessageDialog o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “secondary-use-markup
” property. This is rarely needed directly, but it is used by new
.
getMessageDialogSecondaryUseMarkup :: (MonadIO m, IsMessageDialog o) => o -> m Bool Source #
Get the value of the “secondary-use-markup
” property.
When overloading is enabled, this is equivalent to
get
messageDialog #secondaryUseMarkup
setMessageDialogSecondaryUseMarkup :: (MonadIO m, IsMessageDialog o) => o -> Bool -> m () Source #
Set the value of the “secondary-use-markup
” property.
When overloading is enabled, this is equivalent to
set
messageDialog [ #secondaryUseMarkup:=
value ]
text
The primary text of the message dialog. If the dialog has a secondary text, this will appear as the title.
Since: 2.10
clearMessageDialogText :: (MonadIO m, IsMessageDialog o) => o -> m () Source #
Set the value of the “text
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#text
constructMessageDialogText :: (IsMessageDialog o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “text
” property. This is rarely needed directly, but it is used by new
.
getMessageDialogText :: (MonadIO m, IsMessageDialog o) => o -> m (Maybe Text) Source #
Get the value of the “text
” property.
When overloading is enabled, this is equivalent to
get
messageDialog #text
setMessageDialogText :: (MonadIO m, IsMessageDialog o) => o -> Text -> m () Source #
Set the value of the “text
” property.
When overloading is enabled, this is equivalent to
set
messageDialog [ #text:=
value ]
useMarkup
True
if the primary text of the dialog includes Pango markup.
See parseMarkup
.
Since: 2.10
constructMessageDialogUseMarkup :: (IsMessageDialog o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “use-markup
” property. This is rarely needed directly, but it is used by new
.
getMessageDialogUseMarkup :: (MonadIO m, IsMessageDialog o) => o -> m Bool Source #
Get the value of the “use-markup
” property.
When overloading is enabled, this is equivalent to
get
messageDialog #useMarkup
setMessageDialogUseMarkup :: (MonadIO m, IsMessageDialog o) => o -> Bool -> m () Source #
Set the value of the “use-markup
” property.
When overloading is enabled, this is equivalent to
set
messageDialog [ #useMarkup:=
value ]