+#if defined(__WXGTK20__) && wxUSE_UNICODE
+
+size_t wxTextDataObject::GetDataSize(const wxDataFormat& format) const
+{
+ if (format == wxDF_UNICODETEXT)
+ {
+ // Use UTF8 not UCS4
+ wxCharBuffer buffer = wxConvUTF8.cWX2MB( GetText().c_str() );
+ return strlen( (const char*) buffer ) + 1;
+ }
+ else // == wxDF_TEXT
+ {
+ wxCharBuffer buffer = wxConvLibc.cWX2MB( GetText().c_str() );
+ return strlen( (const char*) buffer ) + 1;
+ }
+}
+
+bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const
+{
+ if (format == wxDF_UNICODETEXT)
+ {
+ // Use UTF8 not UCS4
+ wxCharBuffer buffer = wxConvUTF8.cWX2MB( GetText().c_str() );
+ strcpy( (char*) buf, (const char*) buffer );
+ }
+ else
+ {
+ wxCharBuffer buffer = wxConvLibc.cWX2MB( GetText().c_str() );
+ strcpy( (char*) buf, (const char*) buffer );
+ }
+
+ return TRUE;
+}
+
+bool wxTextDataObject::SetData(const wxDataFormat& format,
+ size_t WXUNUSED(len), const void *buf)
+{
+ if (format == wxDF_UNICODETEXT)
+ SetText( wxConvUTF8.cMB2WX( (const char*) buf ) );
+ else
+ SetText( wxConvLibc.cMB2WX( (const char*) buf ) );
+
+ return TRUE;
+}
+
+#elif wxUSE_UNICODE && defined(__WXMAC__)
+
+size_t wxTextDataObject::GetDataSize(const wxDataFormat& format) const
+{
+ if (format == wxDF_UNICODETEXT)
+ {
+ // host native is UTF16
+ wxMBConvUTF16BE converter ;
+ wxCharBuffer buffer = converter.cWX2MB( GetText().c_str() );
+ return strlen( (const char*) buffer ) + 1;
+ }
+ else // == wxDF_TEXT
+ {
+ wxCharBuffer buffer = wxConvLibc.cWX2MB( GetText().c_str() );
+ return strlen( (const char*) buffer ) + 1;
+ }
+}
+
+bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const
+{
+ if (format == wxDF_UNICODETEXT)
+ {
+ // host native is UTF16
+ wxMBConvUTF16BE converter ;
+ wxCharBuffer buffer = converter.cWX2MB( GetText().c_str() );
+ strcpy( (char*) buf, (const char*) buffer );
+ }
+ else
+ {
+ wxCharBuffer buffer = wxConvLibc.cWX2MB( GetText().c_str() );
+ strcpy( (char*) buf, (const char*) buffer );
+ }
+
+ return TRUE;
+}
+
+bool wxTextDataObject::SetData(const wxDataFormat& format,
+ size_t WXUNUSED(len), const void *buf)
+{
+ if (format == wxDF_UNICODETEXT)
+ {
+ // host native is UTF16
+ wxMBConvUTF16BE converter ;
+ SetText( converter.cMB2WX( (const char*) buf ) );
+ }
+ else
+ SetText( wxConvLibc.cMB2WX( (const char*) buf ) );
+
+ return TRUE;
+}
+
+#else
+