]> Pileus Git - ~andy/gtk/blob - gdk/quartz/gdkdnd-quartz.c
quartz: fix up GdkDragContext conversion
[~andy/gtk] / gdk / quartz / gdkdnd-quartz.c
1 /* gdkdnd-quartz.c
2  *
3  * Copyright (C) 2005 Imendio AB
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #include "gdkdnd.h"
22 #include "gdkdnd-quartz.h"
23 #include "gdkprivate-quartz.h"
24
25 G_DEFINE_TYPE (GdkQuartzDragContext, gdk_quartz_drag_context, GDK_TYPE_DRAG_CONTEXT)
26
27
28 GdkDragContext *_gdk_quartz_drag_source_context = NULL;
29
30 GdkDragContext *
31 gdk_quartz_drag_source_context ()
32 {
33   return _gdk_quartz_drag_source_context;
34 }
35
36 GdkDragContext *
37 _gdk_quartz_window_drag_begin (GdkWindow *window,
38                                GdkDevice *device,
39                                GList     *targets)
40 {
41   GdkDragContext *context;
42
43   g_assert (_gdk_quartz_drag_source_context == NULL);
44
45   /* Create fake context */
46   _gdk_quartz_drag_source_context = g_object_new (GDK_TYPE_QUARTZ_DRAG_CONTEXT,
47                                                   NULL);
48   _gdk_quartz_drag_source_context->is_source = TRUE;
49
50   gdk_drag_context_set_device (context, device);
51
52   return context;
53 }
54
55 static gboolean
56 gdk_quartz_drag_context_drag_motion (GdkDragContext  *context,
57                                      GdkWindow       *dest_window,
58                                      GdkDragProtocol  protocol,
59                                      gint             x_root,
60                                      gint             y_root,
61                                      GdkDragAction    suggested_action,
62                                      GdkDragAction    possible_actions,
63                                      guint32          time)
64 {
65   /* FIXME: Implement */
66   return FALSE;
67 }
68
69 GdkNativeWindow
70 _gdk_quartz_display_get_drag_get_protocol (GdkDisplay      *display,
71                                            GdkNativeWindow *xid,
72                                            GdkDragProtocol *protocol,
73                                            guint            version)
74 {
75   /* FIXME: Implement */
76   return 0;
77 }
78
79 static GdkWindow *
80 gdk_quartz_drag_context_find_window (GdkDragContext  *context,
81                                      GdkWindow       *drag_window,
82                                      GdkScreen       *screen,
83                                      gint             x_root,
84                                      gint             y_root,
85                                      GdkDragProtocol *protocol)
86 {
87   /* FIXME: Implement */
88   return NULL;
89 }
90
91 static void
92 gdk_quartz_drag_context_drag_drop (GdkDragContext *context,
93                                    guint32         time)
94 {
95   /* FIXME: Implement */
96 }
97
98 static void
99 gdk_quartz_drag_context_drag_abort (GdkDragContext *context,
100                                     guint32         time)
101 {
102   /* FIXME: Implement */
103 }
104
105 static void
106 gdk_quartz_drag_context_drag_status (GdkDragContext *context,
107                                      GdkDragAction   action,
108                                      guint32         time)
109 {
110   context->action = action;
111 }
112
113 static void
114 gdk_quartz_drag_context_drop_reply (GdkDragContext *context,
115                                     gboolean        ok,
116                                     guint32         time)
117 {
118   /* FIXME: Implement */
119 }
120
121 static void
122 gdk_quartz_drag_context_drop_finish (GdkDragContext *context,
123                                      gboolean        success,
124                                      guint32         time)
125 {
126   /* FIXME: Implement */
127 }
128
129 void
130 _gdk_quartz_window_register_dnd (GdkWindow *window)
131 {
132   /* FIXME: Implement */
133 }
134
135 static GdkAtom
136 gdk_quartz_drag_context_get_selection (GdkDragContext *context)
137 {
138   /* FIXME: Implement */
139   return GDK_NONE;
140 }
141
142 static gboolean
143 gdk_quartz_drag_context_drop_status (GdkDragContext *context)
144 {
145   /* FIXME: Implement */
146   return FALSE;
147 }
148
149 id
150 gdk_quartz_drag_context_get_dragging_info_libgtk_only (GdkDragContext *context)
151 {
152   return GDK_QUARTZ_DRAG_CONTEXT (context)->dragging_info;
153 }
154
155 static void
156 gdk_quartz_drag_context_init (GdkQuartzDragContext *context)
157 {
158 }
159
160 static void
161 gdk_quartz_drag_context_finalize (GObject *object)
162 {
163   G_OBJECT_CLASS (gdk_quartz_drag_context_parent_class)->finalize (object);
164 }
165
166 static void
167 gdk_drag_context_class_init (GdkDragContextClass *klass)
168 {
169   GObjectClass *object_class = G_OBJECT_CLASS (klass);
170   GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
171
172   object_class->finalize = gdk_quartz_drag_context_finalize;
173
174   context_class->find_window = gdk_quartz_drag_context_find_window;
175   context_class->drag_status = gdk_quartz_drag_context_drag_status;
176   context_class->drag_motion = gdk_quartz_drag_context_drag_motion;
177   context_class->drag_abort = gdk_quartz_drag_context_drag_abort;
178   context_class->drag_drop = gdk_quartz_drag_context_drag_drop;
179   context_class->drop_reply = gdk_quartz_drag_context_drop_reply;
180   context_class->drop_finish = gdk_quartz_drag_context_drop_finish;
181   context_class->drop_status = gdk_quartz_drag_context_drop_status;
182   context_class->get_selection = gdk_quartz_drag_context_get_selection;
183 }