-#if !TARGET_CARBON
- OSErr err = noErr ;
-#else
- OSStatus err = noErr ;
-#endif
-
- switch ( array[i].GetType() )
- {
- case wxDF_TEXT:
- case wxDF_OEMTEXT:
- {
- wxTextDataObject* textDataObject = (wxTextDataObject*) data;
- wxString str(textDataObject->GetText());
- wxString mac ;
- if ( wxApp::s_macDefaultEncodingIsPC )
- {
- mac = wxMacMakeMacStringFromPC(textDataObject->GetText()) ;
- }
- else
- {
- mac = textDataObject->GetText() ;
- }
- #if !TARGET_CARBON
- err = PutScrap( mac.Length() , 'TEXT' , mac.c_str() ) ;
- #else
- ScrapRef scrap;
- err = GetCurrentScrap (&scrap);
- if ( !err )
- {
- err = PutScrapFlavor (scrap, 'TEXT', 0, mac.Length(), mac.c_str());
- }
- #endif
- }
-
-#if wxUSE_DRAG_AND_DROP
- case wxDF_METAFILE:
- {
- wxMetafileDataObject* metaFileDataObject =
- (wxMetafileDataObject*) data;
- wxMetafile metaFile = metaFileDataObject->GetMetafile();
- PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
- HLock( (Handle) pict ) ;
- #if !TARGET_CARBON
- err = PutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
- #else
- ScrapRef scrap;
- err = GetCurrentScrap (&scrap);
- if ( !err )
- {
- err = PutScrapFlavor (scrap, 'PICT', 0, GetHandleSize((Handle) pict), *pict);
- }
- #endif
- HUnlock( (Handle) pict ) ;
- }
-#endif
- case wxDF_BITMAP:
- case wxDF_DIB:
- default:
- break ;
- }
-
+ size_t sz = data->GetDataSize( array[i] ) ;
+ void* buf = malloc( sz + 1 ) ;
+ if ( buf )
+ {
+ data->GetDataHere( array[i] , buf ) ;
+ OSType mactype = 0 ;
+ switch ( array[i].GetType() )
+ {
+ case wxDF_TEXT:
+ case wxDF_OEMTEXT:
+ mactype = kScrapFlavorTypeText ;
+ break ;
+ #if wxUSE_UNICODE
+ case wxDF_UNICODETEXT :
+ mactype = kScrapFlavorTypeUnicode ;
+ break ;
+ #endif
+ #if wxUSE_DRAG_AND_DROP
+ case wxDF_METAFILE:
+ mactype = kScrapFlavorTypePicture ;
+ break ;
+ #endif
+ case wxDF_BITMAP:
+ case wxDF_DIB:
+ mactype = kScrapFlavorTypePicture ;
+ break ;
+ default:
+ break ;
+ }
+ UMAPutScrap( sz , mactype , buf ) ;
+ free( buf ) ;
+ }