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