]> Pileus Git - ~andy/gtk/blob - gdk/gdkdnd.h
API: gdk: Make GDK_DRAG_PROTOCOL_NONE equal to 0
[~andy/gtk] / gdk / gdkdnd.h
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, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /*
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/.
25  */
26
27 #if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
28 #error "Only <gdk/gdk.h> can be included directly."
29 #endif
30
31 #ifndef __GDK_DND_H__
32 #define __GDK_DND_H__
33
34 #include <gdk/gdktypes.h>
35 #include <gdk/gdkdevice.h>
36
37 G_BEGIN_DECLS
38
39 #define GDK_TYPE_DRAG_CONTEXT              (gdk_drag_context_get_type ())
40 #define GDK_DRAG_CONTEXT(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAG_CONTEXT, GdkDragContext))
41 #define GDK_IS_DRAG_CONTEXT(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAG_CONTEXT))
42
43 /**
44  * GdkDragAction:
45  * @GDK_ACTION_DEFAULT: Means nothing, and should not be used.
46  * @GDK_ACTION_COPY: Copy the data.
47  * @GDK_ACTION_MOVE: Move the data, i.e. first copy it, then delete
48  *  it from the source using the DELETE target of the X selection protocol.
49  * @GDK_ACTION_LINK: Add a link to the data. Note that this is only
50  *  useful if source and destination agree on what it means.
51  * @GDK_ACTION_PRIVATE: Special action which tells the source that the
52  *  destination will do something that the source doesn't understand.
53  * @GDK_ACTION_ASK: Ask the user what to do with the data.
54  *
55  * Used in #GdkDragContext to indicate what the destination
56  * should do with the dropped data.
57  */
58 typedef enum
59 {
60   GDK_ACTION_DEFAULT = 1 << 0,
61   GDK_ACTION_COPY    = 1 << 1,
62   GDK_ACTION_MOVE    = 1 << 2,
63   GDK_ACTION_LINK    = 1 << 3,
64   GDK_ACTION_PRIVATE = 1 << 4,
65   GDK_ACTION_ASK     = 1 << 5
66 } GdkDragAction;
67
68 /**
69  * GdkDragProtocol:
70  * @GDK_DRAG_PROTO_NONE: no protocol.
71  * @GDK_DRAG_PROTO_MOTIF: The Motif DND protocol.
72  * @GDK_DRAG_PROTO_XDND: The Xdnd protocol.
73  * @GDK_DRAG_PROTO_ROOTWIN: An extension to the Xdnd protocol for
74  *  unclaimed root window drops.
75  * @GDK_DRAG_PROTO_WIN32_DROPFILES: The simple WM_DROPFILES protocol.
76  * @GDK_DRAG_PROTO_OLE2: The complex OLE2 DND protocol (not implemented).
77  * @GDK_DRAG_PROTO_LOCAL: Intra-application DND.
78  *
79  * Used in #GdkDragContext to indicate the protocol according to
80  * which DND is done.
81  */
82 typedef enum
83 {
84   GDK_DRAG_PROTO_NONE = 0,
85   GDK_DRAG_PROTO_MOTIF,
86   GDK_DRAG_PROTO_XDND,
87   GDK_DRAG_PROTO_ROOTWIN,
88   GDK_DRAG_PROTO_WIN32_DROPFILES,
89   GDK_DRAG_PROTO_OLE2,
90   GDK_DRAG_PROTO_LOCAL
91 } GdkDragProtocol;
92
93
94 GType            gdk_drag_context_get_type             (void) G_GNUC_CONST;
95
96 void             gdk_drag_context_set_device           (GdkDragContext *context,
97                                                         GdkDevice      *device);
98 GdkDevice *      gdk_drag_context_get_device           (GdkDragContext *context);
99
100 GList           *gdk_drag_context_list_targets         (GdkDragContext *context);
101 GdkDragAction    gdk_drag_context_get_actions          (GdkDragContext *context);
102 GdkDragAction    gdk_drag_context_get_suggested_action (GdkDragContext *context);
103 GdkDragAction    gdk_drag_context_get_selected_action  (GdkDragContext *context);
104
105 GdkWindow       *gdk_drag_context_get_source_window    (GdkDragContext *context);
106 GdkWindow       *gdk_drag_context_get_dest_window      (GdkDragContext *context);
107 GdkDragProtocol  gdk_drag_context_get_protocol         (GdkDragContext *context);
108
109 /* Destination side */
110
111 void             gdk_drag_status        (GdkDragContext   *context,
112                                          GdkDragAction     action,
113                                          guint32           time_);
114 void             gdk_drop_reply         (GdkDragContext   *context,
115                                          gboolean          accepted,
116                                          guint32           time_);
117 void             gdk_drop_finish        (GdkDragContext   *context,
118                                          gboolean          success,
119                                          guint32           time_);
120 GdkAtom          gdk_drag_get_selection (GdkDragContext   *context);
121
122 /* Source side */
123
124 GdkDragContext * gdk_drag_begin            (GdkWindow      *window,
125                                             GList          *targets);
126
127 GdkDragContext * gdk_drag_begin_for_device (GdkWindow      *window,
128                                             GdkDevice      *device,
129                                             GList          *targets);
130
131 GdkNativeWindow gdk_drag_get_protocol_for_display (GdkDisplay       *display,
132                                                    GdkNativeWindow   xid,
133                                                    GdkDragProtocol  *protocol);
134
135 void    gdk_drag_find_window_for_screen   (GdkDragContext   *context,
136                                            GdkWindow        *drag_window,
137                                            GdkScreen        *screen,
138                                            gint              x_root,
139                                            gint              y_root,
140                                            GdkWindow       **dest_window,
141                                            GdkDragProtocol  *protocol);
142
143 gboolean        gdk_drag_motion      (GdkDragContext *context,
144                                       GdkWindow      *dest_window,
145                                       GdkDragProtocol protocol,
146                                       gint            x_root,
147                                       gint            y_root,
148                                       GdkDragAction   suggested_action,
149                                       GdkDragAction   possible_actions,
150                                       guint32         time_);
151 void            gdk_drag_drop        (GdkDragContext *context,
152                                       guint32         time_);
153 void            gdk_drag_abort       (GdkDragContext *context,
154                                       guint32         time_);
155 gboolean        gdk_drag_drop_succeeded (GdkDragContext *context);
156
157 G_END_DECLS
158
159 #endif /* __GDK_DND_H__ */