gi-gtk-3.0.11: Gtk bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.NativeDialog

Contents

Description

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.

Synopsis

Exported types

Methods

destroy

nativeDialogDestroy Source #

Arguments

:: (HasCallStack, MonadIO m, IsNativeDialog a) 
=> a

self: a NativeDialog

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

nativeDialogGetModal Source #

Arguments

:: (HasCallStack, MonadIO m, IsNativeDialog a) 
=> a

self: a NativeDialog

-> m Bool

Returns: True if the dialog is set to be modal

Returns whether the dialog is modal. See nativeDialogSetModal.

Since: 3.20

getTitle

nativeDialogGetTitle Source #

Arguments

:: (HasCallStack, MonadIO m, IsNativeDialog a) 
=> a

self: a NativeDialog

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

Since: 3.20

getTransientFor

nativeDialogGetTransientFor Source #

Arguments

:: (HasCallStack, MonadIO m, IsNativeDialog a) 
=> a

self: a NativeDialog

-> 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. See nativeDialogSetTransientFor.

Since: 3.20

getVisible

nativeDialogGetVisible Source #

Arguments

:: (HasCallStack, MonadIO m, IsNativeDialog a) 
=> a

self: a NativeDialog

-> m Bool

Returns: True if the dialog is visible

Determines whether the dialog is visible.

Since: 3.20

hide

data NativeDialogHideMethodInfo Source #

Instances

((~) * signature (m ()), MonadIO m, IsNativeDialog a) => MethodInfo * NativeDialogHideMethodInfo a signature Source # 

nativeDialogHide Source #

Arguments

:: (HasCallStack, MonadIO m, IsNativeDialog a) 
=> a

self: a NativeDialog

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

nativeDialogRun Source #

Arguments

:: (HasCallStack, MonadIO m, IsNativeDialog a) 
=> a

self: a NativeDialog

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

nativeDialogSetModal Source #

Arguments

:: (HasCallStack, MonadIO m, IsNativeDialog a) 
=> a

self: a NativeDialog

-> 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][gtk-X11-arch] will then disallow lowering the dialog below the parent.

Since: 3.20

setTitle

nativeDialogSetTitle Source #

Arguments

:: (HasCallStack, MonadIO m, IsNativeDialog a) 
=> a

self: a NativeDialog

-> Text

title: title of the dialog

-> m () 

Sets the title of the NativeDialog.

Since: 3.20

setTransientFor

nativeDialogSetTransientFor Source #

Arguments

:: (HasCallStack, MonadIO m, IsNativeDialog a, IsWindow b) 
=> a

self: a NativeDialog

-> Maybe b

parent: parent window, or Nothing

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

Instances

((~) * signature (m ()), MonadIO m, IsNativeDialog a) => MethodInfo * NativeDialogShowMethodInfo a signature Source # 

nativeDialogShow Source #

Arguments

:: (HasCallStack, MonadIO m, IsNativeDialog a) 
=> a

self: a NativeDialog

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

Instances

AttrInfo NativeDialogModalPropertyInfo Source # 
type AttrOrigin NativeDialogModalPropertyInfo Source # 
type AttrLabel NativeDialogModalPropertyInfo Source # 
type AttrGetType NativeDialogModalPropertyInfo Source # 
type AttrBaseTypeConstraint NativeDialogModalPropertyInfo Source # 
type AttrSetTypeConstraint NativeDialogModalPropertyInfo Source # 
type AttrAllowedOps NativeDialogModalPropertyInfo Source # 

title

data NativeDialogTitlePropertyInfo Source #

Instances

AttrInfo NativeDialogTitlePropertyInfo Source # 
type AttrOrigin NativeDialogTitlePropertyInfo Source # 
type AttrLabel NativeDialogTitlePropertyInfo Source # 
type AttrGetType NativeDialogTitlePropertyInfo Source # 
type AttrBaseTypeConstraint NativeDialogTitlePropertyInfo Source # 
type AttrSetTypeConstraint NativeDialogTitlePropertyInfo Source # 
type AttrAllowedOps NativeDialogTitlePropertyInfo Source # 

transientFor

data NativeDialogTransientForPropertyInfo Source #

Instances

AttrInfo NativeDialogTransientForPropertyInfo Source # 
type AttrOrigin NativeDialogTransientForPropertyInfo Source # 
type AttrLabel NativeDialogTransientForPropertyInfo Source # 
type AttrGetType NativeDialogTransientForPropertyInfo Source # 
type AttrBaseTypeConstraint NativeDialogTransientForPropertyInfo Source # 
type AttrSetTypeConstraint NativeDialogTransientForPropertyInfo Source # 
type AttrAllowedOps NativeDialogTransientForPropertyInfo Source # 

visible

data NativeDialogVisiblePropertyInfo Source #

Instances

AttrInfo NativeDialogVisiblePropertyInfo Source # 
type AttrOrigin NativeDialogVisiblePropertyInfo Source # 
type AttrLabel NativeDialogVisiblePropertyInfo Source # 
type AttrGetType NativeDialogVisiblePropertyInfo Source # 
type AttrBaseTypeConstraint NativeDialogVisiblePropertyInfo Source # 
type AttrSetTypeConstraint NativeDialogVisiblePropertyInfo Source # 
type AttrAllowedOps NativeDialogVisiblePropertyInfo Source # 

Signals

response