#include "wx/window.h"
#include "wx/app.h"
#include "wx/gdicmn.h"
+#include <wx/intl.h>
#include "gdk/gdkprivate.h"
//-----------------------------------------------------------------------------
// drag request
-void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDataObject *data )
+void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDropSource *source )
{
printf( "Data requested for dropping.\n" );
+ wxDataObject *data = source->m_data;
+
uint size = data->GetDataSize();
char *ptr = new char[size];
data->GetDataHere( ptr );
gtk_widget_dnd_data_set( widget, event, ptr, size );
delete ptr;
+
+ source->m_retValue = wxDropSource::Copy;
};
wxDropSource::wxDropSource( wxWindow *win )
m_widget = win->m_widget;
if (win->m_wxwindow) m_widget = win->m_wxwindow;
- m_data = NULL;
+ m_data = NULL;
+ m_retValue = Cancel;
m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
m_goaheadCursor = wxCursor( wxCURSOR_HAND );
m_window = win;
m_widget = win->m_widget;
if (win->m_wxwindow) m_widget = win->m_wxwindow;
+ m_retValue = Cancel;
m_data = &data;
if (gdk_dnd.dnd_grabbed) return None;
if (gdk_dnd.drag_really) return None;
+ wxASSERT_MSG( m_data, "wxDragSource: no data" );
+
if (!m_data) return None;
if (m_data->GetDataSize() == 0) return None;
UnregisterWindow();
- return Copy;
+ g_blockEventsOnDrag = FALSE;
+
+ return m_retValue;
};
void wxDropSource::RegisterWindow(void)
gtk_widget_dnd_drag_set( m_widget, TRUE, &str, 1 );
gtk_signal_connect( GTK_OBJECT(m_widget), "drag_request_event",
- GTK_SIGNAL_FUNC(gtk_drag_callback), (gpointer)m_data );
+ GTK_SIGNAL_FUNC(gtk_drag_callback), (gpointer)this );
};
void wxDropSource::UnregisterWindow(void)
gtk_widget_dnd_drag_set( m_widget, FALSE, NULL, 0 );
- gtk_signal_disconnect_by_data( GTK_OBJECT(m_widget), (gpointer)m_data );
+ gtk_signal_disconnect_by_data( GTK_OBJECT(m_widget), (gpointer)this );
};