+
+ return true;
+}
+
+#endif // wxUSE_UNICODE_WCHAR/wxUSE_UNICODE_UTF8
+
+#elif defined(wxNEEDS_UTF16_FOR_TEXT_DATAOBJ)
+
+static wxMBConvUTF16 sUTF16Converter;
+
+static inline wxMBConv& GetConv(const wxDataFormat& format)
+{
+ return
+ format == wxDF_UNICODETEXT
+ ? (wxMBConv&) sUTF16Converter
+ : (wxMBConv&) wxConvLocal;
+}
+
+size_t wxTextDataObject::GetDataSize(const wxDataFormat& format) const
+{
+ size_t len = GetConv(format).WC2MB( NULL, GetText().c_str(), 0 );
+ len += (format == wxDF_UNICODETEXT ? 2 : 1);
+
+ return len;
+}
+
+bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const
+{
+ if ( buf == NULL )
+ return false;
+
+ wxCharBuffer buffer = GetConv(format).cWX2MB( GetText().c_str() );
+
+ size_t len = GetConv(format).WC2MB( NULL, GetText().c_str(), 0 );
+ len += (format == wxDF_UNICODETEXT ? 2 : 1);
+
+ // trailing (uni)char 0
+ memcpy( (char*)buf, (const char*)buffer, len );
+
+ return true;
+}
+
+bool wxTextDataObject::SetData(const wxDataFormat& format,
+ size_t WXUNUSED(len), const void *buf)
+{
+ if ( buf == NULL )
+ return false;
+
+ wxWCharBuffer buffer = GetConv(format).cMB2WX( (const char*)buf );
+
+ SetText( buffer );
+
+ return true;
+}
+
+#else // !wxNEEDS_UTF{8,16}_FOR_TEXT_DATAOBJ
+
+size_t wxTextDataObject::GetDataSize() const
+{
+ return GetTextLength() * sizeof(wxChar);