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.NativeDialog

Contents

- Exported types
- Methods
  - destroy
  - getModal
  - getTitle
  - getTransientFor
  - getVisible
  - hide
  - setModal
  - setTitle
  - setTransientFor
  - show
- Properties
  - modal
  - title
  - transientFor
  - visible
- Signals
  - response

Description

Base class for platform dialogs that don't use `GtkDialog`.

Native dialogs are used in order to integrate better with a platform, by looking the same as other native applications and supporting platform specific features.

The `Dialog` functions cannot be used on such objects, but we need a similar API in order to drive them. The `GtkNativeDialog` object is an API that allows you to do this. It allows you to set various common properties on the dialog, as well as show and hide it and get a NativeDialog::response signal when the user finished with the dialog.

Note that unlike `GtkDialog`, `GtkNativeDialog` objects are not toplevel widgets, and GTK does not keep them alive. It is your responsibility to keep a reference until you are done with the object.

Synopsis

- newtype NativeDialog = NativeDialog (ManagedPtr NativeDialog)
- class (GObject o, IsDescendantOf NativeDialog o) => IsNativeDialog o
- toNativeDialog :: (MonadIO m, IsNativeDialog o) => o -> m NativeDialog
- nativeDialogDestroy :: (HasCallStack, MonadIO m, IsNativeDialog a) => a -> m ()
- nativeDialogGetModal :: (HasCallStack, MonadIO m, IsNativeDialog a) => a -> m Bool
- nativeDialogGetTitle :: (HasCallStack, MonadIO m, IsNativeDialog a) => a -> m (Maybe Text)
- nativeDialogGetTransientFor :: (HasCallStack, MonadIO m, IsNativeDialog a) => a -> m (Maybe Window)
- nativeDialogGetVisible :: (HasCallStack, MonadIO m, IsNativeDialog a) => a -> m Bool
- nativeDialogHide :: (HasCallStack, MonadIO m, IsNativeDialog a) => a -> m ()
- nativeDialogSetModal :: (HasCallStack, MonadIO m, IsNativeDialog a) => a -> Bool -> m ()
- nativeDialogSetTitle :: (HasCallStack, MonadIO m, IsNativeDialog a) => a -> Text -> m ()
- nativeDialogSetTransientFor :: (HasCallStack, MonadIO m, IsNativeDialog a, IsWindow b) => a -> Maybe b -> m ()
- nativeDialogShow :: (HasCallStack, MonadIO m, IsNativeDialog a) => a -> m ()
- constructNativeDialogModal :: (IsNativeDialog o, MonadIO m) => Bool -> m (GValueConstruct o)
- getNativeDialogModal :: (MonadIO m, IsNativeDialog o) => o -> m Bool
- setNativeDialogModal :: (MonadIO m, IsNativeDialog o) => o -> Bool -> m ()
- constructNativeDialogTitle :: (IsNativeDialog o, MonadIO m) => Text -> m (GValueConstruct o)
- getNativeDialogTitle :: (MonadIO m, IsNativeDialog o) => o -> m (Maybe Text)
- setNativeDialogTitle :: (MonadIO m, IsNativeDialog o) => o -> Text -> m ()
- clearNativeDialogTransientFor :: (MonadIO m, IsNativeDialog o) => o -> m ()
- constructNativeDialogTransientFor :: (IsNativeDialog o, MonadIO m, IsWindow a) => a -> m (GValueConstruct o)
- getNativeDialogTransientFor :: (MonadIO m, IsNativeDialog o) => o -> m (Maybe Window)
- setNativeDialogTransientFor :: (MonadIO m, IsNativeDialog o, IsWindow a) => o -> a -> m ()
- constructNativeDialogVisible :: (IsNativeDialog o, MonadIO m) => Bool -> m (GValueConstruct o)
- getNativeDialogVisible :: (MonadIO m, IsNativeDialog o) => o -> m Bool
- setNativeDialogVisible :: (MonadIO m, IsNativeDialog o) => o -> Bool -> m ()
- type NativeDialogResponseCallback = Int32 -> IO ()
- afterNativeDialogResponse :: (IsNativeDialog a, MonadIO m) => a -> ((?self :: a) => NativeDialogResponseCallback) -> m SignalHandlerId
- onNativeDialogResponse :: (IsNativeDialog a, MonadIO m) => a -> ((?self :: a) => NativeDialogResponseCallback) -> m SignalHandlerId

