-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;
- }
+ bool transferred = false;
+
+ if ( m_data )
+ {
+ for (size_t i = 0; !transferred && i < formatcount; i++)
+ {
+ wxDataFormat format = array[ i ];
+ if ( m_data->IsSupported( format ) )
+ {
+ int dataSize = m_data->GetDataSize( format );
+ transferred = true;
+
+ 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 )
+ {
+ transferred = data.GetFromPasteboard( m_pasteboard ) ;
+ }
+
+ delete [] array;
+
+ return transferred;