-char *wxClipboard::GetClipboardData(char *format, long *length, long time)
-{
- if (clipOwner) {
- if (clipOwner->formats.Member(format))
- return clipOwner->GetData(format, length);
- else
- return NULL;
- } else if (cbString) {
- if (!strcmp(format, "TEXT"))
- return copystring(cbString);
- else
- return NULL;
- } else {
- if (wxOpenClipboard()) {
- receivedString = (char *)wxGetClipboardData(FormatStringToID(format),
- length);
- wxCloseClipboard();
- } else
- receivedString = NULL;
-
- return receivedString;
- }
+ if (dataSize == 0)
+ {
+ data.SetData( format, 0, 0 );
+ }
+ else
+ {
+ char *d = new char[ dataSize ];
+ m_data->GetDataHere( format, (void*)d );
+ data.SetData( format, dataSize, d );
+ delete [] d;
+ }
+ }
+ }
+ }
+
+ // get formats from wxDataObjects
+ if ( !transferred )
+ {
+ for (size_t i = 0; !transferred && i < formatcount; i++)
+ {
+ wxDataFormat format = array[ i ];
+
+ switch ( format.GetType() )
+ {
+ // NOTE: this is usable for all data types
+ case wxDF_TEXT:
+ case wxDF_UNICODETEXT:
+ case wxDF_OEMTEXT:
+ case wxDF_BITMAP:
+ case wxDF_METAFILE:
+ default:
+ {
+ long len;
+ char* s = (char*)wxGetClipboardData( format, &len );
+ if (s != NULL)
+ {
+ data.SetData( format, len, s );
+ delete [] s;
+
+ transferred = true;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ delete [] array;
+
+ return transferred;