Top | ![]() |
![]() |
![]() |
![]() |
GdkContentProvider * | content | Read / Write / Construct Only |
GdkDevice * | device | Read / Write / Construct Only |
GdkDisplay * | display | Read |
GdkContentFormats * | formats | Read / Write / Construct Only |
void | action-changed | Run Last |
void | cancel | Run Last |
void | dnd-finished | Run Last |
void | drop-performed | Run Last |
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.
void gdk_drag_drop_done (GdkDragContext *context
,gboolean success
);
Inform GDK if the drop ended successfully. 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
context
.
The GdkDragContext will only take the first gdk_drag_drop_done()
call as effective, if this function is called multiple times,
all subsequent calls will be ignored.
GdkDragContext * gdk_drag_begin (GdkSurface *surface
,GdkDevice *device
,GdkContentProvider *content
,GdkDragAction actions
,gint dx
,gint dy
);
Starts a drag and creates a new drag context for it.
This function is called by the drag source.
surface |
the source surface for this drag |
|
device |
the device that controls this drag |
|
content |
the offered content. |
[transfer none] |
actions |
the actions supported by this drag |
|
dx |
the x offset to |
|
dy |
the y offset to |
GdkDisplay *
gdk_drag_context_get_display (GdkDragContext *context
);
Gets the GdkDisplay that the drag context was created for.
GdkDragAction
gdk_drag_context_get_actions (GdkDragContext *context
);
Determines the bitmask of actions proposed by the source if
gdk_drag_context_get_suggested_action()
returns GDK_ACTION_ASK
.
GdkDragAction
gdk_drag_context_get_suggested_action (GdkDragContext *context
);
Determines the suggested drag action of the context.
GdkDragAction
gdk_drag_context_get_selected_action (GdkDragContext *context
);
Determines the action chosen by the drag destination.
GdkContentFormats *
gdk_drag_context_get_formats (GdkDragContext *context
);
Retrieves the formats supported by this context.
GdkDevice *
gdk_drag_context_get_device (GdkDragContext *context
);
Returns the GdkDevice associated to the drag context.
GdkSurface *
gdk_drag_context_get_drag_surface (GdkDragContext *context
);
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 context
and will be destroyed when
the drag operation is over.
void gdk_drag_context_set_hotspot (GdkDragContext *context
,gint hot_x
,gint 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.
gboolean
gdk_drag_action_is_unique (GdkDragAction action
);
Checks if action
represents a single action or if it
includes multiple flags that can be selected from.
When action
is 0 - ie no action was given, TRUE
is returned.
typedef struct _GdkDragContext GdkDragContext;
The GdkDragContext struct contains only private fields and should not be accessed directly.
Used in GdkDragContext to indicate what the destination should do with the dropped data.
“content”
property“content” GdkContentProvider *
The GdkContentProvider or NULL
if the context is not a source-side
context.
Flags: Read / Write / Construct Only
“device”
property“device” GdkDevice *
The GdkDevice that is performing the drag.
Flags: Read / Write / Construct Only
“display”
property“display” GdkDisplay *
The GdkDisplay that the drag context belongs to.
Flags: Read
“formats”
property“formats” GdkContentFormats *
The possible formats that the context can provide its data in.
Flags: Read / Write / Construct Only
“action-changed”
signalvoid user_function (GdkDragContext *context, GdkDragAction action, gpointer user_data)
A new action is being chosen for the drag and drop operation.
context |
The object on which the signal is emitted |
|
action |
The action currently chosen |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“cancel”
signalvoid user_function (GdkDragContext *context, GdkDragCancelReason reason, gpointer user_data)
The drag and drop operation was cancelled.
context |
The object on which the signal is emitted |
|
reason |
The reason the context was cancelled |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“dnd-finished”
signalvoid user_function (GdkDragContext *context, gpointer user_data)
The drag and drop operation was finished, the drag destination finished reading all data. The drag source can now free all miscellaneous data.
context |
The object on which the signal is emitted |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“drop-performed”
signalvoid user_function (GdkDragContext *context, gpointer user_data)
The drag and drop operation was performed on an accepting client.
context |
The object on which the signal is emitted |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last