gi-gdk-4.0.4: Gdk bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Gdk.Objects.Drag

Description

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

Exported types

newtype Drag Source #

Memory-managed wrapper type.

Constructors

Drag (ManagedPtr Drag) 

Instances

Instances details
Eq Drag Source # 
Instance details

Defined in GI.Gdk.Objects.Drag

Methods

(==) :: Drag -> Drag -> Bool #

(/=) :: Drag -> Drag -> Bool #

GObject Drag Source # 
Instance details

Defined in GI.Gdk.Objects.Drag

ManagedPtrNewtype Drag Source # 
Instance details

Defined in GI.Gdk.Objects.Drag

TypedObject Drag Source # 
Instance details

Defined in GI.Gdk.Objects.Drag

Methods

glibType :: IO GType #

HasParentTypes Drag Source # 
Instance details

Defined in GI.Gdk.Objects.Drag

IsGValue (Maybe Drag) Source #

Convert Drag to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gdk.Objects.Drag

type ParentTypes Drag Source # 
Instance details

Defined in GI.Gdk.Objects.Drag

class (GObject o, IsDescendantOf Drag o) => IsDrag o Source #

Type class for types which can be safely cast to Drag, for instance with toDrag.

Instances

Instances details
(GObject o, IsDescendantOf Drag o) => IsDrag o Source # 
Instance details

Defined in GI.Gdk.Objects.Drag

toDrag :: (MonadIO m, IsDrag o) => o -> m Drag Source #

Cast to Drag, for types for which this is known to be safe. For general casts, use castTo.

Methods

begin

dragBegin Source #

Arguments

:: (HasCallStack, MonadIO m, IsSurface a, IsDevice b, IsContentProvider c) 
=> a

surface: the source surface for this drag

-> b

device: the device that controls this drag

-> c

content: the offered content

-> [DragAction]

actions: the actions supported by this drag

-> Double

dx: the x offset to device's position where the drag nominally started

-> Double

dy: the y offset to device's position where the drag nominally started

-> m (Maybe Drag)

Returns: a newly created GdkDrag

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

dragDropDone Source #

Arguments

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

drag: a GdkDrag

-> Bool

success: whether the drag was ultimatively successful

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

dragGetActions Source #

Arguments

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

drag: a GdkDrag

-> m [DragAction]

Returns: the GdkDragAction flags

Determines the bitmask of possible actions proposed by the source.

getContent

dragGetContent Source #

Arguments

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

drag: a GdkDrag

-> m ContentProvider

Returns: The GdkContentProvider associated to drag.

Returns the GdkContentProvider associated to the GdkDrag object.

getDevice

dragGetDevice Source #

Arguments

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

drag: a GdkDrag

-> m Device

Returns: The GdkDevice associated to drag.

Returns the GdkDevice associated to the GdkDrag object.

getDisplay

dragGetDisplay Source #

Arguments

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

drag: a GdkDrag

-> m Display

Returns: a GdkDisplay

Gets the GdkDisplay that the drag object was created for.

getDragSurface

dragGetDragSurface Source #

Arguments

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

drag: a GdkDrag

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

dragGetFormats Source #

Arguments

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

drag: a GdkDrag

-> m ContentFormats

Returns: a GdkContentFormats

Retrieves the formats supported by this GdkDrag object.

getSelectedAction

dragGetSelectedAction Source #

Arguments

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

drag: a GdkDrag

-> m [DragAction]

Returns: a GdkDragAction value

Determines the action chosen by the drag destination.

getSurface

dragGetSurface Source #

Arguments

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

drag: a GdkDrag

-> m Surface

Returns: The GdkSurface where the drag originates

Returns the GdkSurface where the drag originates.

setHotspot

dragSetHotspot Source #

Arguments

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

drag: a GdkDrag

-> Int32

hotX: x coordinate of the drag surface hotspot

-> Int32

hotY: y coordinate of the drag surface hotspot

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

Arguments

 = DragCancelReason

reason: The reason the drag was cancelled

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