X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/888dde65f43d5f57e8fb2028b27191cca1741403..5c7b506103cfc078a821860766e31c47d595e07f:/src/mac/carbon/metafile.cpp diff --git a/src/mac/carbon/metafile.cpp b/src/mac/carbon/metafile.cpp index a82cf5bfd0..73d5b77f9a 100644 --- a/src/mac/carbon/metafile.cpp +++ b/src/mac/carbon/metafile.cpp @@ -37,17 +37,25 @@ IMPLEMENT_ABSTRACT_CLASS(wxMetafileDCImpl, wxGCDCImpl) #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; } @@ -83,7 +91,7 @@ wxMetafileRefData::wxMetafileRefData( const wxString& filename ) if ( !filename.empty() ) { - wxCFRef cfMutableString(CFStringCreateMutableCopy(NULL, 0, wxMacCFStringHolder(filename))); + wxCFRef cfMutableString(CFStringCreateMutableCopy(NULL, 0, wxCFStringRef(filename))); CFStringNormalize(cfMutableString,kCFStringNormalizationFormD); wxCFRef url(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfMutableString , kCFURLPOSIXPathStyle, false)); m_pdfDoc.reset(CGPDFDocumentCreateWithURL(url)); @@ -162,9 +170,14 @@ wxMetaFile::~wxMetaFile() { } -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