- bool success = wxSetClipboardData(wxDF_METAFILE, this, width,height);
- if (!alreadyOpen) wxCloseClipboard();
- return (bool) success;
- */
- return TRUE ;
+
+ wxDataObject *data = new wxMetafileDataObject( *this );
+ success = wxTheClipboard->SetData( data );
+ if (!alreadyOpen)
+ wxTheClipboard->Close();
+#endif
+
+ return success;
+}
+
+void wxMetafile::SetHMETAFILE(WXHMETAFILE mf)
+{
+ UnRef();
+
+ m_refData = new wxMetafileRefData;
+
+ M_METAFILEDATA->m_metafile = (PicHandle)mf;
+
+#if wxMAC_USE_CORE_GRAPHICS
+ size_t sz = GetHandleSize( (Handle) M_METAFILEDATA->m_metafile );
+ wxMemoryBuffer* membuf = new wxMemoryBuffer( sz );
+ void *data = membuf->GetWriteBuf( sz );
+
+ memcpy( data, *M_METAFILEDATA->m_metafile, sz );
+ membuf->UngetWriteBuf( sz );
+ CGDataProviderRef provider = CGDataProviderCreateWithData(
+ membuf, data, sz, wxMacMemoryBufferReleaseProc );
+ M_METAFILEDATA->m_qdPictRef = NULL;
+
+#ifndef __LP64__
+ if (provider != NULL)
+ {
+ M_METAFILEDATA->m_qdPictRef = QDPictCreateWithProvider( provider );
+ CGDataProviderRelease( provider );
+ }
+#endif
+#endif