1/* GDK - The GIMP Drawing Kit
2 * Copyright (C) 2010, Red Hat, Inc
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, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __GDK_DND_PRIVATE_H__
19#define __GDK_DND_PRIVATE_H__
20
21#include "gdkdnd.h"
22
23G_BEGIN_DECLS
24
25
26#define GDK_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
27#define GDK_IS_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAG_CONTEXT))
28#define GDK_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
29
30typedef struct _GdkDragContextClass GdkDragContextClass;
31
32
33struct _GdkDragContextClass {
34 GObjectClass parent_class;
35
36 GdkWindow * (*find_window) (GdkDragContext *context,
37 GdkWindow *drag_window,
38 GdkScreen *screen,
39 gint x_root,
40 gint y_root,
41 GdkDragProtocol *protocol);
42 GdkAtom (*get_selection) (GdkDragContext *context);
43 gboolean (*drag_motion) (GdkDragContext *context,
44 GdkWindow *dest_window,
45 GdkDragProtocol protocol,
46 gint root_x,
47 gint root_y,
48 GdkDragAction suggested_action,
49 GdkDragAction possible_actions,
50 guint32 time_);
51 void (*drag_status) (GdkDragContext *context,
52 GdkDragAction action,
53 guint32 time_);
54 void (*drag_abort) (GdkDragContext *context,
55 guint32 time_);
56 void (*drag_drop) (GdkDragContext *context,
57 guint32 time_);
58 void (*drop_reply) (GdkDragContext *context,
59 gboolean accept,
60 guint32 time_);
61 void (*drop_finish) (GdkDragContext *context,
62 gboolean success,
63 guint32 time_);
64 gboolean (*drop_status) (GdkDragContext *context);
65 GdkWindow* (*get_drag_window) (GdkDragContext *context);
66 void (*set_hotspot) (GdkDragContext *context,
67 gint hot_x,
68 gint hot_y);
69 void (*drop_done) (GdkDragContext *context,
70 gboolean success);
71
72 gboolean (*manage_dnd) (GdkDragContext *context,
73 GdkWindow *ipc_window,
74 GdkDragAction actions);
75 void (*set_cursor) (GdkDragContext *context,
76 GdkCursor *cursor);
77 void (*cancel) (GdkDragContext *context,
78 GdkDragCancelReason reason);
79 void (*drop_performed) (GdkDragContext *context,
80 guint32 time);
81 void (*dnd_finished) (GdkDragContext *context);
82
83 gboolean (*handle_event) (GdkDragContext *context,
84 const GdkEvent *event);
85 void (*action_changed) (GdkDragContext *context,
86 GdkDragAction action);
87
88 void (*commit_drag_status) (GdkDragContext *context);
89};
90
91struct _GdkDragContext {
92 GObject parent_instance;
93
94 /*< private >*/
95 GdkDragProtocol protocol;
96
97 GdkDisplay *display;
98
99 gboolean is_source;
100 GdkWindow *source_window;
101 GdkWindow *dest_window;
102 GdkWindow *drag_window;
103
104 GList *targets;
105 GdkDragAction actions;
106 GdkDragAction suggested_action;
107 GdkDragAction action;
108
109 guint32 start_time;
110
111 GdkDevice *device;
112
113 guint drop_done : 1; /* Whether gdk_drag_drop_done() was performed */
114};
115
116GList * gdk_drag_context_list (void);
117
118void gdk_drag_context_set_cursor (GdkDragContext *context,
119 GdkCursor *cursor);
120void gdk_drag_context_cancel (GdkDragContext *context,
121 GdkDragCancelReason reason);
122gboolean gdk_drag_context_handle_source_event (GdkEvent *event);
123gboolean gdk_drag_context_handle_dest_event (GdkEvent *event);
124GdkCursor * gdk_drag_get_cursor (GdkDragContext *context,
125 GdkDragAction action);
126
127G_END_DECLS
128
129#endif
130