- size_t dataSize = m_data->GetDataSize( formats[i] ) ;
- Ptr dataPtr = new char[dataSize] ;
- m_data->GetDataHere( formats[i] , dataPtr ) ;
- OSType type = formats[i].GetFormatId() ;
- if ( type == 'TEXT' )
- {
- dataSize-- ;
- if ( wxApp::s_macDefaultEncodingIsPC )
- {
- wxMacConvertFromPC((char*)dataPtr,(char*)dataPtr,dataSize) ;
- }
- AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
- }
- else if (type == kDragFlavorTypeHFS )
- {
- HFSFlavor theFlavor ;
- OSErr err = noErr;
- CInfoPBRec cat;
-
- wxMacFilename2FSSpec( dataPtr , &theFlavor.fileSpec ) ;
-
- cat.hFileInfo.ioNamePtr = theFlavor.fileSpec.name;
- cat.hFileInfo.ioVRefNum = theFlavor.fileSpec.vRefNum;
- cat.hFileInfo.ioDirID = theFlavor.fileSpec.parID;
- cat.hFileInfo.ioFDirIndex = 0;
- err = PBGetCatInfoSync(&cat);
- if (err == noErr )
- {
- theFlavor.fdFlags = cat.hFileInfo.ioFlFndrInfo.fdFlags;
- if (theFlavor.fileSpec.parID == fsRtParID) {
- theFlavor.fileCreator = 'MACS';
- theFlavor.fileType = 'disk';
- } else if ((cat.hFileInfo.ioFlAttrib & ioDirMask) != 0) {
- theFlavor.fileCreator = 'MACS';
- theFlavor.fileType = 'fold';
- } else {
- theFlavor.fileCreator = cat.hFileInfo.ioFlFndrInfo.fdCreator;
- theFlavor.fileType = cat.hFileInfo.ioFlFndrInfo.fdType;
- }
- AddDragItemFlavor(theDrag, theItem, type , &theFlavor, sizeof(theFlavor), 0);
- }
- }
- else
- {
- AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
- }
- delete[] dataPtr ;