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