- wxDataObject *data_object = (wxDataObject *)node->Data();
-
- if (data_object->GetFormat().GetAtom() != selection_data->target)
- {
- node = node->Next();
- break;
- }
-
- switch (data_object->GetFormat().GetType())
- {
- case wxDF_TEXT:
- {
- wxTextDataObject *text_object = (wxTextDataObject*) data_object;
-
- wxString text = text_object->GetText();
-
- char *s = WXSTRINGCAST text;
- int len = (int) text.Length();
-
- gtk_selection_data_set(
- selection_data,
- GDK_SELECTION_TYPE_STRING,
- 8*sizeof(gchar),
- (unsigned char*) s,
- len );
-
- break;
- }
-
- case wxDF_BITMAP:
- {
- // wxBitmapDataObject *private_object = (wxBitmapDataObject*) data_object;
-
- // how do we do that ?
-
- break;
- }
-
- case wxDF_PRIVATE:
- {
- wxPrivateDataObject *private_object = (wxPrivateDataObject*) data_object;
-
- if (private_object->GetSize() == 0) return;
-
- gtk_selection_data_set(
- selection_data,
- GDK_SELECTION_TYPE_STRING,
- 8*sizeof(gchar),
- (unsigned char*) private_object->GetData(),
- (int) private_object->GetSize() );
- }
-
- default:
- break;
- }
-
- node = node->Next();
+ wxTextDataObject *text_object = (wxTextDataObject*) data;
+ wxString text( text_object->GetText() );
+
+#if wxUSE_UNICODE
+ const wxWX2MBbuf s = text.mbc_str();
+ int len = strlen(s);
+#else // more efficient in non-Unicode
+ const char *s = text.c_str();
+ int len = (int) text.Length();
+#endif
+ gtk_selection_data_set(
+ selection_data,
+ GDK_SELECTION_TYPE_STRING,
+ 8*sizeof(gchar),
+ (unsigned char*) (const char*) s,
+ len );
+
+ return;