]> Pileus Git - ~andy/gtk/blob - gdk/gdkdnd.h
Really fix the initialization of the target list.
[~andy/gtk] / gdk / gdkdnd.h
1 #ifndef __GDK_DND_H__
2 #define __GDK_DND_H__
3
4 #include <gdk/gdktypes.h>
5
6 #ifdef __cplusplus
7 extern "C" {
8 #endif /* __cplusplus */
9
10 typedef struct _GdkDragContext        GdkDragContext;
11
12 typedef enum
13 {
14   GDK_ACTION_DEFAULT = 1 << 0,
15   GDK_ACTION_COPY    = 1 << 1,
16   GDK_ACTION_MOVE    = 1 << 2,
17   GDK_ACTION_LINK    = 1 << 3,
18   GDK_ACTION_PRIVATE = 1 << 4,
19   GDK_ACTION_ASK     = 1 << 5
20 } GdkDragAction;
21
22 typedef enum
23 {
24   GDK_DRAG_PROTO_MOTIF,
25   GDK_DRAG_PROTO_XDND,
26   GDK_DRAG_PROTO_ROOTWIN,         /* A root window with nobody claiming
27                                    * drags */
28   GDK_DRAG_PROTO_NONE,            /* Not a valid drag window */
29   GDK_DRAG_PROTO_WIN32_DROPFILES, /* The simple WM_DROPFILES dnd */
30   GDK_DRAG_PROTO_OLE2,            /* The complex OLE2 dnd (not implemented) */
31   GDK_DRAG_PROTO_LOCAL            /* Intra-app */
32 } GdkDragProtocol;
33
34 /* Object that holds information about a drag in progress.
35  * this is used on both source and destination sides.
36  */
37
38 typedef struct _GdkDragContextClass GdkDragContextClass;
39
40 #define GDK_TYPE_DRAG_CONTEXT              (gdk_drag_context_get_type ())
41 #define GDK_DRAG_CONTEXT(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAG_CONTEXT, GdkDragContext))
42 #define GDK_DRAG_CONTEXT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
43 #define GDK_IS_DRAG_CONTEXT(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAG_CONTEXT))
44 #define GDK_IS_DRAG_CONTEXT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAG_CONTEXT))
45 #define GDK_DRAG_CONTEXT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
46
47 struct _GdkDragContext {
48   GObject parent_instance;
49
50   /*< public >*/
51   
52   GdkDragProtocol protocol;
53   
54   gboolean is_source;
55   
56   GdkWindow *source_window;
57   GdkWindow *dest_window;
58
59   GList *targets;
60   GdkDragAction actions;
61   GdkDragAction suggested_action;
62   GdkDragAction action; 
63
64   guint32 start_time;
65
66   /*< private >*/
67   
68   gpointer windowing_data;
69 };
70
71 struct _GdkDragContextClass {
72   GObjectClass parent_class;
73
74   
75 };
76
77 /* Drag and Drop */
78
79 GType            gdk_drag_context_get_type   (void) G_GNUC_CONST;
80 GdkDragContext * gdk_drag_context_new        (void);
81
82 #ifndef GDK_DISABLE_DEPRECATED
83 void             gdk_drag_context_ref        (GdkDragContext *context);
84 void             gdk_drag_context_unref      (GdkDragContext *context);
85 #endif
86
87 /* Destination side */
88
89 void             gdk_drag_status        (GdkDragContext   *context,
90                                          GdkDragAction     action,
91                                          guint32           time_);
92 void             gdk_drop_reply         (GdkDragContext   *context,
93                                          gboolean          ok,
94                                          guint32           time_);
95 void             gdk_drop_finish        (GdkDragContext   *context,
96                                          gboolean          success,
97                                          guint32           time_);
98 GdkAtom          gdk_drag_get_selection (GdkDragContext   *context);
99
100 /* Source side */
101
102 GdkDragContext * gdk_drag_begin      (GdkWindow      *window,
103                                       GList          *targets);
104
105 guint32 gdk_drag_get_protocol_for_display (GdkDisplay       *display,
106                                            guint32           xid,
107                                            GdkDragProtocol  *protocol);
108 void    gdk_drag_find_window_for_screen   (GdkDragContext   *context,
109                                            GdkWindow        *drag_window,
110                                            GdkScreen        *screen,
111                                            gint              x_root,
112                                            gint              y_root,
113                                            GdkWindow       **dest_window,
114                                            GdkDragProtocol  *protocol);
115
116 #ifndef GDK_MULTIHEAD_SAFE
117 guint32 gdk_drag_get_protocol (guint32           xid,
118                                GdkDragProtocol  *protocol);
119 void    gdk_drag_find_window  (GdkDragContext   *context,
120                                GdkWindow        *drag_window,
121                                gint              x_root,
122                                gint              y_root,
123                                GdkWindow       **dest_window,
124                                GdkDragProtocol  *protocol);
125 #endif /* GDK_MULTIHEAD_SAFE */
126
127 gboolean        gdk_drag_motion      (GdkDragContext *context,
128                                       GdkWindow      *dest_window,
129                                       GdkDragProtocol protocol,
130                                       gint            x_root, 
131                                       gint            y_root,
132                                       GdkDragAction   suggested_action,
133                                       GdkDragAction   possible_actions,
134                                       guint32         time_);
135 void            gdk_drag_drop        (GdkDragContext *context,
136                                       guint32         time_);
137 void            gdk_drag_abort       (GdkDragContext *context,
138                                       guint32         time_);
139 gboolean        gdk_drag_drop_succeeded (GdkDragContext *context);
140
141 #ifdef __cplusplus
142 }
143 #endif /* __cplusplus */
144
145 #endif /* __GDK_DND_H__ */