X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/662899dd606f8845fc99453f999104b90c19c8bb..76c718091a4c73054ecf2272ccea60f5e9569e9a:/include/wx/mac/metafile.h?ds=sidebyside diff --git a/include/wx/mac/metafile.h b/include/wx/mac/metafile.h index aaa535b3fa..bbf8e54117 100644 --- a/include/wx/mac/metafile.h +++ b/include/wx/mac/metafile.h @@ -3,12 +3,12 @@ // Purpose: wxMetaFile, wxMetaFileDC classes. // This probably should be restricted to Windows platforms, // but if there is an equivalent on your platform, great. -// Author: AUTHOR +// Author: Stefan Csomor // Modified by: -// Created: ??/??/98 +// Created: 1998-01-01 // RCS-ID: $Id$ -// Copyright: (c) AUTHOR -// Licence: wxWindows licence +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -19,7 +19,7 @@ #include "wx/dc.h" #include "wx/gdiobj.h" -#if wxUSE_DRAG_AND_DROP +#if wxUSE_DATAOBJ #include "wx/dataobj.h" #endif @@ -41,7 +41,7 @@ public: ~wxMetafileRefData(void); public: - PicHandle m_metafile; + WXHMETAFILE m_metafile; }; #define M_METAFILEDATA ((wxMetafileRefData *)m_refData) @@ -51,10 +51,11 @@ class WXDLLEXPORT wxMetafile: public wxGDIObject DECLARE_DYNAMIC_CLASS(wxMetafile) public: // Copy constructor - inline wxMetafile(const wxMetafile& metafile) + wxMetafile(const wxMetafile& metafile) + : wxGDIObject() { Ref(metafile); } - wxMetafile(const wxString& file = ""); + wxMetafile(const wxString& file = wxEmptyString); ~wxMetafile(void); // After this is called, the metafile cannot be used for anything @@ -65,8 +66,8 @@ class WXDLLEXPORT wxMetafile: public wxGDIObject inline bool Ok(void) const { return (M_METAFILEDATA && (M_METAFILEDATA->m_metafile != 0)); }; // Implementation - inline PicHandle GetHMETAFILE(void) { return M_METAFILEDATA->m_metafile; } - void SetHMETAFILE(PicHandle mf) ; + inline WXHMETAFILE GetHMETAFILE(void) { return M_METAFILEDATA->m_metafile; } + void SetHMETAFILE(WXHMETAFILE mf) ; // Operators inline wxMetafile& operator = (const wxMetafile& metafile) { if (*this == metafile) return (*this); Ref(metafile); return *this; } @@ -83,7 +84,7 @@ class WXDLLEXPORT wxMetafileDC: public wxDC public: // Don't supply origin and extent // Supply them to wxMakeMetaFilePlaceable instead. - wxMetafileDC(const wxString& file = ""); + wxMetafileDC(const wxString& file = wxEmptyString); // Supply origin and extent (recommended). // Then don't need to supply them to wxMakeMetaFilePlaceable. @@ -121,38 +122,29 @@ bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y // ---------------------------------------------------------------------------- #if wxUSE_DATAOBJ -class WXDLLEXPORT wxMetafileDataObject : public wxDataObject +class WXDLLEXPORT wxMetafileDataObject : public wxDataObjectSimple { public: // ctors - wxMetafileDataObject() { m_width = 0; m_height = 0; }; - wxMetafileDataObject(const wxMetafile& metafile, int width = 0, int height = 0): - m_metafile(metafile), m_width(width), m_height(height) { } - - void SetMetafile(const wxMetafile& metafile, int w = 0, int h = 0) - { m_metafile = metafile; m_width = w; m_height = h; } - wxMetafile GetMetafile() const { return m_metafile; } - int GetWidth() const { return m_width; } - int GetHeight() const { return m_height; } - - virtual wxDataFormat GetFormat() const { return wxDF_METAFILE; } - -/* ?? - // implement base class pure virtuals - virtual wxDataFormat GetPreferredFormat() const - { return (wxDataFormat) wxDataObject::Text; } - virtual bool IsSupportedFormat(wxDataFormat format) const - { return format == wxDataObject::Text || format == wxDataObject::Locale; } - virtual size_t GetDataSize() const - { return m_strText.Len() + 1; } // +1 for trailing '\0'of course - virtual void GetDataHere(void *pBuf) const - { memcpy(pBuf, m_strText.c_str(), GetDataSize()); } -*/ - -private: + wxMetafileDataObject() + : wxDataObjectSimple(wxDF_METAFILE) { }; + wxMetafileDataObject(const wxMetafile& metafile) + : wxDataObjectSimple(wxDF_METAFILE), m_metafile(metafile) { } + + // virtual functions which you may override if you want to provide data on + // demand only - otherwise, the trivial default versions will be used + virtual void SetMetafile(const wxMetafile& metafile) + { m_metafile = metafile; } + virtual wxMetafile GetMetafile() const + { return m_metafile; } + + // implement base class pure virtuals + virtual size_t GetDataSize() const; + virtual bool GetDataHere(void *buf) const; + virtual bool SetData(size_t len, const void *buf); + +protected: wxMetafile m_metafile; - int m_width; - int m_height; }; #endif