]> Pileus Git - ~andy/gtk/blob - gdk/gdkdnd.h
[docs] Added some missing documentation to GdkDnd
[~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 typedef struct _GdkDragContext        GdkDragContext;
40
41 /**
42  * GdkDragAction:
43  * @GDK_ACTION_DEFAULT: Means nothing, and should not be used.
44  * @GDK_ACTION_COPY: Copy the data.
45  * @GDK_ACTION_MOVE: Move the data, i.e. first copy it, then delete
46  *  it from the source using the DELETE target of the X selection protocol.
47  * @GDK_ACTION_LINK: Add a link to the data. Note that this is only
48  *  useful if source and destination agree on what it means.
49  * @GDK_ACTION_PRIVATE: Special action which tells the source that the
50  *  destination will do something that the source doesn't understand.
51  * @GDK_ACTION_ASK: Ask the user what to do with the data.
52  *
53  * Used in #GdkDragContext to indicate what the destination
54  * should do with the dropped data.
55  */
56 typedef enum
57 {
58   GDK_ACTION_DEFAULT = 1 << 0,
59   GDK_ACTION_COPY    = 1 << 1,
60   GDK_ACTION_MOVE    = 1 << 2,
61   GDK_ACTION_LINK    = 1 << 3,
62   GDK_ACTION_PRIVATE = 1 << 4,
63   GDK_ACTION_ASK     = 1 << 5
64 } GdkDragAction;
65
66 /**
67  * GdkDragProtocol:
68  * @GDK_DRAG_PROTO_MOTIF: The Motif DND protocol.
69  * @GDK_DRAG_PROTO_XDND: The Xdnd protocol.
70  * @GDK_DRAG_PROTO_ROOTWIN: An extension to the Xdnd protocol for
71  *  unclaimed root window drops.
72  * @GDK_DRAG_PROTO_NONE: no protocol.
73  * @GDK_DRAG_PROTO_WIN32_DROPFILES: The simple WM_DROPFILES protocol.
74  * @GDK_DRAG_PROTO_OLE2: The complex OLE2 DND protocol (not implemented).
75  * @GDK_DRAG_PROTO_LOCAL: Intra-application DND.
76  *
77  * Used in #GdkDragContext to indicate the protocol according to
78  * which DND is done.
79  */
80 typedef enum
81 {
82   GDK_DRAG_PROTO_MOTIF,
83   GDK_DRAG_PROTO_XDND,
84   GDK_DRAG_PROTO_ROOTWIN,         /* A root window with nobody claiming
85                                    * drags */
86   GDK_DRAG_PROTO_NONE,            /* Not a valid drag window */
87   GDK_DRAG_PROTO_WIN32_DROPFILES, /* The simple WM_DROPFILES dnd */
88   GDK_DRAG_PROTO_OLE2,            /* The complex OLE2 dnd (not implemented) */
89   GDK_DRAG_PROTO_LOCAL            /* Intra-app */
90 } GdkDragProtocol;
91
92 /* Object that holds information about a drag in progress.
93  * this is used on both source and destination sides.
94  */
95
96 typedef struct _GdkDragContextClass GdkDragContextClass;
97
98 #define GDK_TYPE_DRAG_CONTEXT              (gdk_drag_context_get_type ())
99 #define GDK_DRAG_CONTEXT(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAG_CONTEXT, GdkDragContext))
100 #define GDK_DRAG_CONTEXT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
101 #define GDK_IS_DRAG_CONTEXT(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAG_CONTEXT))
102 #define GDK_IS_DRAG_CONTEXT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAG_CONTEXT))
103 #define GDK_DRAG_CONTEXT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
104
105 struct _GdkDragContext {
106   GObject parent_instance;
107
108   /*< public >*/
109   
110   GdkDragProtocol GSEAL (protocol);
111
112   gboolean GSEAL (is_source);
113   
114   GdkWindow *GSEAL (source_window);
115   GdkWindow *GSEAL (dest_window);
116
117   GList *GSEAL (targets);
118   GdkDragAction GSEAL (actions);
119   GdkDragAction GSEAL (suggested_action);
120   GdkDragAction GSEAL (action);
121
122   guint32 GSEAL (start_time);
123
124   /*< private >*/
125   
126   gpointer GSEAL (windowing_data);
127 };
128
129 struct _GdkDragContextClass {
130   GObjectClass parent_class;
131
132 };
133
134 /* Drag and Drop */
135
136 GType            gdk_drag_context_get_type   (void) G_GNUC_CONST;
137 GdkDragContext * gdk_drag_context_new        (void);
138
139 void             gdk_drag_context_set_device           (GdkDragContext *context,
140                                                         GdkDevice      *device);
141 GdkDevice *      gdk_drag_context_get_device           (GdkDragContext *context);
142
143 GList           *gdk_drag_context_list_targets         (GdkDragContext *context);
144 GdkDragAction    gdk_drag_context_get_actions          (GdkDragContext *context);
145 GdkDragAction    gdk_drag_context_get_suggested_action (GdkDragContext *context);
146 GdkDragAction    gdk_drag_context_get_selected_action  (GdkDragContext *context);
147
148 /* Destination side */
149
150 void             gdk_drag_status        (GdkDragContext   *context,
151                                          GdkDragAction     action,
152                                          guint32           time_);
153 void             gdk_drop_reply         (GdkDragContext   *context,
154                                          gboolean          ok,
155                                          guint32           time_);
156 void             gdk_drop_finish        (GdkDragContext   *context,
157                                          gboolean          success,
158                                          guint32           time_);
159 GdkAtom          gdk_drag_get_selection (GdkDragContext   *context);
160
161 /* Source side */
162
163 GdkDragContext * gdk_drag_begin      (GdkWindow      *window,
164                                       GList          *targets);
165
166 GdkNativeWindow gdk_drag_get_protocol_for_display (GdkDisplay       *display,
167                                                    GdkNativeWindow   xid,
168                                                    GdkDragProtocol  *protocol);
169
170 void    gdk_drag_find_window_for_screen   (GdkDragContext   *context,
171                                            GdkWindow        *drag_window,
172                                            GdkScreen        *screen,
173                                            gint              x_root,
174                                            gint              y_root,
175                                            GdkWindow       **dest_window,
176                                            GdkDragProtocol  *protocol);
177
178 #ifndef GDK_MULTIHEAD_SAFE
179 GdkNativeWindow gdk_drag_get_protocol (GdkNativeWindow   xid,
180                                        GdkDragProtocol  *protocol);
181
182 void    gdk_drag_find_window  (GdkDragContext   *context,
183                                GdkWindow        *drag_window,
184                                gint              x_root,
185                                gint              y_root,
186                                GdkWindow       **dest_window,
187                                GdkDragProtocol  *protocol);
188 #endif /* GDK_MULTIHEAD_SAFE */
189
190 gboolean        gdk_drag_motion      (GdkDragContext *context,
191                                       GdkWindow      *dest_window,
192                                       GdkDragProtocol protocol,
193                                       gint            x_root, 
194                                       gint            y_root,
195                                       GdkDragAction   suggested_action,
196                                       GdkDragAction   possible_actions,
197                                       guint32         time_);
198 void            gdk_drag_drop        (GdkDragContext *context,
199                                       guint32         time_);
200 void            gdk_drag_abort       (GdkDragContext *context,
201                                       guint32         time_);
202 gboolean        gdk_drag_drop_succeeded (GdkDragContext *context);
203
204 G_END_DECLS
205
206 #endif /* __GDK_DND_H__ */