1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1999 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
29 #include <gdkdrawable.h>
30 #include <gdkdisplay.h>
35 * @title: Drag And Drop
36 * @short_description: Functions for controlling drag and drop handling
38 * These functions provide a low level interface for drag and drop.
39 * The X backend of GDK supports both the Xdnd and Motif drag and drop
40 * protocols transparently, the Win32 backend supports the WM_DROPFILES
43 * GTK+ provides a higher level abstraction based on top of these functions,
44 * and so they are not normally needed in GTK+ applications.
45 * See the <link linkend="gtk-Drag-and-Drop">Drag and Drop</link> section of
46 * the GTK+ documentation for more information.
50 * gdk_drag_find_window:
51 * @context: a #GdkDragContext.
52 * @drag_window: a window which may be at the pointer position, but
53 * should be ignored, since it is put up by the drag source as an icon.
54 * @x_root: the x position of the pointer in root coordinates.
55 * @y_root: the y position of the pointer in root coordinates.
56 * @dest_window: (out): location to store the destination window in.
57 * @protocol: (out): location to store the DND protocol in.
59 * Finds the destination window and DND protocol to use at the
60 * given pointer position.
62 * This function is called by the drag source to obtain the
63 * @dest_window and @protocol parameters for gdk_drag_motion().
66 gdk_drag_find_window (GdkDragContext *context,
67 GdkWindow *drag_window,
70 GdkWindow **dest_window,
71 GdkDragProtocol *protocol)
73 gdk_drag_find_window_for_screen (context, drag_window,
74 gdk_drawable_get_screen (context->source_window),
75 x_root, y_root, dest_window, protocol);
79 * gdk_drag_get_protocol:
80 * @xid: the windowing system id of the destination window.
81 * @protocol: location where the supported DND protocol is returned.
83 * Finds out the DND protocol supported by a window.
85 * Return value: the windowing system specific id for the window where
86 * the drop should happen. This may be @xid or the id of a proxy
87 * window, or zero if @xid doesn't support Drag and Drop.
90 gdk_drag_get_protocol (GdkNativeWindow xid,
91 GdkDragProtocol *protocol)
93 return gdk_drag_get_protocol_for_display (gdk_display_get_default (), xid, protocol);
97 * gdk_drag_context_list_targets:
98 * @context: a #GdkDragContext
100 * Retrieves the list of targets of the context.
102 * Return value: a #GList of targets
107 gdk_drag_context_list_targets (GdkDragContext *context)
109 g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
111 return context->targets;
115 * gdk_drag_context_get_actions:
116 * @context: a #GdkDragContext
118 * Determines the bitmask of actions proposed by the source if
119 * gdk_drag_context_suggested_action() returns GDK_ACTION_ASK.
121 * Return value: the #GdkDragAction flags
126 gdk_drag_context_get_actions (GdkDragContext *context)
128 g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), GDK_ACTION_DEFAULT);
130 return context->actions;
134 * gdk_drag_context_get_suggested_action:
135 * @context: a #GdkDragContext
137 * Determines the suggested drag action of the context.
139 * Return value: a #GdkDragAction value
144 gdk_drag_context_get_suggested_action (GdkDragContext *context)
146 g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), 0);
148 return context->suggested_action;
152 * gdk_drag_context_get_selected_action:
153 * @context: a #GdkDragContext
155 * Determines the action chosen by the drag destination.
157 * Return value: a #GdkDragAction value
162 gdk_drag_context_get_selected_action (GdkDragContext *context)
164 g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), 0);
166 return context->action;
170 * gdk_drag_context_get_source_window:
171 * @context: a #GdkDragContext
173 * Returns the #GdkWindow where the DND operation started.
175 * Return value: (transfer none): a #GdkWindow
180 gdk_drag_context_get_source_window (GdkDragContext *context)
182 g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
184 return context->source_window;