]> Pileus Git - ~andy/gtk/blob - gdk/gdkdnd.h
*** empty log message ***
[~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 /* Structure that holds information about a drag in progress.
35  * this is used on both source and destination sides.
36  */
37 struct _GdkDragContext {
38   GdkDragProtocol protocol;
39   
40   gboolean is_source;
41   
42   GdkWindow *source_window;
43   GdkWindow *dest_window;
44
45   GList *targets;
46   GdkDragAction actions;
47   GdkDragAction suggested_action;
48   GdkDragAction action; 
49
50   guint32 start_time;
51 };
52
53 /* Drag and Drop */
54
55 GdkDragContext * gdk_drag_context_new        (void);
56 void             gdk_drag_context_ref        (GdkDragContext *context);
57 void             gdk_drag_context_unref      (GdkDragContext *context);
58
59 /* Destination side */
60
61 void             gdk_drag_status        (GdkDragContext   *context,
62                                          GdkDragAction     action,
63                                          guint32           time);
64 void             gdk_drop_reply         (GdkDragContext   *context,
65                                          gboolean          ok,
66                                          guint32           time);
67 void             gdk_drop_finish        (GdkDragContext   *context,
68                                          gboolean          success,
69                                          guint32           time);
70 GdkAtom          gdk_drag_get_selection (GdkDragContext   *context);
71
72 /* Source side */
73
74 GdkDragContext * gdk_drag_begin      (GdkWindow      *window,
75                                       GList          *targets);
76 guint32         gdk_drag_get_protocol (guint32          xid,
77                                        GdkDragProtocol *protocol);
78 void             gdk_drag_find_window (GdkDragContext   *context,
79                                        GdkWindow       *drag_window,
80                                        gint             x_root,
81                                        gint             y_root,
82                                        GdkWindow      **dest_window,
83                                        GdkDragProtocol *protocol);
84 gboolean        gdk_drag_motion      (GdkDragContext *context,
85                                       GdkWindow      *dest_window,
86                                       GdkDragProtocol protocol,
87                                       gint            x_root, 
88                                       gint            y_root,
89                                       GdkDragAction   suggested_action,
90                                       GdkDragAction   possible_actions,
91                                       guint32         time);
92 void            gdk_drag_drop        (GdkDragContext *context,
93                                       guint32         time);
94 void            gdk_drag_abort       (GdkDragContext *context,
95                                       guint32         time);
96
97 #ifdef __cplusplus
98 }
99 #endif /* __cplusplus */
100
101 #endif /* __GDK_DND_H__ */