]> Pileus Git - ~andy/gtk/blob - gdk/gdkdnd.h
Started
[~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   GDK_ACTION_DEFAULT = 1 << 0,
14   GDK_ACTION_COPY    = 1 << 1,
15   GDK_ACTION_MOVE    = 1 << 2,
16   GDK_ACTION_LINK    = 1 << 3,
17   GDK_ACTION_PRIVATE = 1 << 4,
18   GDK_ACTION_ASK     = 1 << 5
19 } GdkDragAction;
20
21 typedef enum {
22   GDK_DRAG_PROTO_MOTIF,
23   GDK_DRAG_PROTO_XDND,
24   GDK_DRAG_PROTO_ROOTWIN,         /* A root window with nobody claiming
25                                    * drags */
26   GDK_DRAG_PROTO_NONE,            /* Not a valid drag window */
27   GDK_DRAG_PROTO_WIN32_DROPFILES, /* The simple WM_DROPFILES dnd */
28   GDK_DRAG_PROTO_OLE2,            /* The complex OLE2 dnd (not implemented) */
29 } GdkDragProtocol;
30
31 /* Structure that holds information about a drag in progress.
32  * this is used on both source and destination sides.
33  */
34 struct _GdkDragContext {
35   GdkDragProtocol protocol;
36   
37   gboolean is_source;
38   
39   GdkWindow *source_window;
40   GdkWindow *dest_window;
41
42   GList *targets;
43   GdkDragAction actions;
44   GdkDragAction suggested_action;
45   GdkDragAction action; 
46
47   guint32 start_time;
48 };
49
50 /* Drag and Drop */
51
52 GdkDragContext * gdk_drag_context_new        (void);
53 void             gdk_drag_context_ref        (GdkDragContext *context);
54 void             gdk_drag_context_unref      (GdkDragContext *context);
55
56 /* Destination side */
57
58 void             gdk_drag_status        (GdkDragContext   *context,
59                                          GdkDragAction     action,
60                                          guint32           time);
61 void             gdk_drop_reply         (GdkDragContext   *context,
62                                          gboolean          ok,
63                                          guint32           time);
64 void             gdk_drop_finish        (GdkDragContext   *context,
65                                          gboolean          success,
66                                          guint32           time);
67 GdkAtom          gdk_drag_get_selection (GdkDragContext   *context);
68
69 /* Source side */
70
71 GdkDragContext * gdk_drag_begin      (GdkWindow      *window,
72                                       GList          *targets);
73 guint32         gdk_drag_get_protocol (guint32          xid,
74                                        GdkDragProtocol *protocol);
75 void             gdk_drag_find_window (GdkDragContext   *context,
76                                        GdkWindow       *drag_window,
77                                        gint             x_root,
78                                        gint             y_root,
79                                        GdkWindow      **dest_window,
80                                        GdkDragProtocol *protocol);
81 gboolean        gdk_drag_motion      (GdkDragContext *context,
82                                       GdkWindow      *dest_window,
83                                       GdkDragProtocol protocol,
84                                       gint            x_root, 
85                                       gint            y_root,
86                                       GdkDragAction   suggested_action,
87                                       GdkDragAction   possible_actions,
88                                       guint32         time);
89 void            gdk_drag_drop        (GdkDragContext *context,
90                                       guint32         time);
91 void            gdk_drag_abort       (GdkDragContext *context,
92                                       guint32         time);
93
94 GdkAtom       gdk_drag_get_selection (GdkDragContext *context);
95
96 #ifdef __cplusplus
97 }
98 #endif /* __cplusplus */
99
100 #endif __GDK_DND_H__