- GetFlavorDataSize( (DragReference)m_currentDrag, theItem, theType, &dataSize );
- if ( theType == kScrapFlavorTypeText )
- {
- // this increment is only valid for allocating:
- // on the next GetFlavorData call it is reset again to the original value
- dataSize++ ;
- }
- else if ( theType == kScrapFlavorTypeUnicode )
- {
- // this increment is only valid for allocating:
- // on the next GetFlavorData call it is reset again to the original value
- dataSize++ ;
- dataSize++ ;
- }
-
- if (dataSize > 0)
- theData = new char[dataSize];
- else
- theData = NULL;
-
- GetFlavorData( (DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L );
- if ( theType == kScrapFlavorTypeText )
- {
- theData[dataSize] = 0 ;
- m_dataObject->SetData( wxDataFormat(wxDF_TEXT), dataSize , theData );
- }
-#if wxUSE_UNICODE
- else if ( theType == kScrapFlavorTypeUnicode )
- {
- theData[dataSize + 0] =
- theData[dataSize + 1] = 0 ;
- m_dataObject->SetData( wxDataFormat(wxDF_UNICODETEXT), dataSize , theData );
- }
-#endif
- else if ( theType == kDragFlavorTypeHFS )
- {
- wxFileDataObject *fdo = dynamic_cast<wxFileDataObject*>(m_dataObject);
- wxASSERT( fdo != NULL );
-
- if ((theData != NULL) && (fdo != NULL))
- {
- HFSFlavor* theFile = (HFSFlavor*) theData ;
- wxString name = wxMacFSSpec2MacFilename( &theFile->fileSpec ) ;
-
- if ( !firstFileAdded )
- {
- // reset file list
- fdo->SetData( 0 , "" ) ;
- firstFileAdded = true ;
- }
-
- if (!name.IsEmpty())
- fdo->AddFile( name ) ;
- }
- }
- else
- {
- m_dataObject->SetData( format, dataSize, theData );
- }
-
- delete [] theData;
- }
- break ;
- }
- }