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 |
A GtkAlertDialog
object collects the arguments that
are needed to present a message to the user.
The message is shown with the alertDialogChoose
function. This API follows the GIO async pattern, and the result can
be obtained by calling alertDialogChooseFinish
.
If you don't need to wait for a button to be clicked, you can use
alertDialogShow
.
Since: 4.10
Synopsis
- newtype AlertDialog = AlertDialog (ManagedPtr AlertDialog)
- class (GObject o, IsDescendantOf AlertDialog o) => IsAlertDialog o
- toAlertDialog :: (MonadIO m, IsAlertDialog o) => o -> m AlertDialog
- alertDialogChoose :: (HasCallStack, MonadIO m, IsAlertDialog a, IsWindow b, IsCancellable c) => a -> Maybe b -> Maybe c -> Maybe AsyncReadyCallback -> m ()
- alertDialogChooseFinish :: (HasCallStack, MonadIO m, IsAlertDialog a, IsAsyncResult b) => a -> b -> m Int32
- alertDialogGetButtons :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> m (Maybe [Text])
- alertDialogGetCancelButton :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> m Int32
- alertDialogGetDefaultButton :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> m Int32
- alertDialogGetDetail :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> m Text
- alertDialogGetMessage :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> m Text
- alertDialogGetModal :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> m Bool
- alertDialogSetButtons :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> [Text] -> m ()
- alertDialogSetCancelButton :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> Int32 -> m ()
- alertDialogSetDefaultButton :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> Int32 -> m ()
- alertDialogSetDetail :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> Text -> m ()
- alertDialogSetMessage :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> Text -> m ()
- alertDialogSetModal :: (HasCallStack, MonadIO m, IsAlertDialog a) => a -> Bool -> m ()
- alertDialogShow :: (HasCallStack, MonadIO m, IsAlertDialog a, IsWindow b) => a -> Maybe b -> m ()
- constructAlertDialogButtons :: (IsAlertDialog o, MonadIO m) => [Text] -> m (GValueConstruct o)
- getAlertDialogButtons :: (MonadIO m, IsAlertDialog o) => o -> m (Maybe [Text])
- setAlertDialogButtons :: (MonadIO m, IsAlertDialog o) => o -> [Text] -> m ()
- constructAlertDialogCancelButton :: (IsAlertDialog o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getAlertDialogCancelButton :: (MonadIO m, IsAlertDialog o) => o -> m Int32
- setAlertDialogCancelButton :: (MonadIO m, IsAlertDialog o) => o -> Int32 -> m ()
- constructAlertDialogDefaultButton :: (IsAlertDialog o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getAlertDialogDefaultButton :: (MonadIO m, IsAlertDialog o) => o -> m Int32
- setAlertDialogDefaultButton :: (MonadIO m, IsAlertDialog o) => o -> Int32 -> m ()
- constructAlertDialogDetail :: (IsAlertDialog o, MonadIO m) => Text -> m (GValueConstruct o)
- getAlertDialogDetail :: (MonadIO m, IsAlertDialog o) => o -> m Text
- setAlertDialogDetail :: (MonadIO m, IsAlertDialog o) => o -> Text -> m ()
- constructAlertDialogMessage :: (IsAlertDialog o, MonadIO m) => Text -> m (GValueConstruct o)
- getAlertDialogMessage :: (MonadIO m, IsAlertDialog o) => o -> m Text
- setAlertDialogMessage :: (MonadIO m, IsAlertDialog o) => o -> Text -> m ()
- constructAlertDialogModal :: (IsAlertDialog o, MonadIO m) => Bool -> m (GValueConstruct o)
- getAlertDialogModal :: (MonadIO m, IsAlertDialog o) => o -> m Bool
- setAlertDialogModal :: (MonadIO m, IsAlertDialog o) => o -> Bool -> m ()
Exported types
newtype AlertDialog Source #
Memory-managed wrapper type.
AlertDialog (ManagedPtr AlertDialog) |
Instances
Eq AlertDialog Source # | |
Defined in GI.Gtk.Objects.AlertDialog (==) :: AlertDialog -> AlertDialog -> Bool # (/=) :: AlertDialog -> AlertDialog -> Bool # | |
GObject AlertDialog Source # | |
Defined in GI.Gtk.Objects.AlertDialog | |
ManagedPtrNewtype AlertDialog Source # | |
Defined in GI.Gtk.Objects.AlertDialog toManagedPtr :: AlertDialog -> ManagedPtr AlertDialog | |
TypedObject AlertDialog Source # | |
Defined in GI.Gtk.Objects.AlertDialog | |
HasParentTypes AlertDialog Source # | |
Defined in GI.Gtk.Objects.AlertDialog | |
IsGValue (Maybe AlertDialog) Source # | Convert |
Defined in GI.Gtk.Objects.AlertDialog gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe AlertDialog -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe AlertDialog) | |
type ParentTypes AlertDialog Source # | |
Defined in GI.Gtk.Objects.AlertDialog type ParentTypes AlertDialog = '[Object] |
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.Gtk.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
bindProperty, bindPropertyFull, choose, chooseFinish, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, show, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getButtons, getCancelButton, getData, getDefaultButton, getDetail, getMessage, getModal, getProperty, getQdata.
Setters
setButtons, setCancelButton, setData, setDataFull, setDefaultButton, setDetail, setMessage, setModal, setProperty.
choose
:: (HasCallStack, MonadIO m, IsAlertDialog a, IsWindow b, IsCancellable c) | |
=> a |
|
-> Maybe b |
|
-> Maybe c |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
This function shows the alert to the user.
The callback
will be called when the alert is dismissed.
It should call alertDialogChooseFinish
to obtain the result.
It is ok to pass NULL
for the callback if the alert
does not have more than one button. A simpler API for
this case is alertDialogShow
.
Since: 4.10
chooseFinish
alertDialogChooseFinish Source #
:: (HasCallStack, MonadIO m, IsAlertDialog a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m Int32 | Returns: the index of the button that was clicked, or -1 if
the dialog was cancelled and `AlertDialog:cancelButton
is not set (Can throw |
Finishes the alertDialogChoose
call
and returns the index of the button that was clicked.
Since: 4.10
getButtons
alertDialogGetButtons Source #
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> m (Maybe [Text]) | Returns: the button labels |
Returns the button labels for the alert.
Since: 4.10
getCancelButton
alertDialogGetCancelButton Source #
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> m Int32 | Returns: the index of the cancel button, or -1 |
Returns the index of the cancel button.
Since: 4.10
getDefaultButton
alertDialogGetDefaultButton Source #
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> m Int32 | Returns: the index of the default button, or -1 |
Returns the index of the default button.
Since: 4.10
getDetail
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> m Text | Returns: the detail text |
Returns the detail text that will be shown in the alert.
Since: 4.10
getMessage
alertDialogGetMessage Source #
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> m Text | Returns: the message |
Returns the message that will be shown in the alert.
Since: 4.10
getModal
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether the alert blocks interaction with the parent window while it is presented.
Since: 4.10
setButtons
alertDialogSetButtons Source #
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> [Text] |
|
-> m () |
Sets the button labels for the alert.
Since: 4.10
setCancelButton
alertDialogSetCancelButton Source #
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> Int32 |
|
-> m () |
Sets the index of the cancel button.
See AlertDialog:cancelButton for details of how this value is used.
Since: 4.10
setDefaultButton
alertDialogSetDefaultButton Source #
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> Int32 |
|
-> m () |
Sets the index of the default button.
See AlertDialog:defaultButton for details of how this value is used.
Since: 4.10
setDetail
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the detail text that will be shown in the alert.
Since: 4.10
setMessage
alertDialogSetMessage Source #
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the message that will be shown in the alert.
Since: 4.10
setModal
:: (HasCallStack, MonadIO m, IsAlertDialog a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether the alert blocks interaction with the parent window while it is presented.
Since: 4.10
show
:: (HasCallStack, MonadIO m, IsAlertDialog a, IsWindow b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Show the alert to the user.
This function is a simple version of alertDialogChoose
intended for dialogs with a single button.
If you want to cancel the dialog or if the alert has more than one button,
you should use that function instead and provide it with a Cancellable
or
callback respectively.
Since: 4.10
Properties
buttons
Labels for buttons to show in the alert.
The labels should be translated and may contain a _ to indicate the mnemonic character.
If this property is not set, then a 'Close' button is automatically created.
Since: 4.10
constructAlertDialogButtons :: (IsAlertDialog o, MonadIO m) => [Text] -> 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
.
getAlertDialogButtons :: (MonadIO m, IsAlertDialog o) => o -> m (Maybe [Text]) Source #
Get the value of the “buttons
” property.
When overloading is enabled, this is equivalent to
get
alertDialog #buttons
setAlertDialogButtons :: (MonadIO m, IsAlertDialog o) => o -> [Text] -> m () Source #
Set the value of the “buttons
” property.
When overloading is enabled, this is equivalent to
set
alertDialog [ #buttons:=
value ]
cancelButton
This property determines what happens when the Escape key is pressed while the alert is shown.
If this property holds the index of a button in AlertDialog:buttons,
then pressing Escape is treated as if that button was pressed. If it is -1
or not a valid index for the buttons
array, then an error is returned.
If buttons
is NULL
, then the automatically created 'Close' button
is treated as both cancel and default button, so 0 is returned.
Since: 4.10
constructAlertDialogCancelButton :: (IsAlertDialog o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “cancel-button
” property. This is rarely needed directly, but it is used by new
.
getAlertDialogCancelButton :: (MonadIO m, IsAlertDialog o) => o -> m Int32 Source #
Get the value of the “cancel-button
” property.
When overloading is enabled, this is equivalent to
get
alertDialog #cancelButton
setAlertDialogCancelButton :: (MonadIO m, IsAlertDialog o) => o -> Int32 -> m () Source #
Set the value of the “cancel-button
” property.
When overloading is enabled, this is equivalent to
set
alertDialog [ #cancelButton:=
value ]
defaultButton
This property determines what happens when the Return key is pressed while the alert is shown.
If this property holds the index of a button in AlertDialog:buttons,
then pressing Return is treated as if that button was pressed. If it is -1
or not a valid index for the buttons
array, then nothing happens.
If buttons
is NULL
, then the automatically created 'Close' button
is treated as both cancel and default button, so 0 is returned.
Since: 4.10
constructAlertDialogDefaultButton :: (IsAlertDialog o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “default-button
” property. This is rarely needed directly, but it is used by new
.
getAlertDialogDefaultButton :: (MonadIO m, IsAlertDialog o) => o -> m Int32 Source #
Get the value of the “default-button
” property.
When overloading is enabled, this is equivalent to
get
alertDialog #defaultButton
setAlertDialogDefaultButton :: (MonadIO m, IsAlertDialog o) => o -> Int32 -> m () Source #
Set the value of the “default-button
” property.
When overloading is enabled, this is equivalent to
set
alertDialog [ #defaultButton:=
value ]
detail
The detail text for the alert.
Since: 4.10
constructAlertDialogDetail :: (IsAlertDialog o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “detail
” property. This is rarely needed directly, but it is used by new
.
getAlertDialogDetail :: (MonadIO m, IsAlertDialog o) => o -> m Text Source #
Get the value of the “detail
” property.
When overloading is enabled, this is equivalent to
get
alertDialog #detail
setAlertDialogDetail :: (MonadIO m, IsAlertDialog o) => o -> Text -> m () Source #
Set the value of the “detail
” property.
When overloading is enabled, this is equivalent to
set
alertDialog [ #detail:=
value ]
message
The message for the alert.
Since: 4.10
constructAlertDialogMessage :: (IsAlertDialog o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “message
” property. This is rarely needed directly, but it is used by new
.
getAlertDialogMessage :: (MonadIO m, IsAlertDialog o) => o -> m Text Source #
Get the value of the “message
” property.
When overloading is enabled, this is equivalent to
get
alertDialog #message
setAlertDialogMessage :: (MonadIO m, IsAlertDialog o) => o -> Text -> m () Source #
Set the value of the “message
” property.
When overloading is enabled, this is equivalent to
set
alertDialog [ #message:=
value ]
modal
Whether the alert is modal.
Since: 4.10
constructAlertDialogModal :: (IsAlertDialog o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “modal
” property. This is rarely needed directly, but it is used by new
.
getAlertDialogModal :: (MonadIO m, IsAlertDialog o) => o -> m Bool Source #
Get the value of the “modal
” property.
When overloading is enabled, this is equivalent to
get
alertDialog #modal
setAlertDialogModal :: (MonadIO m, IsAlertDialog o) => o -> Bool -> m () Source #
Set the value of the “modal
” property.
When overloading is enabled, this is equivalent to
set
alertDialog [ #modal:=
value ]