#if wxUSE_DATAOBJ
+#include "wx/dataobj.h"
+
#ifndef WX_PRECOMP
#include "wx/app.h"
- #include "wx/debug.h"
#endif
-#include "wx/dataobj.h"
-
// ----------------------------------------------------------------------------
// lists
// ----------------------------------------------------------------------------
wxDataObjectComposite::wxDataObjectComposite()
{
m_preferred = 0;
+ m_receivedFormat = wxFormatInvalid;
}
wxDataObjectComposite::~wxDataObjectComposite()
m_dataObjects.Append( dataObject );
}
+wxDataFormat wxDataObjectComposite::GetReceivedFormat() const
+{
+ return m_receivedFormat;
+}
+
wxDataFormat
wxDataObjectComposite::GetPreferredFormat(Direction WXUNUSED(dir)) const
{
wxCHECK_MSG( dataObj, false,
wxT("unsupported format in wxDataObjectComposite"));
+ m_receivedFormat = format;
return dataObj->SetData( len, buf );
}
{
wxCharBuffer buffer = GetConv(format).cWX2MB( GetText().c_str() );
- return buffer ? strlen( buffer ) + 1 : 0;
+ return buffer ? strlen( buffer ) : 0;
}
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 == NULL )
+ if ( !buffer )
return false;
- strcpy( (char*)buf, buffer );
+ memcpy( (char*) buf, buffer, GetDataSize(format) );
+ // strcpy( (char*) buf, buffer );
return true;
}
return false;
wxWCharBuffer buffer = GetConv(format).cMB2WX( (const char*)buf );
- if ( buffer == NULL )
- return false;
SetText( buffer );