]> Pileus Git - ~andy/gtk/blob - gdk/quartz/gdkdnd-quartz.c
quartz: Clean up header files, use same arrangement as X11 backend
[~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 "gdkquartzdnd.h"
23 #include "gdkprivate-quartz.h"
24
25
26 G_DEFINE_TYPE (GdkQuartzDragContext, gdk_quartz_drag_context, GDK_TYPE_DRAG_CONTEXT)
27
28
29 GdkDragContext *_gdk_quartz_drag_source_context = NULL;
30
31 GdkDragContext *
32 gdk_quartz_drag_source_context ()
33 {
34   return _gdk_quartz_drag_source_context;
35 }
36
37 GdkDragContext *
38 _gdk_quartz_window_drag_begin (GdkWindow *window,
39                                GdkDevice *device,
40                                GList     *targets)
41 {
42   GdkDragContext *context;
43
44   g_assert (_gdk_quartz_drag_source_context == NULL);
45
46   /* Create fake context */
47   _gdk_quartz_drag_source_context = g_object_new (GDK_TYPE_QUARTZ_DRAG_CONTEXT,
48                                                   NULL);
49   _gdk_quartz_drag_source_context->is_source = TRUE;
50
51   gdk_drag_context_set_device (context, device);
52
53   return context;
54 }
55
56 static gboolean
57 gdk_quartz_drag_context_drag_motion (GdkDragContext  *context,
58                                      GdkWindow       *dest_window,
59                                      GdkDragProtocol  protocol,
60                                      gint             x_root,
61                                      gint             y_root,
62                                      GdkDragAction    suggested_action,
63                                      GdkDragAction    possible_actions,
64                                      guint32          time)
65 {
66   /* FIXME: Implement */
67   return FALSE;
68 }
69
70 GdkNativeWindow
71 _gdk_quartz_display_get_drag_protocol (GdkDisplay      *display,
72                                        GdkNativeWindow  xid,
73                                        GdkDragProtocol *protocol,
74                                        guint           *version)
75 {
76   /* FIXME: Implement */
77   return 0;
78 }
79
80 static GdkWindow *
81 gdk_quartz_drag_context_find_window (GdkDragContext  *context,
82                                      GdkWindow       *drag_window,
83                                      GdkScreen       *screen,
84                                      gint             x_root,
85                                      gint             y_root,
86                                      GdkDragProtocol *protocol)
87 {
88   /* FIXME: Implement */
89   return NULL;
90 }
91
92 static void
93 gdk_quartz_drag_context_drag_drop (GdkDragContext *context,
94                                    guint32         time)
95 {
96   /* FIXME: Implement */
97 }
98
99 static void
100 gdk_quartz_drag_context_drag_abort (GdkDragContext *context,
101                                     guint32         time)
102 {
103   /* FIXME: Implement */
104 }
105
106 static void
107 gdk_quartz_drag_context_drag_status (GdkDragContext *context,
108                                      GdkDragAction   action,
109                                      guint32         time)
110 {
111   context->action = action;
112 }
113
114 static void
115 gdk_quartz_drag_context_drop_reply (GdkDragContext *context,
116                                     gboolean        ok,
117                                     guint32         time)
118 {
119   /* FIXME: Implement */
120 }
121
122 static void
123 gdk_quartz_drag_context_drop_finish (GdkDragContext *context,
124                                      gboolean        success,
125                                      guint32         time)
126 {
127   /* FIXME: Implement */
128 }
129
130 void
131 _gdk_quartz_window_register_dnd (GdkWindow *window)
132 {
133   /* FIXME: Implement */
134 }
135
136 static GdkAtom
137 gdk_quartz_drag_context_get_selection (GdkDragContext *context)
138 {
139   /* FIXME: Implement */
140   return GDK_NONE;
141 }
142
143 static gboolean
144 gdk_quartz_drag_context_drop_status (GdkDragContext *context)
145 {
146   /* FIXME: Implement */
147   return FALSE;
148 }
149
150 id
151 gdk_quartz_drag_context_get_dragging_info_libgtk_only (GdkDragContext *context)
152 {
153   return GDK_QUARTZ_DRAG_CONTEXT (context)->dragging_info;
154 }
155
156 static void
157 gdk_quartz_drag_context_init (GdkQuartzDragContext *context)
158 {
159 }
160
161 static void
162 gdk_quartz_drag_context_finalize (GObject *object)
163 {
164   G_OBJECT_CLASS (gdk_quartz_drag_context_parent_class)->finalize (object);
165 }
166
167 static void
168 gdk_drag_context_class_init (GdkDragContextClass *klass)
169 {
170   GObjectClass *object_class = G_OBJECT_CLASS (klass);
171   GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
172
173   object_class->finalize = gdk_quartz_drag_context_finalize;
174
175   context_class->find_window = gdk_quartz_drag_context_find_window;
176   context_class->drag_status = gdk_quartz_drag_context_drag_status;
177   context_class->drag_motion = gdk_quartz_drag_context_drag_motion;
178   context_class->drag_abort = gdk_quartz_drag_context_drag_abort;
179   context_class->drag_drop = gdk_quartz_drag_context_drag_drop;
180   context_class->drop_reply = gdk_quartz_drag_context_drop_reply;
181   context_class->drop_finish = gdk_quartz_drag_context_drop_finish;
182   context_class->drop_status = gdk_quartz_drag_context_drop_status;
183   context_class->get_selection = gdk_quartz_drag_context_get_selection;
184 }