X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e6b01b78a3a55d341cac1cc7a3b48e7bd2380beb..008a56c968ed7e0694e32e93c2dbf95dde2ba5c8:/src/common/dobjcmn.cpp?ds=sidebyside diff --git a/src/common/dobjcmn.cpp b/src/common/dobjcmn.cpp index 661b8114dc..93a2d21d23 100644 --- a/src/common/dobjcmn.cpp +++ b/src/common/dobjcmn.cpp @@ -146,7 +146,7 @@ size_t wxDataObjectComposite::GetBufferOffset( const wxDataFormat& format ) { wxDataObjectSimple *dataObj = GetObject(format); - wxCHECK_MSG( dataObj, FALSE, + wxCHECK_MSG( dataObj, 0, wxT("unsupported format in wxDataObjectComposite")); return dataObj->GetBufferOffset( format ); @@ -158,7 +158,7 @@ const void* wxDataObjectComposite::GetSizeFromBuffer( const void* buffer, { wxDataObjectSimple *dataObj = GetObject(format); - wxCHECK_MSG( dataObj, FALSE, + wxCHECK_MSG( dataObj, NULL, wxT("unsupported format in wxDataObjectComposite")); return dataObj->GetSizeFromBuffer( buffer, size, format ); @@ -169,7 +169,7 @@ void* wxDataObjectComposite::SetSizeInBuffer( void* buffer, size_t size, { wxDataObjectSimple *dataObj = GetObject(format); - wxCHECK_MSG( dataObj, FALSE, + wxCHECK_MSG( dataObj, NULL, wxT("unsupported format in wxDataObjectComposite")); return dataObj->SetSizeInBuffer( buffer, size, format ); @@ -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; }