- m_data = data;
-
- /* get formats from wxDataObjects */
- wxDataFormat *array = new wxDataFormat[ m_data->GetFormatCount() ];
- m_data->GetAllFormats( array );
-
- for (size_t i = 0; i < m_data->GetFormatCount(); i++)
- {
- wxLogTrace( TRACE_CLIPBOARD,
- wxT("wxClipboard now supports atom %s"),
- array[i].GetId().c_str() );
-
-#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() ;
- }
- err = UMAPutScrap( mac.Length() , 'TEXT' , (void*) mac.c_str() ) ;
- }
- break ;
-
-#if wxUSE_DRAG_AND_DROP
- case wxDF_METAFILE:
- {
- wxMetafileDataObject* metaFileDataObject =
- (wxMetafileDataObject*) data;
- wxMetafile metaFile = metaFileDataObject->GetMetafile();
- PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
- HLock( (Handle) pict ) ;
- err = UMAPutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
- HUnlock( (Handle) pict ) ;
- }
- break ;
-#endif
- case wxDF_BITMAP:
- case wxDF_DIB:
- {
- bool created = false ;
- PicHandle pict = NULL ;
-
- wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data ;
- pict = (PicHandle) bitmapDataObject->GetBitmap().GetPict( &created ) ;
-
- HLock( (Handle) pict ) ;
- err = UMAPutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
- HUnlock( (Handle) pict ) ;
- if ( created )
- KillPicture( pict ) ;
- }
- default:
- break ;
- }
+ PasteboardSyncFlags syncFlags = PasteboardSynchronize( M_CLIPBOARD->m_pasteboard );
+ wxCHECK_MSG( !(syncFlags&kPasteboardModified), false, wxT("clipboard modified after clear") );
+ wxCHECK_MSG( (syncFlags&kPasteboardClientIsOwner), false, wxT("client couldn't own clipboard") );