#define M_METAFILEREFDATA( a ) ((wxMetafileRefData*)(a).GetRefData())
-class wxMetafileRefData: public wxGDIRefData
+class wxMetafileRefData : public wxGDIRefData
{
public:
+ // default ctor needed for CreateGDIRefData(), must be initialized later
+ wxMetafileRefData() { Init(); }
+
// creates a metafile from memory, assumes ownership
wxMetafileRefData(CFDataRef data);
+
// prepares a recording metafile
wxMetafileRefData( int width, int height);
+
// prepares a metafile to be read from a file (if filename is not empty)
wxMetafileRefData( const wxString& filename);
+
virtual ~wxMetafileRefData();
+ virtual bool IsOk() const { return m_data != NULL; }
+
void Init();
int GetWidth() const { return m_width; }
if ( !filename.empty() )
{
- wxCFRef<CFMutableStringRef> cfMutableString(CFStringCreateMutableCopy(NULL, 0, wxMacCFStringHolder(filename)));
+ wxCFRef<CFMutableStringRef> cfMutableString(CFStringCreateMutableCopy(NULL, 0, wxCFStringRef(filename)));
CFStringNormalize(cfMutableString,kCFStringNormalizationFormD);
wxCFRef<CFURLRef> url(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfMutableString , kCFURLPOSIXPathStyle, false));
m_pdfDoc.reset(CGPDFDocumentCreateWithURL(url));
{
}
-bool wxMetaFile::IsOk() const
+wxGDIRefData *wxMetaFile::CreateGDIRefData() const
+{
+ return new wxMetafileRefData;
+}
+
+wxGDIRefData *wxMetaFile::CloneGDIRefData(const wxGDIRefData *data) const
{
- return (M_METAFILEDATA && (M_METAFILEDATA->GetData() != NULL));
+ return new wxMetafileRefData(*wx_static_cast(const wxMetafileRefData *, data));
}
WXHMETAFILE wxMetaFile::GetHMETAFILE() const