# Exported types

newtype NativeDialog Source #

Memory-managed wrapper type.

Constructors

NativeDialog (ManagedPtr NativeDialog) |

#### Instances

Instances details

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

class (GObject o, IsDescendantOf NativeDialog o) => IsNativeDialog o Source #

Type class for types which can be safely cast to `NativeDialog`, for instance with `toNativeDialog`.

#### Instances

Instances details

(GObject o, IsDescendantOf NativeDialog o) => IsNativeDialog o Source # |
Instance details Defined in GI.Gtk.Objects.NativeDialog

toNativeDialog :: (MonadIO m, IsNativeDialog o) => o -> m NativeDialog Source #

Cast to `NativeDialog`, 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, destroy, forceFloating, freezeNotify, getv, hide, isFloating, notify, notifyByPspec, ref, refSink, runDispose, show, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getData, getModal, getProperty, getQdata, getTitle, getTransientFor, getVisible.

#### Setters

setData, setDataFull, setModal, setProperty, setTitle, setTransientFor.

## destroy

nativeDialogDestroy Source #

Arguments

:: (HasCallStack, MonadIO m, IsNativeDialog a) |
=> a | `self`: a `GtkNativeDialog`
-> m () |

Destroys a dialog.

When a dialog is destroyed, it will break any references it holds to other objects.

If it is visible it will be hidden and any underlying window system resources will be destroyed.

Note that this does not release any reference to the object (as opposed to destroying a `GtkWindow`) because there is no reference from the windowing system to the `GtkNativeDialog`.

## getModal

nativeDialogGetModal Source #

Arguments

:: (HasCallStack, MonadIO m, IsNativeDialog a) |
=> a | `self`: a `GtkNativeDialog`
-> m Bool | Returns: `True` if the dialog is set to be modal

Returns whether the dialog is modal.

## getTitle

nativeDialogGetTitle Source #

Arguments

:: (HasCallStack, MonadIO m, IsNativeDialog a) |
=> a | `self`: a `GtkNativeDialog`
-> m (Maybe Text) | Returns: the title of the dialog, or `Nothing` if none has been set explicitly. The returned string is owned by the widget and must not be modified or freed.

Gets the title of the `GtkNativeDialog`.

## getTransientFor

nativeDialogGetTransientFor Source #

Arguments

:: (HasCallStack, MonadIO m, IsNativeDialog a) |
=> a | `self`: a `GtkNativeDialog`
-> m (Maybe Window) | Returns: the transient parent for this window, or `Nothing` if no transient parent has been set.

Fetches the transient parent for this window.

## getVisible

nativeDialogGetVisible Source #

Arguments

:: (HasCallStack, MonadIO m, IsNativeDialog a) |
=> a | `self`: a `GtkNativeDialog`
-> m Bool | Returns: `True` if the dialog is visible

Determines whether the dialog is visible.

## hide

nativeDialogHide Source #

Arguments

:: (HasCallStack, MonadIO m, IsNativeDialog a) |
=> a | `self`: a `GtkNativeDialog`
-> m () |

Hides the dialog if it is visible, aborting any interaction.

Once this is called the NativeDialog::response signal will *not* be emitted until after the next call to `nativeDialogShow`.

If the dialog is not visible this does nothing.

## setModal

nativeDialogSetModal Source #

Arguments

:: (HasCallStack, MonadIO m, IsNativeDialog a) |
=> a | `self`: a `GtkNativeDialog`
-> Bool | `modal`: whether the window is modal
-> m () |

Sets a dialog modal or non-modal.

Modal dialogs prevent interaction with other windows in the same application. To keep modal dialogs on top of main application windows, use `nativeDialogSetTransientFor` to make the dialog transient for the parent; most window managers will then disallow lowering the dialog below the parent.

