- wxDataObject *data = source->m_data;
-
- size_t size = data->GetDataSize();
- char *ptr = new char[size];
- data->GetDataHere( ptr );
-
- gtk_widget_dnd_data_set( widget, event, ptr, size );
+ wxDataBroker *data = source->m_data;
+
+ if (!data) return;
+
+ wxNode *node = data->m_dataObjects.First();
+ {
+ wxDataObject *dobj = (wxDataObject*) node->Data();
+
+ if ((strcmp(event->data_type,"file:ALL") == 0) &&
+ (dobj->GetFormat().GetType() == wxDF_FILENAME))
+ {
+ wxFileDataObject *file_object = (wxFileDataObject*) dobj;
+
+ wxString text = file_object->GetFiles();
+
+ char *s = WXSTRINGCAST text;
+
+ gtk_widget_dnd_data_set( widget,
+ (GdkEvent*)event,
+ (unsigned char*) s,
+ (int) text.Length()+1 );
+
+ source->m_retValue = wxDragCopy;
+
+ return;
+ }
+
+ if ((strcmp(event->data_type,"text/plain") == 0) &&
+ (dobj->GetFormat().GetType() == wxDF_TEXT))
+ {
+ wxTextDataObject *text_object = (wxTextDataObject*) dobj;
+
+ wxString text = text_object->GetText();
+
+ char *s = WXSTRINGCAST text;
+
+ gtk_widget_dnd_data_set( widget,
+ (GdkEvent*)event,
+ (unsigned char*) s,
+ (int) text.Length()+1 );
+
+ source->m_retValue = wxDragCopy;
+
+ return;
+ }
+
+ if (dobj->GetFormat().GetType() == wxDF_PRIVATE)
+ {
+ wxPrivateDataObject *pdo = (wxPrivateDataObject*) dobj;
+
+ if (pdo->GetId() == event->data_type)
+ {
+ gtk_widget_dnd_data_set( widget,
+ (GdkEvent*)event,
+ (unsigned char*) pdo->GetData(),
+ (int) pdo->GetSize() );
+
+ source->m_retValue = wxDragCopy;
+
+ return;
+ }
+ }
+
+ node = node->Next();
+ }
+}
+
+wxDropSource::wxDropSource( wxWindow *win )
+{
+ g_blockEventsOnDrag = TRUE;