gi-gdk4-4.0.10: Gdk 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.Gdk.Objects.Drop

Contents

- Exported types
- Methods
  - finish
  - getActions
  - getDevice
  - getDisplay
  - getDrag
  - getFormats
  - getSurface
  - readAsync
  - readFinish
  - readValueAsync
  - readValueFinish
  - status
- Properties
  - actions
  - device
  - display
  - drag
  - formats
  - surface

Description

Represents the target of an ongoing DND operation.

Possible drop sites get informed about the status of the ongoing drag operation with events of type `GDK_DRAG_ENTER`, `GDK_DRAG_LEAVE`, `GDK_DRAG_MOTION` and `GDK_DROP_START`. The `GdkDrop` object can be obtained from these `Event` types using `dNDEventGetDrop`.

The actual data transfer is initiated from the target side via an async read, using one of the `GdkDrop` methods for this purpose: `dropReadAsync` or `dropReadValueAsync`.

GTK provides a higher level abstraction based on top of these functions, and so they are not normally needed in GTK applications. See the "Drag and Drop" section of the GTK documentation for more information.

Synopsis

- newtype Drop = Drop (ManagedPtr Drop)
- class (GObject o, IsDescendantOf Drop o) => IsDrop o
- toDrop :: (MonadIO m, IsDrop o) => o -> m Drop
- dropFinish :: (HasCallStack, MonadIO m, IsDrop a) => a -> [DragAction] -> m ()
- dropGetActions :: (HasCallStack, MonadIO m, IsDrop a) => a -> m [DragAction]
- dropGetDevice :: (HasCallStack, MonadIO m, IsDrop a) => a -> m Device
- dropGetDisplay :: (HasCallStack, MonadIO m, IsDrop a) => a -> m Display
- dropGetDrag :: (HasCallStack, MonadIO m, IsDrop a) => a -> m (Maybe Drag)
- dropGetFormats :: (HasCallStack, MonadIO m, IsDrop a) => a -> m ContentFormats
- dropGetSurface :: (HasCallStack, MonadIO m, IsDrop a) => a -> m Surface
- dropReadAsync :: (HasCallStack, MonadIO m, IsDrop a, IsCancellable b) => a -> [Text] -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- dropReadFinish :: (HasCallStack, MonadIO m, IsDrop a, IsAsyncResult b) => a -> b -> m (Maybe InputStream, Text)
- dropReadValueAsync :: (HasCallStack, MonadIO m, IsDrop a, IsCancellable b) => a -> GType -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- dropReadValueFinish :: (HasCallStack, MonadIO m, IsDrop a, IsAsyncResult b) => a -> b -> m GValue
- dropStatus :: (HasCallStack, MonadIO m, IsDrop a) => a -> [DragAction] -> [DragAction] -> m ()
- constructDropActions :: (IsDrop o, MonadIO m) => [DragAction] -> m (GValueConstruct o)
- getDropActions :: (MonadIO m, IsDrop o) => o -> m [DragAction]
- constructDropDevice :: (IsDrop o, MonadIO m, IsDevice a) => a -> m (GValueConstruct o)
- getDropDevice :: (MonadIO m, IsDrop o) => o -> m Device
- getDropDisplay :: (MonadIO m, IsDrop o) => o -> m Display
- constructDropDrag :: (IsDrop o, MonadIO m, IsDrag a) => a -> m (GValueConstruct o)
- getDropDrag :: (MonadIO m, IsDrop o) => o -> m (Maybe Drag)
- constructDropFormats :: (IsDrop o, MonadIO m) => ContentFormats -> m (GValueConstruct o)
- getDropFormats :: (MonadIO m, IsDrop o) => o -> m ContentFormats
- constructDropSurface :: (IsDrop o, MonadIO m, IsSurface a) => a -> m (GValueConstruct o)
- getDropSurface :: (MonadIO m, IsDrop o) => o -> m Surface

# Exported types

newtype Drop Source #

Memory-managed wrapper type.

Constructors

Drop (ManagedPtr Drop) |

#### Instances

Instances details

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

class (GObject o, IsDescendantOf Drop o) => IsDrop o Source #

Type class for types which can be safely cast to `Drop`, for instance with `toDrop`.

#### Instances

Instances details

(GObject o, IsDescendantOf Drop o) => IsDrop o Source # |
Instance details Defined in GI.Gdk.Objects.Drop

toDrop :: (MonadIO m, IsDrop o) => o -> m Drop Source #

Cast to `Drop`, 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, finish, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, readAsync, readFinish, readValueAsync, readValueFinish, ref, refSink, runDispose, status, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getActions, getData, getDevice, getDisplay, getDrag, getFormats, getProperty, getQdata, getSurface.

#### Setters

setData, setDataFull, setProperty.

## finish

dropFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrop a) |
=> a | `self`: a `GdkDrop`
-> [DragAction] | `action`: the action performed by the destination or `GDK_ACTION_NONE` if the drop failed
-> m () |

Ends the drag operation after a drop.

The `action` must be a single action selected from the actions available via `dropGetActions`.

## getActions

dropGetActions Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrop a) |
=> a | `self`: a `GdkDrop`
-> m [DragAction] | Returns: The possible `GdkDragActions`

Returns the possible actions for this `GdkDrop`.

If this value contains multiple actions - i.e. `DragAction`.`is_unique`() returns false for the result - `dropFinish` must choose the action to use when accepting the drop. This will only happen if you passed `GDK_ACTION_ASK` as one of the possible actions in `dropStatus`. `GDK_ACTION_ASK` itself will not be included in the actions returned by this function.

This value may change over the lifetime of the `Drop` both as a response to source side actions as well as to calls to `dropStatus` or `dropFinish`. The source side will not change this value anymore once a drop has started.