## setTitle

nativeDialogSetTitle Source #

Arguments

:: (HasCallStack, MonadIO m, IsNativeDialog a) |
=> a | `self`: a `GtkNativeDialog`
-> Text | `title`: title of the dialog
-> m () |

Sets the title of the `GtkNativeDialog.`

## setTransientFor

nativeDialogSetTransientFor Source #

Arguments

:: (HasCallStack, MonadIO m, IsNativeDialog a, IsWindow b) |
=> a | `self`: a `GtkNativeDialog`
-> Maybe b | `parent`: parent window
-> m () |

Dialog windows should be set transient for the main application window they were spawned from.

This allows window managers to e.g. keep the dialog on top of the main window, or center the dialog over the main window.

Passing `Nothing` for `parent` unsets the current transient window.

## show

nativeDialogShow Source #

Arguments

:: (HasCallStack, MonadIO m, IsNativeDialog a) |
=> a | `self`: a `GtkNativeDialog`
-> m () |

Shows the dialog on the display.

When the user accepts the state of the dialog the dialog will be automatically hidden and the NativeDialog::response signal will be emitted.

Multiple calls while the dialog is visible will be ignored.

# Properties

## modal

Whether the window should be modal with respect to its transient parent.

constructNativeDialogModal :: (IsNativeDialog 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`.

getNativeDialogModal :: (MonadIO m, IsNativeDialog o) => o -> m Bool Source #

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

    get nativeDialog #modal

setNativeDialogModal :: (MonadIO m, IsNativeDialog o) => o -> Bool -> m () Source #

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

    set nativeDialog [ #modal := value ]

## title

The title of the dialog window

constructNativeDialogTitle :: (IsNativeDialog o, MonadIO m) => Text -> m (GValueConstruct o) Source #

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

getNativeDialogTitle :: (MonadIO m, IsNativeDialog o) => o -> m (Maybe Text) Source #

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

    get nativeDialog #title

setNativeDialogTitle :: (MonadIO m, IsNativeDialog o) => o -> Text -> m () Source #

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

    set nativeDialog [ #title := value ]

## transientFor

The transient parent of the dialog, or `Nothing` for none.

clearNativeDialogTransientFor :: (MonadIO m, IsNativeDialog o) => o -> m () Source #

Set the value of the “`transient-for`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #transientFor

constructNativeDialogTransientFor :: (IsNativeDialog o, MonadIO m, IsWindow a) => a -> m (GValueConstruct o) Source #

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

getNativeDialogTransientFor :: (MonadIO m, IsNativeDialog o) => o -> m (Maybe Window) Source #

Get the value of the “`transient-for`” property. When overloading is enabled, this is equivalent to

    get nativeDialog #transientFor

setNativeDialogTransientFor :: (MonadIO m, IsNativeDialog o, IsWindow a) => o -> a -> m () Source #

Set the value of the “`transient-for`” property. When overloading is enabled, this is equivalent to

    set nativeDialog [ #transientFor := value ]

## visible

Whether the window is currently visible.

constructNativeDialogVisible :: (IsNativeDialog o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getNativeDialogVisible :: (MonadIO m, IsNativeDialog o) => o -> m Bool Source #

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

    get nativeDialog #visible

setNativeDialogVisible :: (MonadIO m, IsNativeDialog o) => o -> Bool -> m () Source #

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

    set nativeDialog [ #visible := value ]

# Signals

## response

type NativeDialogResponseCallback Source #

Arguments

= Int32 | `responseId`: the response ID
-> IO () |

Emitted when the user responds to the dialog.

When this is called the dialog has been hidden.

If you call `nativeDialogHide` before the user responds to the dialog this signal will not be emitted.

afterNativeDialogResponse :: (IsNativeDialog a, MonadIO m) => a -> ((?self :: a) => NativeDialogResponseCallback) -> 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 nativeDialog #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.

onNativeDialogResponse :: (IsNativeDialog a, MonadIO m) => a -> ((?self :: a) => NativeDialogResponseCallback) -> 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 nativeDialog #response callback