1/* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3 *
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.
8 *
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.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/*
19 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GTK+ Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23 */
24
25#ifndef __GDK_DND_H__
26#define __GDK_DND_H__
27
28#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
29#error "Only <gdk/gdk.h> can be included directly."
30#endif
31
32#include <gdk/gdktypes.h>
33#include <gdk/gdkdevice.h>
34#include <gdk/gdkevents.h>
35
36G_BEGIN_DECLS
37
38#define GDK_TYPE_DRAG_CONTEXT (gdk_drag_context_get_type ())
39#define GDK_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAG_CONTEXT, GdkDragContext))
40#define GDK_IS_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAG_CONTEXT))
41
42/**
43 * GdkDragAction:
44 * @GDK_ACTION_DEFAULT: Means nothing, and should not be used.
45 * @GDK_ACTION_COPY: Copy the data.
46 * @GDK_ACTION_MOVE: Move the data, i.e. first copy it, then delete
47 * it from the source using the DELETE target of the X selection protocol.
48 * @GDK_ACTION_LINK: Add a link to the data. Note that this is only
49 * useful if source and destination agree on what it means.
50 * @GDK_ACTION_PRIVATE: Special action which tells the source that the
51 * destination will do something that the source doesn’t understand.
52 * @GDK_ACTION_ASK: Ask the user what to do with the data.
53 *
54 * Used in #GdkDragContext to indicate what the destination
55 * should do with the dropped data.
56 */
57typedef enum
58{
59 GDK_ACTION_DEFAULT = 1 << 0,
60 GDK_ACTION_COPY = 1 << 1,
61 GDK_ACTION_MOVE = 1 << 2,
62 GDK_ACTION_LINK = 1 << 3,
63 GDK_ACTION_PRIVATE = 1 << 4,
64 GDK_ACTION_ASK = 1 << 5
65} GdkDragAction;
66
67/**
68 * GdkDragCancelReason:
69 * @GDK_DRAG_CANCEL_NO_TARGET: There is no suitable drop target.
70 * @GDK_DRAG_CANCEL_USER_CANCELLED: Drag cancelled by the user
71 * @GDK_DRAG_CANCEL_ERROR: Unspecified error.
72 *
73 * Used in #GdkDragContext to the reason of a cancelled DND operation.
74 *
75 * Since: 3.20
76 */
77typedef enum {
78 GDK_DRAG_CANCEL_NO_TARGET,
79 GDK_DRAG_CANCEL_USER_CANCELLED,
80 GDK_DRAG_CANCEL_ERROR
81} GdkDragCancelReason;
82
83/**
84 * GdkDragProtocol:
85 * @GDK_DRAG_PROTO_NONE: no protocol.
86 * @GDK_DRAG_PROTO_MOTIF: The Motif DND protocol. No longer supported
87 * @GDK_DRAG_PROTO_XDND: The Xdnd protocol.
88 * @GDK_DRAG_PROTO_ROOTWIN: An extension to the Xdnd protocol for
89 * unclaimed root window drops.
90 * @GDK_DRAG_PROTO_WIN32_DROPFILES: The simple WM_DROPFILES protocol.
91 * @GDK_DRAG_PROTO_OLE2: The complex OLE2 DND protocol (not implemented).
92 * @GDK_DRAG_PROTO_LOCAL: Intra-application DND.
93 * @GDK_DRAG_PROTO_WAYLAND: Wayland DND protocol.
94 *
95 * Used in #GdkDragContext to indicate the protocol according to
96 * which DND is done.
97 */
98typedef enum
99{
100 GDK_DRAG_PROTO_NONE = 0,
101 GDK_DRAG_PROTO_MOTIF,
102 GDK_DRAG_PROTO_XDND,
103 GDK_DRAG_PROTO_ROOTWIN,
104 GDK_DRAG_PROTO_WIN32_DROPFILES,
105 GDK_DRAG_PROTO_OLE2,
106 GDK_DRAG_PROTO_LOCAL,
107 GDK_DRAG_PROTO_WAYLAND
108} GdkDragProtocol;
109
110
111GDK_AVAILABLE_IN_ALL
112GType gdk_drag_context_get_type (void) G_GNUC_CONST;
113
114GDK_AVAILABLE_IN_ALL
115void gdk_drag_context_set_device (GdkDragContext *context,
116 GdkDevice *device);
117GDK_AVAILABLE_IN_ALL
118GdkDevice * gdk_drag_context_get_device (GdkDragContext *context);
119
120GDK_AVAILABLE_IN_ALL
121GList *gdk_drag_context_list_targets (GdkDragContext *context);
122GDK_AVAILABLE_IN_ALL
123GdkDragAction gdk_drag_context_get_actions (GdkDragContext *context);
124GDK_AVAILABLE_IN_ALL
125GdkDragAction gdk_drag_context_get_suggested_action (GdkDragContext *context);
126GDK_AVAILABLE_IN_ALL
127GdkDragAction gdk_drag_context_get_selected_action (GdkDragContext *context);
128
129GDK_AVAILABLE_IN_ALL
130GdkWindow *gdk_drag_context_get_source_window (GdkDragContext *context);
131GDK_AVAILABLE_IN_ALL
132GdkWindow *gdk_drag_context_get_dest_window (GdkDragContext *context);
133GDK_AVAILABLE_IN_ALL
134GdkDragProtocol gdk_drag_context_get_protocol (GdkDragContext *context);
135
136/* Destination side */
137
138GDK_AVAILABLE_IN_ALL
139void gdk_drag_status (GdkDragContext *context,
140 GdkDragAction action,
141 guint32 time_);
142GDK_AVAILABLE_IN_ALL
143void gdk_drop_reply (GdkDragContext *context,
144 gboolean accepted,
145 guint32 time_);
146GDK_AVAILABLE_IN_ALL
147void gdk_drop_finish (GdkDragContext *context,
148 gboolean success,
149 guint32 time_);
150GDK_AVAILABLE_IN_ALL
151GdkAtom gdk_drag_get_selection (GdkDragContext *context);
152
153/* Source side */
154
155GDK_AVAILABLE_IN_ALL
156GdkDragContext * gdk_drag_begin (GdkWindow *window,
157 GList *targets);
158
159GDK_AVAILABLE_IN_ALL
160GdkDragContext * gdk_drag_begin_for_device (GdkWindow *window,
161 GdkDevice *device,
162 GList *targets);
163GDK_AVAILABLE_IN_3_20
164GdkDragContext * gdk_drag_begin_from_point (GdkWindow *window,
165 GdkDevice *device,
166 GList *targets,
167 gint x_root,
168 gint y_root);
169
170GDK_AVAILABLE_IN_ALL
171void gdk_drag_find_window_for_screen (GdkDragContext *context,
172 GdkWindow *drag_window,
173 GdkScreen *screen,
174 gint x_root,
175 gint y_root,
176 GdkWindow **dest_window,
177 GdkDragProtocol *protocol);
178
179GDK_AVAILABLE_IN_ALL
180gboolean gdk_drag_motion (GdkDragContext *context,
181 GdkWindow *dest_window,
182 GdkDragProtocol protocol,
183 gint x_root,
184 gint y_root,
185 GdkDragAction suggested_action,
186 GdkDragAction possible_actions,
187 guint32 time_);
188GDK_AVAILABLE_IN_ALL
189void gdk_drag_drop (GdkDragContext *context,
190 guint32 time_);
191GDK_AVAILABLE_IN_ALL
192void gdk_drag_abort (GdkDragContext *context,
193 guint32 time_);
194GDK_AVAILABLE_IN_ALL
195gboolean gdk_drag_drop_succeeded (GdkDragContext *context);
196
197GDK_AVAILABLE_IN_3_20
198void gdk_drag_drop_done (GdkDragContext *context,
199 gboolean success);
200
201GDK_AVAILABLE_IN_3_20
202GdkWindow *gdk_drag_context_get_drag_window (GdkDragContext *context);
203
204GDK_AVAILABLE_IN_3_20
205void gdk_drag_context_set_hotspot (GdkDragContext *context,
206 gint hot_x,
207 gint hot_y);
208
209GDK_AVAILABLE_IN_3_20
210gboolean gdk_drag_context_manage_dnd (GdkDragContext *context,
211 GdkWindow *ipc_window,
212 GdkDragAction actions);
213G_END_DECLS
214
215#endif /* __GDK_DND_H__ */
216