Next: , Previous: Selections, Up: Top


22 Drag and Drop

Functions for controlling drag and drop handling

22.1 Overview

These functions provide a low level interface for drag and drop. The X backend of GDK supports both the Xdnd and Motif drag and drop protocols transparently, the Win32 backend supports the WM_DROPFILES protocol.

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.

22.2 Usage

— Class: <gdk-drag-context>

Derives from <gobject>.

This class defines no direct slots.

— Function: gdk-drag-get-selection (context <gdk-drag-context>) ⇒  (ret <gdk-atom>)

Returns the selection atom for the current source window.

context
a <gdk-drag-context>.
ret
the selection atom.
— Function: gdk-drag-abort (context <gdk-drag-context>) (time_ unsigned-int32)

Aborts a drag without dropping.

This function is called by the drag source.

context
a <gdk-drag-context>.
time
the timestamp for this operation.
— Function: gdk-drop-reply (context <gdk-drag-context>) (ok bool) (time_ unsigned-int32)

Accepts or rejects a drop.

This function is called by the drag destination in response to a drop initiated by the drag source.

context
a <gdk-drag-context>.
ok
#t’ if the drop is accepted.
time
the timestamp for this operation.
— Function: gdk-drag-context-new ⇒  (ret <gdk-drag-context>)

Creates a new <gdk-drag-context>.

ret
the newly created <gdk-drag-context>.
— Function: gdk-drag-drop (context <gdk-drag-context>) (time_ unsigned-int32)

Drops on the current destination.

This function is called by the drag source.

context
a <gdk-drag-context>.
time
the timestamp for this operation.
— Function: gdk-drag-motion (context <gdk-drag-context>) (dest_window <gdk-window>) (protocol <gdk-drag-protocol>) (x_root int) (y_root int) (suggested_action <gdk-drag-action>) (possible_actions <gdk-drag-action>) (time_ unsigned-int32) ⇒  (ret bool)

Updates the drag context when the pointer moves or the set of actions changes.

This function is called by the drag source.

context
a <gdk-drag-context>.
dest-window
the new destination window, obtained by gdk-drag-find-window.
protocol
the DND protocol in use, obtained by gdk-drag-find-window.
x-root
the x position of the pointer in root coordinates.
y-root
the y position of the pointer in root coordinates.
suggested-action
the suggested action.
possible-actions
the possible actions.
time
the timestamp for this operation.
ret
FIXME
— Function: gdk-drop-finish (context <gdk-drag-context>) (success bool) (time_ unsigned-int32)

Ends the drag operation after a drop.

This function is called by the drag destination.

context
a <gtk-drag-context>.
success
#t’ if the data was successfully received.
time
the timestamp for this operation.
— Function: gdk-drag-status (context <gdk-drag-context>) (action <gdk-drag-action>) (time_ unsigned-int32)

Selects one of the actions offered by the drag source.

This function is called by the drag destination in response to gdk-drag-motion called by the drag source.

context
a <gdk-drag-context>.
action
the selected action which will be taken when a drop happens, or 0 to indicate that a drop will not be accepted.
time
the timestamp for this operation.
— Function: gdk-drag-drop-succeeded (context <gdk-drag-context>) ⇒  (ret bool)

Returns wether the dropped data has been successfully transferred. This function is intended to be used while handling a ‘GDK_DROP_FINISHED’ event, its return value is meaningless at other times.

context
a <gdk-drag-context>
ret
#t’ if the drop was successful.

Since 2.6