]> git.saurik.com Git - wxWidgets.git/blame - include/wx/palmos/enhmeta.h
nested iterator classes must be dll-exported
[wxWidgets.git] / include / wx / palmos / enhmeta.h
CommitLineData
ffecfa5a
JS
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/palmos/enhmeta.h
4055ed82 3// Purpose: wxEnhMetaFile class for PalmOS
e1d63b79 4// Author: William Osborne - minimal working wxPalmOS port
ffecfa5a
JS
5// Modified by:
6// Created: 10/13/04
e1d63b79 7// RCS-ID: $Id$
ffecfa5a
JS
8// Copyright: (c) William Osborne
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_PALMOS_ENHMETA_H_
13#define _WX_PALMOS_ENHMETA_H_
14
ffecfa5a
JS
15#include "wx/dc.h"
16
17#if wxUSE_DRAG_AND_DROP
18 #include "wx/dataobj.h"
19#endif
20
21// ----------------------------------------------------------------------------
22// wxEnhMetaFile: encapsulation of Win32 HENHMETAFILE
23// ----------------------------------------------------------------------------
24
25class WXDLLEXPORT wxEnhMetaFile : public wxObject
26{
27public:
28 wxEnhMetaFile(const wxString& file = wxEmptyString) : m_filename(file)
29 { Init(); }
30 wxEnhMetaFile(const wxEnhMetaFile& metafile)
31 { Init(); Assign(metafile); }
32 wxEnhMetaFile& operator=(const wxEnhMetaFile& metafile)
33 { Free(); Assign(metafile); return *this; }
34
35 virtual ~wxEnhMetaFile()
36 { Free(); }
37
38 // display the picture stored in the metafile on the given DC
39 bool Play(wxDC *dc, wxRect *rectBound = (wxRect *)NULL);
40
41 // accessors
42 bool Ok() const { return m_hMF != 0; }
43
44 wxSize GetSize() const;
45 int GetWidth() const { return GetSize().x; }
46 int GetHeight() const { return GetSize().y; }
47
48 const wxString& GetFileName() const { return m_filename; }
49
50 // copy the metafile to the clipboard: the width and height parameters are
51 // for backwards compatibility (with wxMetaFile) only, they are ignored by
52 // this method
53 bool SetClipboard(int width = 0, int height = 0);
54
55 // implementation
56 WXHANDLE GetHENHMETAFILE() const { return m_hMF; }
57 void SetHENHMETAFILE(WXHANDLE hMF) { Free(); m_hMF = hMF; }
58
59protected:
60 void Init() { m_hMF = 0; }
61 void Free();
62 void Assign(const wxEnhMetaFile& mf);
63
64private:
65 wxString m_filename;
66 WXHANDLE m_hMF;
67
68 DECLARE_DYNAMIC_CLASS(wxEnhMetaFile)
69};
70
71// ----------------------------------------------------------------------------
72// wxEnhMetaFileDC: allows to create a wxEnhMetaFile
73// ----------------------------------------------------------------------------
74
75class WXDLLEXPORT wxEnhMetaFileDC : public wxDC
76{
77public:
78 // the ctor parameters specify the filename (empty for memory metafiles),
79 // the metafile picture size and the optional description/comment
80 wxEnhMetaFileDC(const wxString& filename = wxEmptyString,
81 int width = 0, int height = 0,
82 const wxString& description = wxEmptyString);
83
84 virtual ~wxEnhMetaFileDC();
85
86 // obtain a pointer to the new metafile (caller should delete it)
87 wxEnhMetaFile *Close();
88
89private:
90 DECLARE_DYNAMIC_CLASS_NO_COPY(wxEnhMetaFileDC)
91};
92
93#if wxUSE_DRAG_AND_DROP
94
95// ----------------------------------------------------------------------------
96// wxEnhMetaFileDataObject is a specialization of wxDataObject for enh metafile
97// ----------------------------------------------------------------------------
98
99// notice that we want to support both CF_METAFILEPICT and CF_ENHMETAFILE and
100// so we derive from wxDataObject and not from wxDataObjectSimple
101class WXDLLEXPORT wxEnhMetaFileDataObject : public wxDataObject
102{
103public:
104 // ctors
105 wxEnhMetaFileDataObject() { }
106 wxEnhMetaFileDataObject(const wxEnhMetaFile& metafile)
107 : m_metafile(metafile) { }
108
109 // virtual functions which you may override if you want to provide data on
110 // demand only - otherwise, the trivial default versions will be used
111 virtual void SetMetafile(const wxEnhMetaFile& metafile)
112 { m_metafile = metafile; }
113 virtual wxEnhMetaFile GetMetafile() const
114 { return m_metafile; }
115
116 // implement base class pure virtuals
117 virtual wxDataFormat GetPreferredFormat(Direction dir) const;
118 virtual size_t GetFormatCount(Direction dir) const;
119 virtual void GetAllFormats(wxDataFormat *formats, Direction dir) const;
120 virtual size_t GetDataSize(const wxDataFormat& format) const;
121 virtual bool GetDataHere(const wxDataFormat& format, void *buf) const;
122 virtual bool SetData(const wxDataFormat& format, size_t len,
123 const void *buf);
124
125protected:
126 wxEnhMetaFile m_metafile;
127
128 DECLARE_NO_COPY_CLASS(wxEnhMetaFileDataObject)
129};
130
131
132// ----------------------------------------------------------------------------
133// wxEnhMetaFileSimpleDataObject does derive from wxDataObjectSimple which
134// makes it more convenient to use (it can be used with wxDataObjectComposite)
135// at the price of not supoprting any more CF_METAFILEPICT but only
136// CF_ENHMETAFILE
137// ----------------------------------------------------------------------------
138
139class WXDLLEXPORT wxEnhMetaFileSimpleDataObject : public wxDataObjectSimple
140{
141public:
142 // ctors
143 wxEnhMetaFileSimpleDataObject() : wxDataObjectSimple(wxDF_ENHMETAFILE) { }
144 wxEnhMetaFileSimpleDataObject(const wxEnhMetaFile& metafile)
145 : wxDataObjectSimple(wxDF_ENHMETAFILE), m_metafile(metafile) { }
146
147 // virtual functions which you may override if you want to provide data on
148 // demand only - otherwise, the trivial default versions will be used
149 virtual void SetEnhMetafile(const wxEnhMetaFile& metafile)
150 { m_metafile = metafile; }
151 virtual wxEnhMetaFile GetEnhMetafile() const
152 { return m_metafile; }
153
154 // implement base class pure virtuals
155 virtual size_t GetDataSize() const;
156 virtual bool GetDataHere(void *buf) const;
157 virtual bool SetData(size_t len, const void *buf);
158
159 virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const
160 { return GetDataSize(); }
161 virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format),
162 void *buf) const
163 { return GetDataHere(buf); }
164 virtual bool SetData(const wxDataFormat& WXUNUSED(format),
165 size_t len, const void *buf)
166 { return SetData(len, buf); }
167
168protected:
169 wxEnhMetaFile m_metafile;
170
171 DECLARE_NO_COPY_CLASS(wxEnhMetaFileSimpleDataObject)
172};
173
174#endif // wxUSE_DRAG_AND_DROP
175
176#endif // _WX_PALMOS_ENHMETA_H_