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/.
31 #include "gdkdisplay.h"
32 #include "gdkwindow.h"
37 * @title: Drag And Drop
38 * @short_description: Functions for controlling drag and drop handling
40 * These functions provide a low level interface for drag and drop.
41 * The X backend of GDK supports both the Xdnd and Motif drag and drop
42 * protocols transparently, the Win32 backend supports the WM_DROPFILES
45 * GTK+ provides a higher level abstraction based on top of these functions,
46 * and so they are not normally needed in GTK+ applications.
47 * See the <link linkend="gtk-Drag-and-Drop">Drag and Drop</link> section of
48 * the GTK+ documentation for more information.
52 * gdk_drag_find_window:
53 * @context: a #GdkDragContext.
54 * @drag_window: a window which may be at the pointer position, but
55 * should be ignored, since it is put up by the drag source as an icon.
56 * @x_root: the x position of the pointer in root coordinates.
57 * @y_root: the y position of the pointer in root coordinates.
58 * @dest_window: (out): location to store the destination window in.
59 * @protocol: (out): location to store the DND protocol in.
61 * Finds the destination window and DND protocol to use at the
62 * given pointer position.
64 * This function is called by the drag source to obtain the
65 * @dest_window and @protocol parameters for gdk_drag_motion().
68 gdk_drag_find_window (GdkDragContext *context,
69 GdkWindow *drag_window,
72 GdkWindow **dest_window,
73 GdkDragProtocol *protocol)
75 gdk_drag_find_window_for_screen (context, drag_window,
76 gdk_window_get_screen (context->source_window),
77 x_root, y_root, dest_window, protocol);
81 * gdk_drag_get_protocol:
82 * @xid: the windowing system id of the destination window.
83 * @protocol: location where the supported DND protocol is returned.
85 * Finds out the DND protocol supported by a window.
87 * Return value: the windowing system specific id for the window where
88 * the drop should happen. This may be @xid or the id of a proxy
89 * window, or zero if @xid doesn't support Drag and Drop.
92 gdk_drag_get_protocol (GdkNativeWindow xid,
93 GdkDragProtocol *protocol)
95 return gdk_drag_get_protocol_for_display (gdk_display_get_default (), xid, protocol);
99 * gdk_drag_context_list_targets:
100 * @context: a #GdkDragContext
102 * Retrieves the list of targets of the context.
104 * Return value: (transfer none) (element-type GdkAtom): a #GList of targets
109 gdk_drag_context_list_targets (GdkDragContext *context)
111 g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
113 return context->targets;
117 * gdk_drag_context_get_actions:
118 * @context: a #GdkDragContext
120 * Determines the bitmask of actions proposed by the source if
121 * gdk_drag_context_suggested_action() returns GDK_ACTION_ASK.
123 * Return value: the #GdkDragAction flags
128 gdk_drag_context_get_actions (GdkDragContext *context)
130 g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), GDK_ACTION_DEFAULT);
132 return context->actions;
136 * gdk_drag_context_get_suggested_action:
137 * @context: a #GdkDragContext
139 * Determines the suggested drag action of the context.
141 * Return value: a #GdkDragAction value
146 gdk_drag_context_get_suggested_action (GdkDragContext *context)
148 g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), 0);
150 return context->suggested_action;
154 * gdk_drag_context_get_selected_action:
155 * @context: a #GdkDragContext
157 * Determines the action chosen by the drag destination.
159 * Return value: a #GdkDragAction value
164 gdk_drag_context_get_selected_action (GdkDragContext *context)
166 g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), 0);
168 return context->action;
172 * gdk_drag_context_get_source_window:
173 * @context: a #GdkDragContext
175 * Returns the #GdkWindow where the DND operation started.
177 * Return value: (transfer none): a #GdkWindow
182 gdk_drag_context_get_source_window (GdkDragContext *context)
184 g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
186 return context->source_window;