]> Pileus Git - ~andy/gtk/blob - gdk/gdkdnd.h
Merge branch 'gtk-2-90'
[~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
36 G_BEGIN_DECLS
37
38 typedef struct _GdkDragContext        GdkDragContext;
39
40 typedef enum
41 {
42   GDK_ACTION_DEFAULT = 1 << 0,
43   GDK_ACTION_COPY    = 1 << 1,
44   GDK_ACTION_MOVE    = 1 << 2,
45   GDK_ACTION_LINK    = 1 << 3,
46   GDK_ACTION_PRIVATE = 1 << 4,
47   GDK_ACTION_ASK     = 1 << 5
48 } GdkDragAction;
49
50 typedef enum
51 {
52   GDK_DRAG_PROTO_MOTIF,
53   GDK_DRAG_PROTO_XDND,
54   GDK_DRAG_PROTO_ROOTWIN,         /* A root window with nobody claiming
55                                    * drags */
56   GDK_DRAG_PROTO_NONE,            /* Not a valid drag window */
57   GDK_DRAG_PROTO_WIN32_DROPFILES, /* The simple WM_DROPFILES dnd */
58   GDK_DRAG_PROTO_OLE2,            /* The complex OLE2 dnd (not implemented) */
59   GDK_DRAG_PROTO_LOCAL            /* Intra-app */
60 } GdkDragProtocol;
61
62 /* Object that holds information about a drag in progress.
63  * this is used on both source and destination sides.
64  */
65
66 typedef struct _GdkDragContextClass GdkDragContextClass;
67
68 #define GDK_TYPE_DRAG_CONTEXT              (gdk_drag_context_get_type ())
69 #define GDK_DRAG_CONTEXT(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAG_CONTEXT, GdkDragContext))
70 #define GDK_DRAG_CONTEXT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
71 #define GDK_IS_DRAG_CONTEXT(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAG_CONTEXT))
72 #define GDK_IS_DRAG_CONTEXT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAG_CONTEXT))
73 #define GDK_DRAG_CONTEXT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
74
75 struct _GdkDragContext {
76   GObject parent_instance;
77
78   /*< public >*/
79   
80   GdkDragProtocol protocol;
81   
82   gboolean is_source;
83   
84   GdkWindow *source_window;
85   GdkWindow *dest_window;
86
87   GList *targets;
88   GdkDragAction actions;
89   GdkDragAction suggested_action;
90   GdkDragAction action; 
91
92   guint32 start_time;
93
94   /*< private >*/
95   
96   gpointer windowing_data;
97 };
98
99 struct _GdkDragContextClass {
100   GObjectClass parent_class;
101
102   
103 };
104
105 /* Drag and Drop */
106
107 GType            gdk_drag_context_get_type   (void) G_GNUC_CONST;
108 GdkDragContext * gdk_drag_context_new        (void);
109
110 /* Destination side */
111
112 void             gdk_drag_status        (GdkDragContext   *context,
113                                          GdkDragAction     action,
114                                          guint32           time_);
115 void             gdk_drop_reply         (GdkDragContext   *context,
116                                          gboolean          ok,
117                                          guint32           time_);
118 void             gdk_drop_finish        (GdkDragContext   *context,
119                                          gboolean          success,
120                                          guint32           time_);
121 GdkAtom          gdk_drag_get_selection (GdkDragContext   *context);
122
123 /* Source side */
124
125 GdkDragContext * gdk_drag_begin      (GdkWindow      *window,
126                                       GList          *targets);
127
128 GdkNativeWindow gdk_drag_get_protocol_for_display (GdkDisplay       *display,
129                                                    GdkNativeWindow   xid,
130                                                    GdkDragProtocol  *protocol);
131
132 void    gdk_drag_find_window_for_screen   (GdkDragContext   *context,
133                                            GdkWindow        *drag_window,
134                                            GdkScreen        *screen,
135                                            gint              x_root,
136                                            gint              y_root,
137                                            GdkWindow       **dest_window,
138                                            GdkDragProtocol  *protocol);
139
140 #ifndef GDK_MULTIHEAD_SAFE
141 GdkNativeWindow gdk_drag_get_protocol (GdkNativeWindow   xid,
142                                        GdkDragProtocol  *protocol);
143
144 void    gdk_drag_find_window  (GdkDragContext   *context,
145                                GdkWindow        *drag_window,
146                                gint              x_root,
147                                gint              y_root,
148                                GdkWindow       **dest_window,
149                                GdkDragProtocol  *protocol);
150 #endif /* GDK_MULTIHEAD_SAFE */
151
152 gboolean        gdk_drag_motion      (GdkDragContext *context,
153                                       GdkWindow      *dest_window,
154                                       GdkDragProtocol protocol,
155                                       gint            x_root, 
156                                       gint            y_root,
157                                       GdkDragAction   suggested_action,
158                                       GdkDragAction   possible_actions,
159                                       guint32         time_);
160 void            gdk_drag_drop        (GdkDragContext *context,
161                                       guint32         time_);
162 void            gdk_drag_abort       (GdkDragContext *context,
163                                       guint32         time_);
164 gboolean        gdk_drag_drop_succeeded (GdkDragContext *context);
165
166 G_END_DECLS
167
168 #endif /* __GDK_DND_H__ */