gi-gtk4-4.0.12: Gtk 4.x bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Objects.AlertDialog

Contents

- Exported types
- Methods
  - choose
  - chooseFinish
  - getButtons
  - getCancelButton
  - getDefaultButton
  - getDetail
  - getMessage
  - getModal
  - setButtons
  - setCancelButton
  - setDefaultButton
  - setDetail
  - setMessage
  - setModal
  - show
- Properties
  - buttons
  - cancelButton
  - defaultButton
  - detail
  - message
  - modal

Description

Collects the arguments that are needed to present a message to the user.

The message is shown with the `alertDialogChoose` function.

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.

Constructors

AlertDialog (ManagedPtr AlertDialog) |

#### Instances

Instances details

Eq AlertDialog Source # |
Instance details Defined in GI.Gtk.Objects.AlertDialog Methods (==) :: AlertDialog -> AlertDialog -> Bool Source # (/=) :: AlertDialog -> AlertDialog -> Bool Source #
GObject AlertDialog Source # |
Instance details Defined in GI.Gtk.Objects.AlertDialog
ManagedPtrNewtype AlertDialog Source # |
Instance details Defined in GI.Gtk.Objects.AlertDialog Methods toManagedPtr :: AlertDialog -> ManagedPtr AlertDialog Source #
TypedObject AlertDialog Source # |
Instance details Defined in GI.Gtk.Objects.AlertDialog Methods glibType :: IO GType Source #
HasParentTypes AlertDialog Source # |
Instance details Defined in GI.Gtk.Objects.AlertDialog
IsGValue (Maybe AlertDialog) Source # | Convert `AlertDialog` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Objects.AlertDialog Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe AlertDialog -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe AlertDialog) Source #
type ParentTypes AlertDialog Source # |
Instance details 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

Instances details

(GObject o, IsDescendantOf AlertDialog o) => IsAlertDialog o Source # |
Instance details 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

Expand

#### 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

alertDialogChoose Source #

Arguments

:: (HasCallStack, MonadIO m, IsAlertDialog a, IsWindow b, IsCancellable c) |
=> a | `self`: an alert dialog
-> Maybe b | `parent`: the parent window
-> Maybe c | `cancellable`: a cancellable to cancel the operation
-> Maybe AsyncReadyCallback | `callback`: a callback to call when the operation is complete
-> m () |

Shows the alert to the user.

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 #

Arguments

:: (HasCallStack, MonadIO m, IsAlertDialog a, IsAsyncResult b) |
=> a | `self`: an alert dialog
-> b | `result`: the result
-> 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 `GError`)

Finishes the `alertDialogChoose` call.

Since: 4.10

## getButtons

alertDialogGetButtons Source #

Arguments

:: (HasCallStack, MonadIO m, IsAlertDialog a) |
=> a | `self`: an alert dialog
-> m (Maybe [Text]) | Returns: the button labels

Returns the button labels for the alert.

Since: 4.10

## getCancelButton

alertDialogGetCancelButton Source #

Arguments

:: (HasCallStack, MonadIO m, IsAlertDialog a) |
=> a | `self`: an alert dialog
-> m Int32 | Returns: the index of the cancel button, or -1

Returns the index of the cancel button.

Since: 4.10

## getDefaultButton

alertDialogGetDefaultButton Source #

Arguments

:: (HasCallStack, MonadIO m, IsAlertDialog a) |
=> a | `self`: an alert dialog
-> m Int32 | Returns: the index of the default button, or -1

Returns the index of the default button.

Since: 4.10

## getDetail

alertDialogGetDetail Source #

Arguments

:: (HasCallStack, MonadIO m, IsAlertDialog a) |
=> a | `self`: an alert dialog
-> m Text | Returns: the detail text

Returns the detail text that will be shown in the alert.

Since: 4.10

## getMessage

alertDialogGetMessage Source #

Arguments

:: (HasCallStack, MonadIO m, IsAlertDialog a) |
=> a | `self`: an alert dialog
-> m Text | Returns: the message

Returns the message that will be shown in the alert.

Since: 4.10

## getModal

alertDialogGetModal Source #

Arguments

:: (HasCallStack, MonadIO m, IsAlertDialog a) |
=> a | `self`: an alert dialog
-> m Bool | Returns: true if the alert is modal

Returns whether the alert blocks interaction with the parent window while it is presented.

Since: 4.10

## setButtons

alertDialogSetButtons Source #

Arguments

:: (HasCallStack, MonadIO m, IsAlertDialog a) |
=> a | `self`: an alert dialog
-> [Text] | `labels`: the new button labels
-> m () |

Sets the button labels for the alert.

Since: 4.10

## setCancelButton

alertDialogSetCancelButton Source #

Arguments

:: (HasCallStack, MonadIO m, IsAlertDialog a) |
=> a | `self`: an alert dialog
-> Int32 | `button`: the new cancel button
-> 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 #

Arguments

:: (HasCallStack, MonadIO m, IsAlertDialog a) |
=> a | `self`: an alert dialog
-> Int32 | `button`: the new default button
-> m () |

Sets the index of the default button.

See AlertDialog:defaultButton for details of how this value is used.

Since: 4.10

## setDetail

alertDialogSetDetail Source #

Arguments

:: (HasCallStack, MonadIO m, IsAlertDialog a) |
=> a | `self`: an alert dialog
-> Text | `detail`: the new detail text
-> m () |

Sets the detail text that will be shown in the alert.

Since: 4.10

## setMessage

alertDialogSetMessage Source #

Arguments

:: (HasCallStack, MonadIO m, IsAlertDialog a) |
=> a | `self`: an alert dialog
-> Text | `message`: the new message
-> m () |

Sets the message that will be shown in the alert.

Since: 4.10

## setModal

alertDialogSetModal Source #

Arguments

:: (HasCallStack, MonadIO m, IsAlertDialog a) |
=> a | `self`: an alert dialog
-> Bool | `modal`: the new value
-> m () |

Sets whether the alert blocks interaction with the parent window while it is presented.

Since: 4.10

## show

alertDialogShow Source #

Arguments

:: (HasCallStack, MonadIO m, IsAlertDialog a, IsWindow b) |
=> a | `self`: an alert dialog
-> Maybe b | `parent`: the parent window
-> m () |

Shows the alert to the user.

This function is a simpler 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` and callback respectively.

Since: 4.10

# Properties

## buttons

Labels for buttons to show in the alert.

The labels should be translated and may contain a `_` character 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

Determines what happens when the <kbd>Escape</kbd> 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

Determines what happens when the <kbd>Return</kbd> 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 ]