1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1999 Peter Mattis, Spencer Kimball and Josh MacDonald
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.
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.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
29 #include "gdkdndprivate.h"
31 #include "gdkinternals.h"
32 #include "gdkproperty.h"
33 #include "gdkprivate-broadway.h"
34 #include "gdkinternals.h"
35 #include "gdkscreen-broadway.h"
36 #include "gdkdisplay-broadway.h"
40 #define GDK_TYPE_BROADWAY_DRAG_CONTEXT (gdk_broadway_drag_context_get_type ())
41 #define GDK_BROADWAY_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContext))
42 #define GDK_BROADWAY_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContextClass))
43 #define GDK_IS_BROADWAY_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_DRAG_CONTEXT))
44 #define GDK_IS_BROADWAY_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_DRAG_CONTEXT))
45 #define GDK_BROADWAY_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContextClass))
47 #ifdef GDK_COMPILATION
48 typedef struct _GdkBroadwayDragContext GdkBroadwayDragContext;
50 typedef GdkDragContext GdkBroadwayDragContext;
52 typedef struct _GdkBroadwayDragContextClass GdkBroadwayDragContextClass;
54 GType gdk_broadway_drag_context_get_type (void);
56 struct _GdkBroadwayDragContext {
57 GdkDragContext context;
60 struct _GdkBroadwayDragContextClass
62 GdkDragContextClass parent_class;
65 static void gdk_broadway_drag_context_finalize (GObject *object);
67 static GList *contexts;
69 G_DEFINE_TYPE (GdkBroadwayDragContext, gdk_broadway_drag_context, GDK_TYPE_DRAG_CONTEXT)
72 gdk_broadway_drag_context_init (GdkBroadwayDragContext *dragcontext)
74 contexts = g_list_prepend (contexts, dragcontext);
78 gdk_broadway_drag_context_finalize (GObject *object)
80 GdkDragContext *context = GDK_DRAG_CONTEXT (object);
82 contexts = g_list_remove (contexts, context);
84 G_OBJECT_CLASS (gdk_broadway_drag_context_parent_class)->finalize (object);
90 _gdk_broadway_window_drag_begin (GdkWindow *window,
94 GdkDragContext *new_context;
96 g_return_val_if_fail (window != NULL, NULL);
97 g_return_val_if_fail (GDK_WINDOW_IS_BROADWAY (window), NULL);
99 new_context = g_object_new (GDK_TYPE_BROADWAY_DRAG_CONTEXT,
106 _gdk_broadway_window_get_drag_protocol (GdkWindow *window,
109 return GDK_DRAG_PROTO_NONE;
113 gdk_broadway_drag_context_find_window (GdkDragContext *context,
114 GdkWindow *drag_window,
118 GdkDragProtocol *protocol)
120 g_return_val_if_fail (context != NULL, NULL);
125 gdk_broadway_drag_context_drag_motion (GdkDragContext *context,
126 GdkWindow *dest_window,
127 GdkDragProtocol protocol,
130 GdkDragAction suggested_action,
131 GdkDragAction possible_actions,
134 g_return_val_if_fail (context != NULL, FALSE);
135 g_return_val_if_fail (dest_window == NULL || GDK_WINDOW_IS_BROADWAY (dest_window), FALSE);
141 gdk_broadway_drag_context_drag_drop (GdkDragContext *context,
144 g_return_if_fail (context != NULL);
148 gdk_broadway_drag_context_drag_abort (GdkDragContext *context,
151 g_return_if_fail (context != NULL);
154 /* Destination side */
157 gdk_broadway_drag_context_drag_status (GdkDragContext *context,
158 GdkDragAction action,
161 g_return_if_fail (context != NULL);
165 gdk_broadway_drag_context_drop_reply (GdkDragContext *context,
169 g_return_if_fail (context != NULL);
173 gdk_broadway_drag_context_drop_finish (GdkDragContext *context,
177 g_return_if_fail (context != NULL);
181 _gdk_broadway_window_register_dnd (GdkWindow *window)
186 gdk_broadway_drag_context_get_selection (GdkDragContext *context)
188 g_return_val_if_fail (context != NULL, GDK_NONE);
194 gdk_broadway_drag_context_drop_status (GdkDragContext *context)
196 g_return_val_if_fail (context != NULL, FALSE);
202 _gdk_broadway_display_init_dnd (GdkDisplay *display)
207 gdk_broadway_drag_context_class_init (GdkBroadwayDragContextClass *klass)
209 GObjectClass *object_class = G_OBJECT_CLASS (klass);
210 GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
212 object_class->finalize = gdk_broadway_drag_context_finalize;
214 context_class->find_window = gdk_broadway_drag_context_find_window;
215 context_class->drag_status = gdk_broadway_drag_context_drag_status;
216 context_class->drag_motion = gdk_broadway_drag_context_drag_motion;
217 context_class->drag_abort = gdk_broadway_drag_context_drag_abort;
218 context_class->drag_drop = gdk_broadway_drag_context_drag_drop;
219 context_class->drop_reply = gdk_broadway_drag_context_drop_reply;
220 context_class->drop_finish = gdk_broadway_drag_context_drop_finish;
221 context_class->drop_status = gdk_broadway_drag_context_drop_status;
222 context_class->get_selection = gdk_broadway_drag_context_get_selection;