1.19 <GdkDrag>

Class: <GdkDrag>

It derives from <GObject>.

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

Properties

Property: drag:actions self

The possible actions of this drag.

Its value is a <GdkDragAction> (or, to set it, a list of its symbols, or one of them).

Set it with (set! (drag:actions self) value).

Property: drag:content self

The <GdkContentProvider>.

Its value is a <GdkContentProvider>, or #f.

It can only be set when the object is made, with #:content.

Property: drag:device self

The <GdkDevice> that is performing the drag.

Its value is a <GdkDevice>, or #f.

It can only be set when the object is made, with #:device.

Property: drag:display self

The <GdkDisplay> that the drag belongs to.

Its value is a <GdkDisplay>, or #f.

It is read only.

Property: drag:formats self

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

Its value is a <GdkContentFormats>, or #f.

It can only be set when the object is made, with #:formats.

Property: drag:selected-action self

The currently selected action of the drag.

Its value is a <GdkDragAction> (or, to set it, a list of its symbols, or one of them).

Set it with (set! (drag:selected-action self) value).

Property: drag:surface self

The surface where the drag originates.

Its value is a <GdkSurface>, or #f.

It can only be set when the object is made, with #:surface.

Procedures

Procedure: drag:begin surface device content actions dx dy ⇒ %return

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 drag:get-drag-surface.

This function returns a reference to the <GdkDrag> object, but GTK keeps its own reference as well, as long as the DND operation is going on.

Note: if actions include move, you need to listen for the drag:dnd-finished signal and delete the data at the source if drag:get-selected-action returns move.

surface

Passed: a <GdkSurface>.

the source surface for this drag

device

Passed: a <GdkDevice>.

the device that controls this drag

content

Passed: a <GdkContentProvider>.

the offered content

actions

Passed: a <GdkDragAction>, or a list of its symbols, or one of them.

the actions supported by this drag

dx

Passed: a real number.

the x offset to device’s position where the drag nominally started

dy

Passed: a real number.

the y offset to device’s position where the drag nominally started

%return

Returned: a <GdkDrag>, or #f.

a newly created <GdkDrag>

Method: drag:drop-done self success
Method: drop-done self success

Informs GDK that the drop ended.

Passing #f 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 self.

The <GdkDrag> will only take the first drag:drop-done call as effective, if this function is called multiple times, all subsequent calls will be ignored.

self

Passed: a <GdkDrag>.

a <GdkDrag>

success

Passed: a boolean.

whether the drag was ultimatively successful

Method: drag:get-actions self ⇒ %return
Method: get-actions self ⇒ %return

Determines the bitmask of possible actions proposed by the source.

self

Passed: a <GdkDrag>.

a <GdkDrag>

%return

Returned: a <GdkDragAction>.

the <GdkDragAction> flags

Method: drag:get-content self ⇒ %return
Method: get-content self ⇒ %return

Returns the <GdkContentProvider> associated to the <GdkDrag> object.

self

Passed: a <GdkDrag>.

a <GdkDrag>

%return

Returned: a <GdkContentProvider>.

The <GdkContentProvider> associated to self.

Method: drag:get-device self ⇒ %return
Method: get-device self ⇒ %return

Returns the <GdkDevice> associated to the <GdkDrag> object.

self

Passed: a <GdkDrag>.

a <GdkDrag>

%return

Returned: a <GdkDevice>.

The <GdkDevice> associated to self.

Method: drag:get-display self ⇒ %return
Method: get-display self ⇒ %return

Gets the <GdkDisplay> that the drag object was created for.

self

Passed: a <GdkDrag>.

a <GdkDrag>

%return

Returned: a <GdkDisplay>.

a <GdkDisplay>

Method: drag:get-drag-surface self ⇒ %return
Method: get-drag-surface self ⇒ %return

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 self and will be destroyed when the drag operation is over.

self

Passed: a <GdkDrag>.

a <GdkDrag>

%return

Returned: a <GdkSurface>, or #f.

the drag surface

Method: drag:get-formats self ⇒ %return
Method: get-formats self ⇒ %return

Retrieves the formats supported by this <GdkDrag> object.

self

Passed: a <GdkDrag>.

a <GdkDrag>

%return

Returned: a <GdkContentFormats>.

a <GdkContentFormats>

Method: drag:get-selected-action self ⇒ %return
Method: get-selected-action self ⇒ %return

Determines the action chosen by the drag destination.

self

Passed: a <GdkDrag>.

a <GdkDrag>

%return

Returned: a <GdkDragAction>.

a <GdkDragAction> value

Method: drag:get-surface self ⇒ %return
Method: get-surface self ⇒ %return

Returns the <GdkSurface> where the drag originates.

self

Passed: a <GdkDrag>.

a <GdkDrag>

%return

Returned: a <GdkSurface>.

The <GdkSurface> where the drag originates

Method: drag:set-hotspot self hot-x hot-y
Method: set-hotspot self hot-x hot-y

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.

self

Passed: a <GdkDrag>.

a <GdkDrag>

hot-x

Passed: a 32-bit integer.

x coordinate of the drag surface hotspot

hot-y

Passed: a 32-bit integer.

y coordinate of the drag surface hotspot

Signals

Signal: drag:cancel

Connect a handler with (connect object drag:cancel handler). It is called as (handler self reason).

Emitted when the drag operation is cancelled.

self

Passed: a <GdkDrag>.

reason

Passed: a <GdkDragCancelReason>.

The reason the drag was cancelled

Signal: drag:dnd-finished

Connect a handler with (connect object drag:dnd-finished handler). It is called as (handler self).

Emitted when the destination side has finished reading all data.

The drag object can now free all miscellaneous data.

self

Passed: a <GdkDrag>.

Signal: drag:drop-performed

Connect a handler with (connect object drag:drop-performed handler). It is called as (handler self).

Emitted when the drop operation is performed on an accepting client.

self

Passed: a <GdkDrag>.