X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2c906a490735b158266030c0531ab779257d0aff..0c62004afb4926ecce56883250aaf72890b2ff9d:/src/common/dobjcmn.cpp diff --git a/src/common/dobjcmn.cpp b/src/common/dobjcmn.cpp index cbed32d72f..1dbe454bc0 100644 --- a/src/common/dobjcmn.cpp +++ b/src/common/dobjcmn.cpp @@ -18,13 +18,12 @@ #if wxUSE_DATAOBJ +#include "wx/dataobj.h" + #ifndef WX_PRECOMP #include "wx/app.h" - #include "wx/debug.h" #endif -#include "wx/dataobj.h" - // ---------------------------------------------------------------------------- // lists // ---------------------------------------------------------------------------- @@ -86,6 +85,7 @@ bool wxDataObjectBase::IsSupported(const wxDataFormat& format, wxDataObjectComposite::wxDataObjectComposite() { m_preferred = 0; + m_receivedFormat = wxFormatInvalid; } wxDataObjectComposite::~wxDataObjectComposite() @@ -120,6 +120,11 @@ void wxDataObjectComposite::Add(wxDataObjectSimple *dataObject, bool preferred) m_dataObjects.Append( dataObject ); } +wxDataFormat wxDataObjectComposite::GetReceivedFormat() const +{ + return m_receivedFormat; +} + wxDataFormat wxDataObjectComposite::GetPreferredFormat(Direction WXUNUSED(dir)) const { @@ -219,6 +224,7 @@ bool wxDataObjectComposite::SetData(const wxDataFormat& format, wxCHECK_MSG( dataObj, false, wxT("unsupported format in wxDataObjectComposite")); + m_receivedFormat = format; return dataObj->SetData( len, buf ); } @@ -243,12 +249,15 @@ size_t wxTextDataObject::GetDataSize(const wxDataFormat& format) const bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const { - if ( buf == NULL ) + if ( !buf ) return false; wxCharBuffer buffer = GetConv(format).cWX2MB( GetText().c_str() ); + if ( !buffer ) + return false; - strcpy( (char*)buf, buffer ); + memcpy( (char*) buf, buffer, GetDataSize(format) ); + // strcpy( (char*) buf, buffer ); return true; }