Code

Hooks for visual feedback during drag-n-drop
authorjoncruz <joncruz@users.sourceforge.net>
Wed, 17 Oct 2007 08:50:01 +0000 (08:50 +0000)
committerjoncruz <joncruz@users.sourceforge.net>
Wed, 17 Oct 2007 08:50:01 +0000 (08:50 +0000)
src/interface.cpp

index 6806c69574fbb96df2571ba36eaac20592db0253..775f53b35e83b4c0ec6830cf9bd9a5c4090d92cd 100644 (file)
@@ -110,6 +110,17 @@ static void sp_ui_drag_data_received(GtkWidget *widget,
                                      guint info,
                                      guint event_time,
                                      gpointer user_data);
+static void sp_ui_drag_motion( GtkWidget *widget,
+                               GdkDragContext *drag_context,
+                               gint x, gint y,
+                               GtkSelectionData *data,
+                               guint info,
+                               guint event_time,
+                               gpointer user_data );
+static void sp_ui_drag_leave( GtkWidget *widget,
+                              GdkDragContext *drag_context,
+                              guint event_time,
+                              gpointer user_data );
 static void sp_ui_menu_item_set_sensitive(SPAction *action,
                                           unsigned int sensitive,
                                           void *data);
@@ -240,10 +251,20 @@ sp_create_window(SPViewWidget *vw, gboolean editable)
                       completeDropTargets,
                       completeDropTargetsCount,
                       GdkDragAction(GDK_ACTION_COPY | GDK_ACTION_MOVE));
+
+
     g_signal_connect(G_OBJECT(win->gobj()),
                      "drag_data_received",
                      G_CALLBACK(sp_ui_drag_data_received),
                      NULL);
+    g_signal_connect(G_OBJECT(win->gobj()),
+                     "drag_motion",
+                     G_CALLBACK(sp_ui_drag_motion),
+                     NULL);
+    g_signal_connect(G_OBJECT(win->gobj()),
+                     "drag_leave",
+                     G_CALLBACK(sp_ui_drag_leave),
+                     NULL);
     win->show();
 
     // needed because the first ACTIVATE_DESKTOP was sent when there was no window yet
@@ -1294,6 +1315,31 @@ sp_ui_drag_data_received(GtkWidget *widget,
     }
 }
 
+#include "gradient-context.h"
+
+void sp_ui_drag_motion( GtkWidget *widget,
+                        GdkDragContext *drag_context,
+                        gint x, gint y,
+                        GtkSelectionData *data,
+                        guint info,
+                        guint event_time,
+                        gpointer user_data)
+{
+    SPDocument *doc = SP_ACTIVE_DOCUMENT;
+    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+
+
+//     g_message("drag-n-drop motion (%4d, %4d)  at %d", x, y, event_time);
+}
+
+static void sp_ui_drag_leave( GtkWidget *widget,
+                              GdkDragContext *drag_context,
+                              guint event_time,
+                              gpointer user_data )
+{
+//     g_message("drag-n-drop leave                at %d", event_time);
+}
+
 static void
 sp_ui_import_files(gchar *buffer)
 {