Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
The GdkDrag
object represents the source of an ongoing DND operation.
A GdkDrag
is created when a drag is started, and stays alive for duration of
the DND operation. After a drag has been started with [funcgdk
.Drag.begin],
the caller gets informed about the status of the ongoing drag operation
with signals on the GdkDrag
object.
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 Drag = Drag (ManagedPtr Drag)
- class (GObject o, IsDescendantOf Drag o) => IsDrag o
- toDrag :: (MonadIO m, IsDrag o) => o -> m Drag
- dragBegin :: (HasCallStack, MonadIO m, IsSurface a, IsDevice b, IsContentProvider c) => a -> b -> c -> [DragAction] -> Double -> Double -> m (Maybe Drag)
- dragDropDone :: (HasCallStack, MonadIO m, IsDrag a) => a -> Bool -> m ()
- dragGetActions :: (HasCallStack, MonadIO m, IsDrag a) => a -> m [DragAction]
- dragGetContent :: (HasCallStack, MonadIO m, IsDrag a) => a -> m ContentProvider
- dragGetDevice :: (HasCallStack, MonadIO m, IsDrag a) => a -> m Device
- dragGetDisplay :: (HasCallStack, MonadIO m, IsDrag a) => a -> m Display
- dragGetDragSurface :: (HasCallStack, MonadIO m, IsDrag a) => a -> m (Maybe Surface)
- dragGetFormats :: (HasCallStack, MonadIO m, IsDrag a) => a -> m ContentFormats
- dragGetSelectedAction :: (HasCallStack, MonadIO m, IsDrag a) => a -> m [DragAction]
- dragGetSurface :: (HasCallStack, MonadIO m, IsDrag a) => a -> m Surface
- dragSetHotspot :: (HasCallStack, MonadIO m, IsDrag a) => a -> Int32 -> Int32 -> m ()
- constructDragActions :: (IsDrag o, MonadIO m) => [DragAction] -> m (GValueConstruct o)
- getDragActions :: (MonadIO m, IsDrag o) => o -> m [DragAction]
- setDragActions :: (MonadIO m, IsDrag o) => o -> [DragAction] -> m ()
- constructDragContent :: (IsDrag o, MonadIO m, IsContentProvider a) => a -> m (GValueConstruct o)
- getDragContent :: (MonadIO m, IsDrag o) => o -> m ContentProvider
- constructDragDevice :: (IsDrag o, MonadIO m, IsDevice a) => a -> m (GValueConstruct o)
- getDragDevice :: (MonadIO m, IsDrag o) => o -> m Device
- getDragDisplay :: (MonadIO m, IsDrag o) => o -> m Display
- constructDragFormats :: (IsDrag o, MonadIO m) => ContentFormats -> m (GValueConstruct o)
- getDragFormats :: (MonadIO m, IsDrag o) => o -> m ContentFormats
- constructDragSelectedAction :: (IsDrag o, MonadIO m) => [DragAction] -> m (GValueConstruct o)
- getDragSelectedAction :: (MonadIO m, IsDrag o) => o -> m [DragAction]
- setDragSelectedAction :: (MonadIO m, IsDrag o) => o -> [DragAction] -> m ()
- constructDragSurface :: (IsDrag o, MonadIO m, IsSurface a) => a -> m (GValueConstruct o)
- getDragSurface :: (MonadIO m, IsDrag o) => o -> m Surface
- type DragCancelCallback = DragCancelReason -> IO ()
- afterDragCancel :: (IsDrag a, MonadIO m) => a -> ((?self :: a) => DragCancelCallback) -> m SignalHandlerId
- onDragCancel :: (IsDrag a, MonadIO m) => a -> ((?self :: a) => DragCancelCallback) -> m SignalHandlerId
- type DragDndFinishedCallback = IO ()
- afterDragDndFinished :: (IsDrag a, MonadIO m) => a -> ((?self :: a) => DragDndFinishedCallback) -> m SignalHandlerId
- onDragDndFinished :: (IsDrag a, MonadIO m) => a -> ((?self :: a) => DragDndFinishedCallback) -> m SignalHandlerId
- type DragDropPerformedCallback = IO ()
- afterDragDropPerformed :: (IsDrag a, MonadIO m) => a -> ((?self :: a) => DragDropPerformedCallback) -> m SignalHandlerId
- onDragDropPerformed :: (IsDrag a, MonadIO m) => a -> ((?self :: a) => DragDropPerformedCallback) -> m SignalHandlerId
Exported types
Memory-managed wrapper type.
Instances
Eq Drag Source # | |
GObject Drag Source # | |
Defined in GI.Gdk.Objects.Drag | |
ManagedPtrNewtype Drag Source # | |
Defined in GI.Gdk.Objects.Drag toManagedPtr :: Drag -> ManagedPtr Drag # | |
TypedObject Drag Source # | |
Defined in GI.Gdk.Objects.Drag | |
HasParentTypes Drag Source # | |
Defined in GI.Gdk.Objects.Drag | |
IsGValue (Maybe Drag) Source # | Convert |
Defined in GI.Gdk.Objects.Drag | |
type ParentTypes Drag Source # | |
Defined in GI.Gdk.Objects.Drag type ParentTypes Drag = '[Object] |
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, dropDone, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getActions, getContent, getData, getDevice, getDisplay, getDragSurface, getFormats, getProperty, getQdata, getSelectedAction, getSurface.
Setters
begin
:: (HasCallStack, MonadIO m, IsSurface a, IsDevice b, IsContentProvider c) | |
=> a |
|
-> b |
|
-> c |
|
-> [DragAction] |
|
-> Double |
|
-> Double |
|
-> m (Maybe Drag) | Returns: a newly created |
Starts a drag and creates a new drag context for it.
This function is called by the drag source. After this call, you
probably want to set up the drag icon using the surface returned
by dragGetDragSurface
.
This function returns a reference to the Drag
object,
but GTK keeps its own reference as well, as long as the DND operation
is going on.
Note: if actions
include DragActionMove
, you need to listen for
the Drag::dndFinished signal and delete the data at
the source if dragGetSelectedAction
returns
DragActionMove
.
dropDone
:: (HasCallStack, MonadIO m, IsDrag a) | |
=> a |
|
-> Bool |
|
-> m () |
Informs GDK that the drop ended.
Passing False
for success
may trigger a drag cancellation
animation.
This function is called by the drag source, and should be the
last call before dropping the reference to the drag
.
The GdkDrag
will only take the first dragDropDone
call as effective, if this function is called multiple times,
all subsequent calls will be ignored.
getActions
:: (HasCallStack, MonadIO m, IsDrag a) | |
=> a |
|
-> m [DragAction] | Returns: the |
Determines the bitmask of possible actions proposed by the source.
getContent
:: (HasCallStack, MonadIO m, IsDrag a) | |
=> a |
|
-> m ContentProvider | Returns: The |
Returns the GdkContentProvider
associated to the GdkDrag
object.
getDevice
:: (HasCallStack, MonadIO m, IsDrag a) | |
=> a |
|
-> m Device | Returns: The |
Returns the GdkDevice
associated to the GdkDrag
object.
getDisplay
:: (HasCallStack, MonadIO m, IsDrag a) | |
=> a |
|
-> m Display | Returns: a |
Gets the GdkDisplay
that the drag object was created for.
getDragSurface
:: (HasCallStack, MonadIO m, IsDrag a) | |
=> a |
|
-> m (Maybe Surface) | Returns: the drag surface |
Returns the surface on which the drag icon should be rendered during the drag operation.
Note that the surface may not be available until the drag operation
has begun. GDK will move the surface in accordance with the ongoing
drag operation. The surface is owned by drag
and will be destroyed
when the drag operation is over.
getFormats
:: (HasCallStack, MonadIO m, IsDrag a) | |
=> a |
|
-> m ContentFormats | Returns: a |
Retrieves the formats supported by this GdkDrag
object.
getSelectedAction
dragGetSelectedAction Source #
:: (HasCallStack, MonadIO m, IsDrag a) | |
=> a |
|
-> m [DragAction] | Returns: a |
Determines the action chosen by the drag destination.
getSurface
:: (HasCallStack, MonadIO m, IsDrag a) | |
=> a |
|
-> m Surface | Returns: The |
Returns the GdkSurface
where the drag originates.
setHotspot
:: (HasCallStack, MonadIO m, IsDrag a) | |
=> a |
|
-> Int32 |
|
-> Int32 |
|
-> m () |
Sets the position of the drag surface that will be kept under the cursor hotspot.
Initially, the hotspot is at the top left corner of the drag surface.
Properties
actions
The possible actions of this drag.
constructDragActions :: (IsDrag 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
.
getDragActions :: (MonadIO m, IsDrag o) => o -> m [DragAction] Source #
Get the value of the “actions
” property.
When overloading is enabled, this is equivalent to
get
drag #actions
setDragActions :: (MonadIO m, IsDrag o) => o -> [DragAction] -> m () Source #
Set the value of the “actions
” property.
When overloading is enabled, this is equivalent to
set
drag [ #actions:=
value ]
content
The GdkContentProvider
.
constructDragContent :: (IsDrag o, MonadIO m, IsContentProvider a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “content
” property. This is rarely needed directly, but it is used by new
.
getDragContent :: (MonadIO m, IsDrag o) => o -> m ContentProvider Source #
Get the value of the “content
” property.
When overloading is enabled, this is equivalent to
get
drag #content
device
The GdkDevice
that is performing the drag.
constructDragDevice :: (IsDrag 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
.
getDragDevice :: (MonadIO m, IsDrag o) => o -> m Device Source #
Get the value of the “device
” property.
When overloading is enabled, this is equivalent to
get
drag #device
display
The GdkDisplay
that the drag belongs to.
getDragDisplay :: (MonadIO m, IsDrag o) => o -> m Display Source #
Get the value of the “display
” property.
When overloading is enabled, this is equivalent to
get
drag #display
formats
The possible formats that the drag can provide its data in.
constructDragFormats :: (IsDrag 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
.
getDragFormats :: (MonadIO m, IsDrag o) => o -> m ContentFormats Source #
Get the value of the “formats
” property.
When overloading is enabled, this is equivalent to
get
drag #formats
selectedAction
The currently selected action of the drag.
constructDragSelectedAction :: (IsDrag o, MonadIO m) => [DragAction] -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “selected-action
” property. This is rarely needed directly, but it is used by new
.
getDragSelectedAction :: (MonadIO m, IsDrag o) => o -> m [DragAction] Source #
Get the value of the “selected-action
” property.
When overloading is enabled, this is equivalent to
get
drag #selectedAction
setDragSelectedAction :: (MonadIO m, IsDrag o) => o -> [DragAction] -> m () Source #
Set the value of the “selected-action
” property.
When overloading is enabled, this is equivalent to
set
drag [ #selectedAction:=
value ]
surface
The surface where the drag originates.
constructDragSurface :: (IsDrag 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
.
getDragSurface :: (MonadIO m, IsDrag o) => o -> m Surface Source #
Get the value of the “surface
” property.
When overloading is enabled, this is equivalent to
get
drag #surface
Signals
cancel
type DragCancelCallback Source #
= DragCancelReason |
|
-> IO () |
Emitted when the drag operation is cancelled.
afterDragCancel :: (IsDrag a, MonadIO m) => a -> ((?self :: a) => DragCancelCallback) -> m SignalHandlerId Source #
Connect a signal handler for the cancel signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
drag #cancel 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.
onDragCancel :: (IsDrag a, MonadIO m) => a -> ((?self :: a) => DragCancelCallback) -> m SignalHandlerId Source #
Connect a signal handler for the cancel signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
drag #cancel callback
dndFinished
type DragDndFinishedCallback = IO () Source #
Emitted when the destination side has finished reading all data.
The drag object can now free all miscellaneous data.
afterDragDndFinished :: (IsDrag a, MonadIO m) => a -> ((?self :: a) => DragDndFinishedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the dndFinished signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
drag #dndFinished 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.
onDragDndFinished :: (IsDrag a, MonadIO m) => a -> ((?self :: a) => DragDndFinishedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the dndFinished signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
drag #dndFinished callback
dropPerformed
type DragDropPerformedCallback = IO () Source #
Emitted when the drop operation is performed on an accepting client.
afterDragDropPerformed :: (IsDrag a, MonadIO m) => a -> ((?self :: a) => DragDropPerformedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the dropPerformed signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
drag #dropPerformed 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.
onDragDropPerformed :: (IsDrag a, MonadIO m) => a -> ((?self :: a) => DragDropPerformedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the dropPerformed signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
drag #dropPerformed callback