Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
GI.Adw.Objects.AlertDialog
Contents
- Exported types
- Methods
- addResponse
- choose
- chooseFinish
- getBody
- getBodyUseMarkup
- getCloseResponse
- getDefaultResponse
- getExtraChild
- getHeading
- getHeadingUseMarkup
- getResponseAppearance
- getResponseEnabled
- getResponseLabel
- hasResponse
- new
- removeResponse
- setBody
- setBodyUseMarkup
- setCloseResponse
- setDefaultResponse
- setExtraChild
- setHeading
- setHeadingUseMarkup
- setResponseAppearance
- setResponseEnabled
- setResponseLabel
- Properties
- Signals
Description
A dialog presenting a message or a question.
<picture> <source srcset="alert-dialog-dark.png" media="(prefers-color-scheme: dark)"> <img src="alert-dialog.png" alt="alert-dialog"> </picture>
Alert dialogs have a heading, a body, an optional child widget, and one or multiple responses, each presented as a button.
Each response has a unique string ID, and a button label. Additionally, each response can be enabled or disabled, and can have a suggested or destructive appearance.
When one of the responses is activated, or the dialog is closed, the
signalalertDialog
[response] signal will be emitted. This signal is
detailed, and the detail, as well as the response
parameter will be set to
the ID of the activated response, or to the value of the
[propertyalertDialog
:close-response] property if the dialog had been closed
without activating any of the responses.
Response buttons can be presented horizontally or vertically depending on available space.
When a response is activated, AdwAlertDialog
is closed automatically.
An example of using an alert dialog:
c code
AdwDialog *dialog; dialog = adw_alert_dialog_new (_("Replace File?"), NULL); adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog), _("A file named “%s” already exists. Do you want to replace it?"), filename); adw_alert_dialog_add_responses (ADW_ALERT_DIALOG (dialog), "cancel", _("_Cancel"), "replace", _("_Replace"), NULL); adw_alert_dialog_set_response_appearance (ADW_ALERT_DIALOG (dialog), "replace", ADW_RESPONSE_DESTRUCTIVE); adw_alert_dialog_set_default_response (ADW_ALERT_DIALOG (dialog), "cancel"); adw_alert_dialog_set_close_response (ADW_ALERT_DIALOG (dialog), "cancel"); g_signal_connect (dialog, "response", G_CALLBACK (response_cb), self); adw_dialog_present (dialog, parent);
Async API
AdwAlertDialog
can also be used via the [methodalertDialog
.choose] method.
This API follows the GIO async pattern, and the result can be obtained by
calling [methodalertDialog
.choose_finish], for example:
c code
static void dialog_cb (AdwAlertDialog *dialog, GAsyncResult *result, MyWindow *self) { const char *response = adw_alert_dialog_choose_finish (dialog, result); // ... } static void show_dialog (MyWindow *self) { AdwDialog *dialog; dialog = adw_alert_dialog_new (_("Replace File?"), NULL); adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog), _("A file named “%s” already exists. Do you want to replace it?"), filename); adw_alert_dialog_add_responses (ADW_ALERT_DIALOG (dialog), "cancel", _("_Cancel"), "replace", _("_Replace"), NULL); adw_alert_dialog_set_response_appearance (ADW_ALERT_DIALOG (dialog), "replace", ADW_RESPONSE_DESTRUCTIVE); adw_alert_dialog_set_default_response (ADW_ALERT_DIALOG (dialog), "cancel"); adw_alert_dialog_set_close_response (ADW_ALERT_DIALOG (dialog), "cancel"); adw_alert_dialog_choose (ADW_ALERT_DIALOG (dialog), GTK_WIDGET (self), NULL, (GAsyncReadyCallback) dialog_cb, self); }
AdwAlertDialog as GtkBuildable
AdwAlertDialog
supports adding responses in UI definitions by via the
<responses>
element that may contain multiple <response>
elements, each
respresenting a response.
Each of the <response>
elements must have the id
attribute specifying the
response ID. The contents of the element are used as the response label.
Response labels can be translated with the usual translatable
, context
and comments
attributes.
The <response>
elements can also have enabled
and/or appearance
attributes. See [methodalertDialog
.set_response_enabled] and
[methodalertDialog
.set_response_appearance] for details.
Example of an AdwAlertDialog
UI definition:
xml code
<object class="AdwAlertDialog" id="dialog"> <property name="heading" translatable="yes">Save Changes?</property> <property name="body" translatable="yes">Open documents contain unsaved changes. Changes which are not saved will be permanently lost.</property> <property name="default-response">save</property> <property name="close-response">cancel</property> <signal name="response" handler="response_cb"/> <responses> <response id="cancel" translatable="yes">_Cancel</response> <response id="discard" translatable="yes" appearance="destructive">_Discard</response> <response id="save" translatable="yes" appearance="suggested" enabled="false">_Save</response> </responses> </object>
Since: 1.5
Synopsis
- newtype AlertDialog = AlertDialog (ManagedPtr AlertDialog)
- class (GObject o, IsDescendantOf AlertDialog o) => IsAlertDialog o
- toAlertDialog :: (MonadIO m, IsAlertDialog o) => o -> m AlertDialog
- alertDialogAddResponse :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> Text -> Text -> m ()
- alertDialogChoose :: (HasCallStack, MonadIO m, IsAlertDialog a, IsWidget b, IsCancellable c) => a -> Maybe b -> Maybe c -> Maybe AsyncReadyCallback -> m ()
- alertDialogChooseFinish :: (HasCallStack, MonadIO m, IsAlertDialog a, IsAsyncResult b) => a -> b -> m Text
- alertDialogGetBody :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> m Text
- alertDialogGetBodyUseMarkup :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> m Bool
- alertDialogGetCloseResponse :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> m Text
- alertDialogGetDefaultResponse :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> m (Maybe Text)
- alertDialogGetExtraChild :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> m (Maybe Widget)
- alertDialogGetHeading :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> m (Maybe Text)
- alertDialogGetHeadingUseMarkup :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> m Bool
- alertDialogGetResponseAppearance :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> Text -> m ResponseAppearance
- alertDialogGetResponseEnabled :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> Text -> m Bool
- alertDialogGetResponseLabel :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> Text -> m Text
- alertDialogHasResponse :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> Text -> m Bool
- alertDialogNew :: (HasCallStack, MonadIO m) => Maybe Text -> Maybe Text -> m AlertDialog
- alertDialogRemoveResponse :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> Text -> m ()
- alertDialogSetBody :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> Text -> m ()
- alertDialogSetBodyUseMarkup :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> Bool -> m ()
- alertDialogSetCloseResponse :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> Text -> m ()
- alertDialogSetDefaultResponse :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> Maybe Text -> m ()
- alertDialogSetExtraChild :: (HasCallStack, MonadIO m, IsAlertDialog a, IsWidget b) => a -> Maybe b -> m ()
- alertDialogSetHeading :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> Maybe Text -> m ()
- alertDialogSetHeadingUseMarkup :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> Bool -> m ()
- alertDialogSetResponseAppearance :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> Text -> ResponseAppearance -> m ()
- alertDialogSetResponseEnabled :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> Text -> Bool -> m ()
- alertDialogSetResponseLabel :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> Text -> Text -> m ()
- constructAlertDialogBody :: (IsAlertDialog o, MonadIO m) => Text -> m (GValueConstruct o)
- getAlertDialogBody :: (MonadIO m, IsAlertDialog o) => o -> m Text
- setAlertDialogBody :: (MonadIO m, IsAlertDialog o) => o -> Text -> m ()
- constructAlertDialogBodyUseMarkup :: (IsAlertDialog o, MonadIO m) => Bool -> m (GValueConstruct o)
- getAlertDialogBodyUseMarkup :: (MonadIO m, IsAlertDialog o) => o -> m Bool
- setAlertDialogBodyUseMarkup :: (MonadIO m, IsAlertDialog o) => o -> Bool -> m ()
- constructAlertDialogCloseResponse :: (IsAlertDialog o, MonadIO m) => Text -> m (GValueConstruct o)
- getAlertDialogCloseResponse :: (MonadIO m, IsAlertDialog o) => o -> m Text
- setAlertDialogCloseResponse :: (MonadIO m, IsAlertDialog o) => o -> Text -> m ()
- clearAlertDialogDefaultResponse :: (MonadIO m, IsAlertDialog o) => o -> m ()
- constructAlertDialogDefaultResponse :: (IsAlertDialog o, MonadIO m) => Text -> m (GValueConstruct o)
- getAlertDialogDefaultResponse :: (MonadIO m, IsAlertDialog o) => o -> m (Maybe Text)
- setAlertDialogDefaultResponse :: (MonadIO m, IsAlertDialog o) => o -> Text -> m ()
- clearAlertDialogExtraChild :: (MonadIO m, IsAlertDialog o) => o -> m ()
- constructAlertDialogExtraChild :: (IsAlertDialog o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getAlertDialogExtraChild :: (MonadIO m, IsAlertDialog o) => o -> m (Maybe Widget)
- setAlertDialogExtraChild :: (MonadIO m, IsAlertDialog o, IsWidget a) => o -> a -> m ()
- clearAlertDialogHeading :: (MonadIO m, IsAlertDialog o) => o -> m ()
- constructAlertDialogHeading :: (IsAlertDialog o, MonadIO m) => Text -> m (GValueConstruct o)
- getAlertDialogHeading :: (MonadIO m, IsAlertDialog o) => o -> m (Maybe Text)
- setAlertDialogHeading :: (MonadIO m, IsAlertDialog o) => o -> Text -> m ()
- constructAlertDialogHeadingUseMarkup :: (IsAlertDialog o, MonadIO m) => Bool -> m (GValueConstruct o)
- getAlertDialogHeadingUseMarkup :: (MonadIO m, IsAlertDialog o) => o -> m Bool
- setAlertDialogHeadingUseMarkup :: (MonadIO m, IsAlertDialog o) => o -> Bool -> m ()
- type AlertDialogResponseCallback = Text -> IO ()
- afterAlertDialogResponse :: (IsAlertDialog a, MonadIO m) => a -> Maybe Text -> ((?self :: a) => AlertDialogResponseCallback) -> m SignalHandlerId
- onAlertDialogResponse :: (IsAlertDialog a, MonadIO m) => a -> Maybe Text -> ((?self :: a) => AlertDialogResponseCallback) -> m SignalHandlerId
Exported types
newtype AlertDialog Source #
Memory-managed wrapper type.
Constructors
AlertDialog (ManagedPtr AlertDialog) |
Instances
Eq AlertDialog Source # | |
Defined in GI.Adw.Objects.AlertDialog | |
GObject AlertDialog Source # | |
Defined in GI.Adw.Objects.AlertDialog | |
ManagedPtrNewtype AlertDialog Source # | |
Defined in GI.Adw.Objects.AlertDialog Methods toManagedPtr :: AlertDialog -> ManagedPtr AlertDialog | |
TypedObject AlertDialog Source # | |
Defined in GI.Adw.Objects.AlertDialog | |
HasParentTypes AlertDialog Source # | |
Defined in GI.Adw.Objects.AlertDialog | |
IsGValue (Maybe AlertDialog) Source # | Convert |
Defined in GI.Adw.Objects.AlertDialog Methods gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe AlertDialog -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe AlertDialog) | |
type ParentTypes AlertDialog Source # | |
Defined in GI.Adw.Objects.AlertDialog |
class (GObject o, IsDescendantOf AlertDialog o) => IsAlertDialog o Source #
Type class for types which can be safely cast to AlertDialog
, for instance with toAlertDialog
.
Instances
(GObject o, IsDescendantOf AlertDialog o) => IsAlertDialog o Source # | |
Defined in GI.Adw.Objects.AlertDialog |
toAlertDialog :: (MonadIO m, IsAlertDialog o) => o -> m AlertDialog Source #
Cast to AlertDialog
, 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
actionSetEnabled, activate, activateAction, activateDefault, addBreakpoint, addController, addCssClass, addMnemonicLabel, addResponse, addTickCallback, allocate, announce, bindProperty, bindPropertyFull, childFocus, choose, chooseFinish, close, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, disposeTemplate, dragCheckThreshold, errorBell, forceClose, forceFloating, freezeNotify, getv, grabFocus, hasCssClass, hasDefault, hasFocus, hasResponse, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFloating, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, notify, notifyByPspec, observeChildren, observeControllers, pick, present, queueAllocate, queueDraw, queueResize, realize, ref, refSink, removeController, removeCssClass, removeMnemonicLabel, removeResponse, removeTickCallback, resetProperty, resetRelation, resetState, 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, getBody, getBodyUseMarkup, getBounds, getBuildableId, getCanClose, getCanFocus, getCanTarget, getChild, getChildVisible, getClipboard, getCloseResponse, getColor, getContentHeight, getContentWidth, getCssClasses, getCssName, getCurrentBreakpoint, getCursor, getData, getDefaultResponse, getDefaultWidget, getDirection, getDisplay, getExtraChild, getFirstAccessibleChild, getFirstChild, getFocus, getFocusChild, getFocusOnClick, getFocusable, getFollowsContentSize, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeading, getHeadingUseMarkup, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextAccessibleSibling, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPlatformState, getPreferredSize, getPresentationMode, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getResponseAppearance, getResponseEnabled, getResponseLabel, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTitle, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth.
Setters
setAccessibleParent, setBody, setBodyUseMarkup, setCanClose, setCanFocus, setCanTarget, setChild, setChildVisible, setCloseResponse, setContentHeight, setContentWidth, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDefaultResponse, setDefaultWidget, setDirection, setExtraChild, setFocus, setFocusChild, setFocusOnClick, setFocusable, setFollowsContentSize, setFontMap, setFontOptions, setHalign, setHasTooltip, setHeading, setHeadingUseMarkup, setHexpand, setHexpandSet, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setPresentationMode, setProperty, setReceivesDefault, setResponseAppearance, setResponseEnabled, setResponseLabel, setSensitive, setSizeRequest, setStateFlags, setTitle, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible.
addResponse
alertDialogAddResponse Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> Text |
|
-> Text |
|
-> m () |
Adds a response with id
and label
to self
.
Responses are represented as buttons in the dialog.
Response ID must be unique. It will be used in signalalertDialog
[response]
to tell which response had been activated, as well as to inspect and modify
the response later.
An embedded underline in label
indicates a mnemonic.
- method
alertDialog
.set_response_label - can be used to change the response label after it had been added.
- method
alertDialog
.set_response_enabled - and
- method
alertDialog
.set_response_appearance - can be used to customize the responses further.
Since: 1.5
choose
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a, IsWidget b, IsCancellable c) | |
=> a |
|
-> Maybe b |
|
-> Maybe c |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
This function shows self
to the user.
The callback
will be called when the alert is dismissed. It should call
[methodalertDialog
.choose_finish] to obtain the result.
If the window is an [classwindow
] or [classapplicationWindow
], the dialog
will be shown within it. Otherwise, it will be a separate window.
Since: 1.5
chooseFinish
alertDialogChooseFinish Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m Text | Returns: the ID of the response that was selected, or
[property |
Finishes the [methodalertDialog
.choose] call and returns the response ID.
Since: 1.5
getBody
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> m Text | Returns: the body of |
Gets the body text of self
.
Since: 1.5
getBodyUseMarkup
alertDialogGetBodyUseMarkup Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> m Bool | Returns: whether |
Gets whether the body text of self
includes Pango markup.
Since: 1.5
getCloseResponse
alertDialogGetCloseResponse Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> m Text | Returns: the close response ID |
Gets the ID of the close response of self
.
Since: 1.5
getDefaultResponse
alertDialogGetDefaultResponse Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> m (Maybe Text) | Returns: the default response ID |
Gets the ID of the default response of self
.
Since: 1.5
getExtraChild
alertDialogGetExtraChild Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> m (Maybe Widget) | Returns: the child widget of |
Gets the child widget of self
.
Since: 1.5
getHeading
alertDialogGetHeading Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> m (Maybe Text) | Returns: the heading of |
Gets the heading of self
.
Since: 1.5
getHeadingUseMarkup
alertDialogGetHeadingUseMarkup Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> m Bool | Returns: whether |
Gets whether the heading of self
includes Pango markup.
Since: 1.5
getResponseAppearance
alertDialogGetResponseAppearance Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> Text |
|
-> m ResponseAppearance | Returns: the appearance of |
Gets the appearance of response
.
See [methodalertDialog
.set_response_appearance].
Since: 1.5
getResponseEnabled
alertDialogGetResponseEnabled Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> Text |
|
-> m Bool | Returns: whether |
Gets whether response
is enabled.
See [methodalertDialog
.set_response_enabled].
Since: 1.5
getResponseLabel
alertDialogGetResponseLabel Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> Text |
|
-> m Text | Returns: the label of |
Gets the label of response
.
See [methodalertDialog
.set_response_label].
Since: 1.5
hasResponse
alertDialogHasResponse Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> Text |
|
-> m Bool | Returns: whether |
Gets whether self
has a response with the ID response
.
Since: 1.5
new
Arguments
:: (HasCallStack, MonadIO m) | |
=> Maybe Text |
|
-> Maybe Text |
|
-> m AlertDialog | Returns: the newly created |
Creates a new AdwAlertDialog
.
heading
and body
can be set to NULL
. This can be useful if they need to
be formatted or use markup. In that case, set them to NULL
and call
[methodalertDialog
.format_body] or similar methods afterwards:
c code
AdwDialog *dialog; dialog = adw_alert_dialog_new (_("Replace File?"), NULL); adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog), _("A file named “%s” already exists. Do you want to replace it?"), filename);
Since: 1.5
removeResponse
alertDialogRemoveResponse Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> Text |
|
-> m () |
Removes a response from self
.
Since: 1.5
setBody
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the body text of self
.
Since: 1.5
setBodyUseMarkup
alertDialogSetBodyUseMarkup Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> Bool |
|
-> m () |
setCloseResponse
alertDialogSetCloseResponse Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the ID of the close response of self
.
It will be passed to signalalertDialog
[response] if the dialog is closed
by pressing <kbd>Escape</kbd> or with a system action.
It doesn't have to correspond to any of the responses in the dialog.
The default close response is close
.
Since: 1.5
setDefaultResponse
alertDialogSetDefaultResponse Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> Maybe Text |
|
-> m () |
Sets the ID of the default response of self
.
If set, pressing <kbd>Enter</kbd> will activate the corresponding button.
If set to NULL
or to a non-existent response ID, pressing <kbd>Enter</kbd>
will do nothing.
Since: 1.5
setExtraChild
alertDialogSetExtraChild Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a, IsWidget b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the child widget of self
.
The child widget is displayed below the heading and body.
Since: 1.5
setHeading
alertDialogSetHeading Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> Maybe Text |
|
-> m () |
Sets the heading of self
.
Since: 1.5
setHeadingUseMarkup
alertDialogSetHeadingUseMarkup Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> Bool |
|
-> m () |
setResponseAppearance
alertDialogSetResponseAppearance Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> Text |
|
-> ResponseAppearance |
|
-> m () |
Sets the appearance for response
.
<picture> <source srcset="alert-dialog-appearance-dark.png" media="(prefers-color-scheme: dark)"> <img src="alert-dialog-appearance.png" alt="alert-dialog-appearance"> </picture>
Use ADW_RESPONSE_SUGGESTED
to mark important responses such as the
affirmative action, like the Save button in the example.
Use ADW_RESPONSE_DESTRUCTIVE
to draw attention to the potentially damaging
consequences of using response
. This appearance acts as a warning to the
user. The Discard button in the example is using this appearance.
The default appearance is ADW_RESPONSE_DEFAULT
.
Negative responses like Cancel or Close should use the default appearance.
Since: 1.5
setResponseEnabled
alertDialogSetResponseEnabled Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> Text |
|
-> Bool |
|
-> m () |
Sets whether response
is enabled.
If response
is not enabled, the corresponding button will have
Widget:sensitive set to FALSE
and it can't be activated as
a default response.
response
can still be used as [propertyalertDialog
:close-response] while
it's not enabled.
Responses are enabled by default.
Since: 1.5
setResponseLabel
alertDialogSetResponseLabel Source #
Arguments
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> Text |
|
-> Text |
|
-> m () |
Sets the label of response
to label
.
Labels are displayed on the dialog buttons. An embedded underline in label
indicates a mnemonic.
Since: 1.5
Properties
body
The body text of the dialog.
Since: 1.5
constructAlertDialogBody :: (IsAlertDialog o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “body
” property. This is rarely needed directly, but it is used by new
.
getAlertDialogBody :: (MonadIO m, IsAlertDialog o) => o -> m Text Source #
Get the value of the “body
” property.
When overloading is enabled, this is equivalent to
get
alertDialog #body
setAlertDialogBody :: (MonadIO m, IsAlertDialog o) => o -> Text -> m () Source #
Set the value of the “body
” property.
When overloading is enabled, this is equivalent to
set
alertDialog [ #body:=
value ]
bodyUseMarkup
constructAlertDialogBodyUseMarkup :: (IsAlertDialog o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “body-use-markup
” property. This is rarely needed directly, but it is used by new
.
getAlertDialogBodyUseMarkup :: (MonadIO m, IsAlertDialog o) => o -> m Bool Source #
Get the value of the “body-use-markup
” property.
When overloading is enabled, this is equivalent to
get
alertDialog #bodyUseMarkup
setAlertDialogBodyUseMarkup :: (MonadIO m, IsAlertDialog o) => o -> Bool -> m () Source #
Set the value of the “body-use-markup
” property.
When overloading is enabled, this is equivalent to
set
alertDialog [ #bodyUseMarkup:=
value ]
closeResponse
The ID of the close response.
It will be passed to signalalertDialog
[response] if the dialog is
closed by pressing <kbd>Escape</kbd> or with a system action.
It doesn't have to correspond to any of the responses in the dialog.
The default close response is close
.
Since: 1.5
constructAlertDialogCloseResponse :: (IsAlertDialog o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “close-response
” property. This is rarely needed directly, but it is used by new
.
getAlertDialogCloseResponse :: (MonadIO m, IsAlertDialog o) => o -> m Text Source #
Get the value of the “close-response
” property.
When overloading is enabled, this is equivalent to
get
alertDialog #closeResponse
setAlertDialogCloseResponse :: (MonadIO m, IsAlertDialog o) => o -> Text -> m () Source #
Set the value of the “close-response
” property.
When overloading is enabled, this is equivalent to
set
alertDialog [ #closeResponse:=
value ]
defaultResponse
The response ID of the default response.
If set, pressing <kbd>Enter</kbd> will activate the corresponding button.
If set to NULL
or a non-existent response ID, pressing <kbd>Enter</kbd>
will do nothing.
Since: 1.5
clearAlertDialogDefaultResponse :: (MonadIO m, IsAlertDialog o) => o -> m () Source #
Set the value of the “default-response
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#defaultResponse
constructAlertDialogDefaultResponse :: (IsAlertDialog o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “default-response
” property. This is rarely needed directly, but it is used by new
.
getAlertDialogDefaultResponse :: (MonadIO m, IsAlertDialog o) => o -> m (Maybe Text) Source #
Get the value of the “default-response
” property.
When overloading is enabled, this is equivalent to
get
alertDialog #defaultResponse
setAlertDialogDefaultResponse :: (MonadIO m, IsAlertDialog o) => o -> Text -> m () Source #
Set the value of the “default-response
” property.
When overloading is enabled, this is equivalent to
set
alertDialog [ #defaultResponse:=
value ]
extraChild
The child widget.
Displayed below the heading and body.
Since: 1.5
clearAlertDialogExtraChild :: (MonadIO m, IsAlertDialog o) => o -> m () Source #
Set the value of the “extra-child
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#extraChild
constructAlertDialogExtraChild :: (IsAlertDialog o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “extra-child
” property. This is rarely needed directly, but it is used by new
.
getAlertDialogExtraChild :: (MonadIO m, IsAlertDialog o) => o -> m (Maybe Widget) Source #
Get the value of the “extra-child
” property.
When overloading is enabled, this is equivalent to
get
alertDialog #extraChild
setAlertDialogExtraChild :: (MonadIO m, IsAlertDialog o, IsWidget a) => o -> a -> m () Source #
Set the value of the “extra-child
” property.
When overloading is enabled, this is equivalent to
set
alertDialog [ #extraChild:=
value ]
heading
The heading of the dialog.
Since: 1.5
clearAlertDialogHeading :: (MonadIO m, IsAlertDialog o) => o -> m () Source #
Set the value of the “heading
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#heading
constructAlertDialogHeading :: (IsAlertDialog o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “heading
” property. This is rarely needed directly, but it is used by new
.
getAlertDialogHeading :: (MonadIO m, IsAlertDialog o) => o -> m (Maybe Text) Source #
Get the value of the “heading
” property.
When overloading is enabled, this is equivalent to
get
alertDialog #heading
setAlertDialogHeading :: (MonadIO m, IsAlertDialog o) => o -> Text -> m () Source #
Set the value of the “heading
” property.
When overloading is enabled, this is equivalent to
set
alertDialog [ #heading:=
value ]
headingUseMarkup
constructAlertDialogHeadingUseMarkup :: (IsAlertDialog o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “heading-use-markup
” property. This is rarely needed directly, but it is used by new
.
getAlertDialogHeadingUseMarkup :: (MonadIO m, IsAlertDialog o) => o -> m Bool Source #
Get the value of the “heading-use-markup
” property.
When overloading is enabled, this is equivalent to
get
alertDialog #headingUseMarkup
setAlertDialogHeadingUseMarkup :: (MonadIO m, IsAlertDialog o) => o -> Bool -> m () Source #
Set the value of the “heading-use-markup
” property.
When overloading is enabled, this is equivalent to
set
alertDialog [ #headingUseMarkup:=
value ]
Signals
response
type AlertDialogResponseCallback Source #
This signal is emitted when the dialog is closed.
response
will be set to the response ID of the button that had been
activated.
if the dialog was closed by pressing <kbd>Escape</kbd> or with a system
action, response
will be set to the value of
[propertyalertDialog
:close-response].
Since: 1.5
afterAlertDialogResponse :: (IsAlertDialog a, MonadIO m) => a -> Maybe Text -> ((?self :: a) => AlertDialogResponseCallback) -> 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
alertDialog #response callback
This signal admits a optional parameter detail
.
If it's not Nothing
, we will connect to “response::detail
” instead.
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.
onAlertDialogResponse :: (IsAlertDialog a, MonadIO m) => a -> Maybe Text -> ((?self :: a) => AlertDialogResponseCallback) -> 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
alertDialog #response callback
This signal admits a optional parameter detail
.
If it's not Nothing
, we will connect to “response::detail
” instead.