## getDevice

dropGetDevice Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrop a) |
=> a | `self`: a `GdkDrop`
-> m Device | Returns: The `GdkDevice` performing the drop.

Returns the `GdkDevice` performing the drop.

## getDisplay

dropGetDisplay Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrop a) |
=> a | `self`: a `GdkDrop`
-> m Display | Returns: a `GdkDisplay`

Gets the `GdkDisplay` that `self` was created for.

## getDrag

dropGetDrag Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrop a) |
=> a | `self`: a `GdkDrop`
-> m (Maybe Drag) | Returns: the corresponding `GdkDrag`

If this is an in-app drag-and-drop operation, returns the `GdkDrag` that corresponds to this drop.

If it is not, `NULL` is returned.

## getFormats

dropGetFormats Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrop a) |
=> a | `self`: a `GdkDrop`
-> m ContentFormats | Returns: The possible `GdkContentFormats`

Returns the `GdkContentFormats` that the drop offers the data to be read in.

## getSurface

dropGetSurface Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrop a) |
=> a | `self`: a `GdkDrop`
-> m Surface | Returns: The `GdkSurface` performing the drop.

Returns the `GdkSurface` performing the drop.

## readAsync

dropReadAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrop a, IsCancellable b) |
=> a | `self`: a `GdkDrop`
-> [Text] | `mimeTypes`: pointer to an array of mime types
-> Int32 | `ioPriority`: the I/O priority for the read operation
-> Maybe b | `cancellable`: optional `GCancellable` object
-> Maybe AsyncReadyCallback | `callback`: a `GAsyncReadyCallback` to call when the request is satisfied
-> m () |

Asynchronously read the dropped data from a `GdkDrop` in a format that complies with one of the mime types.

## readFinish

dropReadFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrop a, IsAsyncResult b) |
=> a | `self`: a `GdkDrop`
-> b | `result`: a `GAsyncResult`
-> m (Maybe InputStream, Text) | Returns: the `GInputStream` (Can throw `GError`)

Finishes an async drop read operation.

Note that you must not use blocking read calls on the returned stream in the GTK thread, since some platforms might require communication with GTK to complete the data transfer. You can use async APIs such as `inputStreamReadBytesAsync`.

See `dropReadAsync`.

## readValueAsync

dropReadValueAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrop a, IsCancellable b) |
=> a | `self`: a `GdkDrop`
-> GType | `type`: a `GType` to read
-> Int32 | `ioPriority`: the I/O priority of the request.
-> Maybe b | `cancellable`: optional `GCancellable` object, `Nothing` to ignore.
-> Maybe AsyncReadyCallback | `callback`: callback to call when the request is satisfied
-> m () |

Asynchronously request the drag operation's contents converted to the given `type`.

For local drag-and-drop operations that are available in the given `GType`, the value will be copied directly. Otherwise, GDK will try to use `contentDeserializeAsync` to convert the data.

## readValueFinish

dropReadValueFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrop a, IsAsyncResult b) |
=> a | `self`: a `GdkDrop`
-> b | `result`: a `GAsyncResult`
-> m GValue | Returns: a `GValue` containing the result. (Can throw `GError`)

Finishes an async drop read.

See `dropReadValueAsync`.

## status

dropStatus Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrop a) |
=> a | `self`: a `GdkDrop`
-> [DragAction] | `actions`: Supported actions of the destination, or `GDK_ACTION_NONE` to indicate that a drop will not be accepted
-> [DragAction] | `preferred`: A unique action that's a member of `actions` indicating the preferred action
-> m () |

Selects all actions that are potentially supported by the destination.

When calling this function, do not restrict the passed in actions to the ones provided by `dropGetActions`. Those actions may change in the future, even depending on the actions you provide here.

The `preferred` action is a hint to the drag-and-drop mechanism about which action to use when multiple actions are possible.

This function should be called by drag destinations in response to `GDK_DRAG_ENTER` or `GDK_DRAG_MOTION` events. If the destination does not yet know the exact actions it supports, it should set any possible actions first and then later call this function again.

# Properties

## actions

The possible actions for this drop

constructDropActions :: (IsDrop o, MonadIO m) => [DragAction] -> m (GValueConstruct o) Source #

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

getDropActions :: (MonadIO m, IsDrop o) => o -> m [DragAction] Source #

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

    get drop #actions

## device

The `GdkDevice` performing the drop

constructDropDevice :: (IsDrop o, MonadIO m, IsDevice a) => a -> m (GValueConstruct o) Source #

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

getDropDevice :: (MonadIO m, IsDrop o) => o -> m Device Source #

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

    get drop #device

## display

The `GdkDisplay` that the drop belongs to.

getDropDisplay :: (MonadIO m, IsDrop o) => o -> m Display Source #

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

    get drop #display

## drag

The `GdkDrag` that initiated this drop

constructDropDrag :: (IsDrop o, MonadIO m, IsDrag a) => a -> m (GValueConstruct o) Source #

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

getDropDrag :: (MonadIO m, IsDrop o) => o -> m (Maybe Drag) Source #

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

    get drop #drag

## formats

The possible formats that the drop can provide its data in.

constructDropFormats :: (IsDrop o, MonadIO m) => ContentFormats -> m (GValueConstruct o) Source #

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

getDropFormats :: (MonadIO m, IsDrop o) => o -> m ContentFormats Source #

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

    get drop #formats

## surface

The `GdkSurface` the drop happens on

constructDropSurface :: (IsDrop o, MonadIO m, IsSurface a) => a -> m (GValueConstruct o) Source #

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

getDropSurface :: (MonadIO m, IsDrop o) => o -> m Surface Source #

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

    get drop #surface