-bool wxDropTarget::GetData()
-{
- if (m_dataObject == NULL)
- return false;
-
- if ( !CurrentDragHasSupportedFormat() )
- return false;
-
- bool transferred = false;
- if ( gTrackingGlobals.m_currentSource != NULL )
- {
- wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject();
-
- if (data != NULL)
- {
- size_t formatcount = data->GetFormatCount();
- wxDataFormat *array = new wxDataFormat[formatcount];
- data->GetAllFormats( array );
- for (size_t i = 0; !transferred && i < formatcount; i++)
- {
- wxDataFormat format = array[i];
- if ( m_dataObject->IsSupported( format ) )
- {
- int size = data->GetDataSize( format );
- transferred = true;
-
- if (size == 0)
- {
- m_dataObject->SetData( format, 0, 0 );
- }
- else
- {
- char *d = new char[size];
- data->GetDataHere( format, (void*)d );
- m_dataObject->SetData( format, size, d );
- delete [] d;
- }
- }
- }
-
- delete [] array;
- }
- }
-
-#if wxOSX_USE_CARBON
- if ( !transferred )
- {
- PasteboardRef pasteboard;
-
- if ( GetDragPasteboard( (DragReference)m_currentDrag, &pasteboard ) == noErr )
- {
- transferred = m_dataObject->GetFromPasteboard( pasteboard );
- }
- }
-#endif
-
- return transferred;
-}