]> git.saurik.com Git - wxWidgets.git/commitdiff
wxTextDataObject should convert to and
authorRobert Roebling <robert@roebling.de>
Thu, 15 Aug 2002 20:47:04 +0000 (20:47 +0000)
committerRobert Roebling <robert@roebling.de>
Thu, 15 Aug 2002 20:47:04 +0000 (20:47 +0000)
    from UTF8 in Unicode mode under GTK.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16526 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/dobjcmn.cpp

index 08b9a0e923545f16967fa8f2e269e738e3fc37d7..93a2d21d233055609c3521754d3565fec5237d6e 100644 (file)
@@ -234,19 +234,36 @@ bool wxDataObjectComposite::SetData(const wxDataFormat& format,
 
 size_t wxTextDataObject::GetDataSize() const
 {
+#if defined(__WXGTK20__) && wxUSE_UNICODE
+    // Use UTF8 not UCS4
+    wxCharBuffer buffer = wxConvUTF8.cWX2MB( GetText().c_str() );
+    return strlen( (const char*) buffer ) + 1;
+#else
     return GetTextLength() * sizeof(wxChar);
+#endif
 }
 
 bool wxTextDataObject::GetDataHere(void *buf) const
 {
+#if defined(__WXGTK20__) && wxUSE_UNICODE
+    // Use UTF8 not UCS4
+    wxCharBuffer buffer = wxConvUTF8.cWX2MB( GetText().c_str() );
+    strcpy( (char*) buf, (const char*) buffer );
+#else
     wxStrcpy((wxChar *)buf, GetText().c_str());
+#endif
 
     return TRUE;
 }
 
 bool wxTextDataObject::SetData(size_t WXUNUSED(len), const void *buf)
 {
+#if defined(__WXGTK20__) && wxUSE_UNICODE
+    // Use UTF8 not UCS4
+    SetText( wxConvUTF8.cMB2WX( (const char*) buf ) );
+#else
     SetText(wxString((const wxChar *)buf));
+#endif
 
     return TRUE;
 }