Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
Native dialogs are platform dialogs that don't use Dialog
or
Window
. They 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 NativeDialog
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.
There is also a nativeDialogRun
helper that makes it easy
to run any native dialog in a modal way with a recursive mainloop,
similar to dialogRun
.
- newtype NativeDialog = NativeDialog (ManagedPtr NativeDialog)
- class GObject o => IsNativeDialog o
- toNativeDialog :: IsNativeDialog o => o -> IO NativeDialog
- noNativeDialog :: Maybe NativeDialog
- data NativeDialogDestroyMethodInfo
- nativeDialogDestroy :: (HasCallStack, MonadIO m, IsNativeDialog a) => a -> m ()
- data NativeDialogGetModalMethodInfo
- nativeDialogGetModal :: (HasCallStack, MonadIO m, IsNativeDialog a) => a -> m Bool
- data NativeDialogGetTitleMethodInfo
- nativeDialogGetTitle :: (HasCallStack, MonadIO m, IsNativeDialog a) => a -> m (Maybe Text)
- data NativeDialogGetTransientForMethodInfo
- nativeDialogGetTransientFor :: (HasCallStack, MonadIO m, IsNativeDialog a) => a -> m (Maybe Window)
- data NativeDialogGetVisibleMethodInfo
- nativeDialogGetVisible :: (HasCallStack, MonadIO m, IsNativeDialog a) => a -> m Bool
- data NativeDialogHideMethodInfo
- nativeDialogHide :: (HasCallStack, MonadIO m, IsNativeDialog a) => a -> m ()
- data NativeDialogRunMethodInfo
- nativeDialogRun :: (HasCallStack, MonadIO m, IsNativeDialog a) => a -> m Int32
- data NativeDialogSetModalMethodInfo
- nativeDialogSetModal :: (HasCallStack, MonadIO m, IsNativeDialog a) => a -> Bool -> m ()
- data NativeDialogSetTitleMethodInfo
- nativeDialogSetTitle :: (HasCallStack, MonadIO m, IsNativeDialog a) => a -> Text -> m ()
- data NativeDialogSetTransientForMethodInfo
- nativeDialogSetTransientFor :: (HasCallStack, MonadIO m, IsNativeDialog a, IsWindow b) => a -> Maybe b -> m ()
- data NativeDialogShowMethodInfo
- nativeDialogShow :: (HasCallStack, MonadIO m, IsNativeDialog a) => a -> m ()
- data NativeDialogModalPropertyInfo
- constructNativeDialogModal :: IsNativeDialog o => Bool -> IO (GValueConstruct o)
- getNativeDialogModal :: (MonadIO m, IsNativeDialog o) => o -> m Bool
- nativeDialogModal :: AttrLabelProxy "modal"
- setNativeDialogModal :: (MonadIO m, IsNativeDialog o) => o -> Bool -> m ()
- data NativeDialogTitlePropertyInfo
- constructNativeDialogTitle :: IsNativeDialog o => Text -> IO (GValueConstruct o)
- getNativeDialogTitle :: (MonadIO m, IsNativeDialog o) => o -> m (Maybe Text)
- nativeDialogTitle :: AttrLabelProxy "title"
- setNativeDialogTitle :: (MonadIO m, IsNativeDialog o) => o -> Text -> m ()
- data NativeDialogTransientForPropertyInfo
- clearNativeDialogTransientFor :: (MonadIO m, IsNativeDialog o) => o -> m ()
- constructNativeDialogTransientFor :: (IsNativeDialog o, IsWindow a) => a -> IO (GValueConstruct o)
- getNativeDialogTransientFor :: (MonadIO m, IsNativeDialog o) => o -> m (Maybe Window)
- nativeDialogTransientFor :: AttrLabelProxy "transientFor"
- setNativeDialogTransientFor :: (MonadIO m, IsNativeDialog o, IsWindow a) => o -> a -> m ()
- data NativeDialogVisiblePropertyInfo
- constructNativeDialogVisible :: IsNativeDialog o => Bool -> IO (GValueConstruct o)
- getNativeDialogVisible :: (MonadIO m, IsNativeDialog o) => o -> m Bool
- nativeDialogVisible :: AttrLabelProxy "visible"
- setNativeDialogVisible :: (MonadIO m, IsNativeDialog o) => o -> Bool -> m ()
- type C_NativeDialogResponseCallback = Ptr () -> Int32 -> Ptr () -> IO ()
- type NativeDialogResponseCallback = Int32 -> IO ()
- data NativeDialogResponseSignalInfo
- afterNativeDialogResponse :: (GObject a, MonadIO m) => a -> NativeDialogResponseCallback -> m SignalHandlerId
- genClosure_NativeDialogResponse :: NativeDialogResponseCallback -> IO Closure
- mk_NativeDialogResponseCallback :: C_NativeDialogResponseCallback -> IO (FunPtr C_NativeDialogResponseCallback)
- noNativeDialogResponseCallback :: Maybe NativeDialogResponseCallback
- onNativeDialogResponse :: (GObject a, MonadIO m) => a -> NativeDialogResponseCallback -> m SignalHandlerId
- wrap_NativeDialogResponseCallback :: NativeDialogResponseCallback -> Ptr () -> Int32 -> Ptr () -> IO ()
Exported types
newtype NativeDialog Source #
GObject NativeDialog Source # | |
IsObject NativeDialog Source # | |
IsNativeDialog NativeDialog Source # | |
((~) * info (ResolveNativeDialogMethod t NativeDialog), MethodInfo * info NativeDialog p) => IsLabel t (NativeDialog -> p) Source # | |
((~) * info (ResolveNativeDialogMethod t NativeDialog), MethodInfo * info NativeDialog p) => IsLabelProxy t (NativeDialog -> p) Source # | |
HasAttributeList * NativeDialog Source # | |
type AttributeList NativeDialog Source # | |
type SignalList NativeDialog Source # | |
class GObject o => IsNativeDialog o Source #
toNativeDialog :: IsNativeDialog o => o -> IO NativeDialog Source #
Methods
destroy
data NativeDialogDestroyMethodInfo Source #
((~) * signature (m ()), MonadIO m, IsNativeDialog a) => MethodInfo * NativeDialogDestroyMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsNativeDialog a) | |
=> a |
|
-> 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 NativeDialog
.
Since: 3.20
getModal
data NativeDialogGetModalMethodInfo Source #
((~) * signature (m Bool), MonadIO m, IsNativeDialog a) => MethodInfo * NativeDialogGetModalMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsNativeDialog a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether the dialog is modal. See nativeDialogSetModal
.
Since: 3.20
getTitle
data NativeDialogGetTitleMethodInfo Source #
((~) * signature (m (Maybe Text)), MonadIO m, IsNativeDialog a) => MethodInfo * NativeDialogGetTitleMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsNativeDialog a) | |
=> a |
|
-> m (Maybe Text) | Returns: the title of the dialog, or |
Gets the title of the NativeDialog
.
Since: 3.20
getTransientFor
data NativeDialogGetTransientForMethodInfo Source #
((~) * signature (m (Maybe Window)), MonadIO m, IsNativeDialog a) => MethodInfo * NativeDialogGetTransientForMethodInfo a signature Source # | |
nativeDialogGetTransientFor Source #
:: (HasCallStack, MonadIO m, IsNativeDialog a) | |
=> a |
|
-> m (Maybe Window) | Returns: the transient parent for this window,
or |
Fetches the transient parent for this window. See
nativeDialogSetTransientFor
.
Since: 3.20
getVisible
data NativeDialogGetVisibleMethodInfo Source #
((~) * signature (m Bool), MonadIO m, IsNativeDialog a) => MethodInfo * NativeDialogGetVisibleMethodInfo a signature Source # | |
nativeDialogGetVisible Source #
:: (HasCallStack, MonadIO m, IsNativeDialog a) | |
=> a |
|
-> m Bool | Returns: |
Determines whether the dialog is visible.
Since: 3.20
hide
data NativeDialogHideMethodInfo Source #
((~) * signature (m ()), MonadIO m, IsNativeDialog a) => MethodInfo * NativeDialogHideMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsNativeDialog a) | |
=> a |
|
-> m () |
Hides the dialog if it is visilbe, 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.
Since: 3.20
run
data NativeDialogRunMethodInfo Source #
((~) * signature (m Int32), MonadIO m, IsNativeDialog a) => MethodInfo * NativeDialogRunMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsNativeDialog a) | |
=> a |
|
-> m Int32 | Returns: response ID |
Blocks in a recursive main loop until self
emits the
NativeDialog
::response
signal. It then returns the response ID
from the ::response signal emission.
Before entering the recursive main loop, nativeDialogRun
calls nativeDialogShow
on the dialog for you.
After nativeDialogRun
returns, then dialog will be hidden.
Typical usage of this function might be:
C code
gint result = gtk_native_dialog_run (GTK_NATIVE_DIALOG (dialog)); switch (result) { case GTK_RESPONSE_ACCEPT: do_application_specific_something (); break; default: do_nothing_since_dialog_was_cancelled (); break; } g_object_unref (dialog);
Note that even though the recursive main loop gives the effect of a
modal dialog (it prevents the user from interacting with other
windows in the same window group while the dialog is run), callbacks
such as timeouts, IO channel watches, DND drops, etc, will
be triggered during a gtk_nautilus_dialog_run()
call.
Since: 3.20
setModal
data NativeDialogSetModalMethodInfo Source #
((~) * signature (Bool -> m ()), MonadIO m, IsNativeDialog a) => MethodInfo * NativeDialogSetModalMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsNativeDialog a) | |
=> a |
|
-> Bool |
|
-> 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][gtk-X11-arch]
will then disallow lowering the dialog below the parent.
Since: 3.20
setTitle
data NativeDialogSetTitleMethodInfo Source #
((~) * signature (Text -> m ()), MonadIO m, IsNativeDialog a) => MethodInfo * NativeDialogSetTitleMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsNativeDialog a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the title of the NativeDialog
.
Since: 3.20
setTransientFor
data NativeDialogSetTransientForMethodInfo Source #
((~) * signature (Maybe b -> m ()), MonadIO m, IsNativeDialog a, IsWindow b) => MethodInfo * NativeDialogSetTransientForMethodInfo a signature Source # | |
nativeDialogSetTransientFor Source #
:: (HasCallStack, MonadIO m, IsNativeDialog a, IsWindow b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Dialog windows should be set transient for the main application window they were spawned from. This allows [window managers][gtk-X11-arch] 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.
Since: 3.20
show
data NativeDialogShowMethodInfo Source #
((~) * signature (m ()), MonadIO m, IsNativeDialog a) => MethodInfo * NativeDialogShowMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsNativeDialog a) | |
=> a |
|
-> m () |
Shows the dialog on the display, allowing the user to interact with
it. 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.
Since: 3.20
Properties
modal
data NativeDialogModalPropertyInfo Source #
constructNativeDialogModal :: IsNativeDialog o => Bool -> IO (GValueConstruct o) Source #
getNativeDialogModal :: (MonadIO m, IsNativeDialog o) => o -> m Bool Source #
nativeDialogModal :: AttrLabelProxy "modal" Source #
setNativeDialogModal :: (MonadIO m, IsNativeDialog o) => o -> Bool -> m () Source #
title
data NativeDialogTitlePropertyInfo Source #
constructNativeDialogTitle :: IsNativeDialog o => Text -> IO (GValueConstruct o) Source #
getNativeDialogTitle :: (MonadIO m, IsNativeDialog o) => o -> m (Maybe Text) Source #
nativeDialogTitle :: AttrLabelProxy "title" Source #
setNativeDialogTitle :: (MonadIO m, IsNativeDialog o) => o -> Text -> m () Source #
transientFor
data NativeDialogTransientForPropertyInfo Source #
clearNativeDialogTransientFor :: (MonadIO m, IsNativeDialog o) => o -> m () Source #
constructNativeDialogTransientFor :: (IsNativeDialog o, IsWindow a) => a -> IO (GValueConstruct o) Source #
getNativeDialogTransientFor :: (MonadIO m, IsNativeDialog o) => o -> m (Maybe Window) Source #
nativeDialogTransientFor :: AttrLabelProxy "transientFor" Source #
setNativeDialogTransientFor :: (MonadIO m, IsNativeDialog o, IsWindow a) => o -> a -> m () Source #
visible
data NativeDialogVisiblePropertyInfo Source #
constructNativeDialogVisible :: IsNativeDialog o => Bool -> IO (GValueConstruct o) Source #
getNativeDialogVisible :: (MonadIO m, IsNativeDialog o) => o -> m Bool Source #
nativeDialogVisible :: AttrLabelProxy "visible" Source #
setNativeDialogVisible :: (MonadIO m, IsNativeDialog o) => o -> Bool -> m () Source #
Signals
response
type NativeDialogResponseCallback = Int32 -> IO () Source #
afterNativeDialogResponse :: (GObject a, MonadIO m) => a -> NativeDialogResponseCallback -> m SignalHandlerId Source #
mk_NativeDialogResponseCallback :: C_NativeDialogResponseCallback -> IO (FunPtr C_NativeDialogResponseCallback) Source #
onNativeDialogResponse :: (GObject a, MonadIO m) => a -> NativeDialogResponseCallback -> m SignalHandlerId Source #
wrap_NativeDialogResponseCallback :: NativeDialogResponseCallback -> Ptr () -> Int32 -> Ptr () -> IO () Source #