]> Pileus Git - ~andy/gtk/blob - gdk/quartz/gdkdnd-quartz.c
Merge branch 'gtk-2-90'
[~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 "gdkprivate-quartz.h"
23
24 static gpointer parent_class = NULL;
25
26 static void
27 gdk_drag_context_finalize (GObject *object)
28 {
29   GdkDragContext *context = GDK_DRAG_CONTEXT (object);
30   GdkDragContextPrivate *private = GDK_DRAG_CONTEXT_PRIVATE (context);
31  
32   g_free (private);
33   
34   G_OBJECT_CLASS (parent_class)->finalize (object);
35 }
36
37 static void
38 gdk_drag_context_init (GdkDragContext *dragcontext)
39 {
40   GdkDragContextPrivate *priv = g_new0 (GdkDragContextPrivate, 1);
41
42   dragcontext->windowing_data = priv;
43 }
44
45 static void
46 gdk_drag_context_class_init (GdkDragContextClass *klass)
47 {
48   GObjectClass *object_class = G_OBJECT_CLASS (klass);
49   
50   parent_class = g_type_class_peek_parent (klass);
51
52   object_class->finalize = gdk_drag_context_finalize;
53 }
54
55 GType
56 gdk_drag_context_get_type (void)
57 {
58   static GType object_type = 0;
59
60   if (!object_type)
61     {
62       const GTypeInfo object_info =
63       {
64         sizeof (GdkDragContextClass),
65         (GBaseInitFunc) NULL,
66         (GBaseFinalizeFunc) NULL,
67         (GClassInitFunc) gdk_drag_context_class_init,
68         NULL,           /* class_finalize */
69         NULL,           /* class_data */
70         sizeof (GdkDragContext),
71         0,              /* n_preallocs */
72         (GInstanceInitFunc) gdk_drag_context_init,
73       };
74       
75       object_type = g_type_register_static (G_TYPE_OBJECT,
76                                             "GdkDragContext",
77                                             &object_info,
78                                             0);
79     }
80   
81   return object_type;
82 }
83
84 GdkDragContext *
85 gdk_drag_context_new (void)
86 {
87   return (GdkDragContext *)g_object_new (gdk_drag_context_get_type (), NULL);
88 }
89
90 GdkDragContext *_gdk_quartz_drag_source_context = NULL;
91
92 GdkDragContext *
93 gdk_quartz_drag_source_context ()
94 {
95   return _gdk_quartz_drag_source_context;
96 }
97
98 GdkDragContext * 
99 gdk_drag_begin (GdkWindow     *window,
100                 GList         *targets)
101 {
102   g_assert (_gdk_quartz_drag_source_context == NULL);
103   
104   /* Create fake context */
105   _gdk_quartz_drag_source_context = gdk_drag_context_new ();
106   _gdk_quartz_drag_source_context->is_source = TRUE;
107   
108   return _gdk_quartz_drag_source_context;
109 }
110
111 gboolean        
112 gdk_drag_motion (GdkDragContext *context,
113                  GdkWindow      *dest_window,
114                  GdkDragProtocol protocol,
115                  gint            x_root, 
116                  gint            y_root,
117                  GdkDragAction   suggested_action,
118                  GdkDragAction   possible_actions,
119                  guint32         time)
120 {
121   /* FIXME: Implement */
122   return FALSE;
123 }
124
125 guint32
126 gdk_drag_get_protocol_for_display (GdkDisplay      *display,
127                                    guint32          xid,
128                                    GdkDragProtocol *protocol)
129 {
130   /* FIXME: Implement */
131   return 0;
132 }
133
134 void
135 gdk_drag_find_window_for_screen (GdkDragContext  *context,
136                                  GdkWindow       *drag_window,
137                                  GdkScreen       *screen,
138                                  gint             x_root,
139                                  gint             y_root,
140                                  GdkWindow      **dest_window,
141                                  GdkDragProtocol *protocol)
142 {
143   /* FIXME: Implement */
144 }
145
146 void
147 gdk_drag_drop (GdkDragContext *context,
148                guint32         time)
149 {
150   /* FIXME: Implement */
151 }
152
153 void
154 gdk_drag_abort (GdkDragContext *context,
155                 guint32         time)
156 {
157   g_return_if_fail (context != NULL);
158   
159   /* FIXME: Implement */
160 }
161
162 void             
163 gdk_drag_status (GdkDragContext   *context,
164                  GdkDragAction     action,
165                  guint32           time)
166 {
167   context->action = action;
168 }
169
170 void 
171 gdk_drop_reply (GdkDragContext   *context,
172                 gboolean          ok,
173                 guint32           time)
174 {
175   g_return_if_fail (context != NULL);
176
177   /* FIXME: Implement */
178 }
179
180 void             
181 gdk_drop_finish (GdkDragContext   *context,
182                  gboolean          success,
183                  guint32           time)
184 {
185   /* FIXME: Implement */
186 }
187
188 void            
189 gdk_window_register_dnd (GdkWindow *window)
190 {
191   /* FIXME: Implement */
192 }
193
194 GdkAtom       
195 gdk_drag_get_selection (GdkDragContext *context)
196 {
197   /* FIXME: Implement */
198   return GDK_NONE;
199 }
200
201 gboolean 
202 gdk_drag_drop_succeeded (GdkDragContext *context)
203 {
204   /* FIXME: Implement */
205   return FALSE;
206 }
207
208 id
209 gdk_quartz_drag_context_get_dragging_info_libgtk_only (GdkDragContext *context)
210 {
211   return GDK_DRAG_CONTEXT_PRIVATE (context)->dragging_info;
212 }