+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);
+}
+
+bool wxTextDataObject::GetDataHere(void *buf) const
+{
+ wxStrcpy( (wxChar*)buf, GetText().c_str() );
+
+ return true;
+}
+
+bool wxTextDataObject::SetData(size_t WXUNUSED(len), const void *buf)
+{
+ SetText( wxString((const wxChar*)buf) );
+
+ return true;
+}
+
+#endif // different wxTextDataObject implementations