+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; }
+ int GetHeight() const { return m_height; }
+
+ CGPDFDocumentRef GetPDFDocument() const { return m_pdfDoc; }
+ void UpdateDocumentFromData() ;
+
+ const wxCFDataRef& GetData() const { return m_data; }
+ CGContextRef GetContext() const { return m_context; }
+
+ // ends the recording
+ void Close();
+private:
+ wxCFDataRef m_data;
+ wxCFRef<CGPDFDocumentRef> m_pdfDoc;
+ CGContextRef m_context;
+
+ int m_width ;
+ int m_height ;
+};
+
+wxMetafileRefData::wxMetafileRefData(CFDataRef data) :
+ m_data(data)
+{
+ Init();
+ UpdateDocumentFromData();