]> git.saurik.com Git - wxWidgets.git/blame - include/wx/palmos/metafile.h
Fix compilation of wxIconBundle in some particular minimal builds.
[wxWidgets.git] / include / wx / palmos / metafile.h
CommitLineData
ffecfa5a
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/palmos/metafile.h
3// Purpose: wxMetaFile, wxMetaFileDC and wxMetaFileDataObject classes
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_METAFIILE_H_
13#define _WX_METAFIILE_H_
14
ffecfa5a
JS
15#include "wx/dc.h"
16#include "wx/gdiobj.h"
17
18#if wxUSE_DRAG_AND_DROP
19 #include "wx/dataobj.h"
20#endif
21
22// ----------------------------------------------------------------------------
23// Metafile and metafile device context classes
24// ----------------------------------------------------------------------------
25
b5dbe15d 26class WXDLLIMPEXP_FWD_CORE wxMetafile;
ffecfa5a 27
53a2db12 28class WXDLLIMPEXP_CORE wxMetafileRefData: public wxGDIRefData
ffecfa5a 29{
ffecfa5a
JS
30public:
31 wxMetafileRefData();
d3c7fc99 32 virtual ~wxMetafileRefData();
ffecfa5a 33
8f884a0d
VZ
34 virtual bool IsOk() const { return m_metafile != 0; }
35
ffecfa5a
JS
36public:
37 WXHANDLE m_metafile;
38 int m_windowsMappingMode;
39 int m_width, m_height;
8f884a0d
VZ
40
41 friend class WXDLLIMPEXP_FWD_CORE wxMetafile;
ffecfa5a
JS
42};
43
44#define M_METAFILEDATA ((wxMetafileRefData *)m_refData)
45
53a2db12 46class WXDLLIMPEXP_CORE wxMetafile: public wxGDIObject
ffecfa5a
JS
47{
48public:
49 wxMetafile(const wxString& file = wxEmptyString);
ffecfa5a
JS
50 virtual ~wxMetafile();
51
52 // After this is called, the metafile cannot be used for anything
53 // since it is now owned by the clipboard.
54 virtual bool SetClipboard(int width = 0, int height = 0);
55
56 virtual bool Play(wxDC *dc);
ffecfa5a
JS
57
58 // set/get the size of metafile for clipboard operations
59 wxSize GetSize() const { return wxSize(GetWidth(), GetHeight()); }
60 int GetWidth() const { return M_METAFILEDATA->m_width; }
61 int GetHeight() const { return M_METAFILEDATA->m_height; }
62
63 void SetWidth(int width) { M_METAFILEDATA->m_width = width; }
64 void SetHeight(int height) { M_METAFILEDATA->m_height = height; }
65
66 // Implementation
67 WXHANDLE GetHMETAFILE() const { return M_METAFILEDATA->m_metafile; }
68 void SetHMETAFILE(WXHANDLE mf) ;
69 int GetWindowsMappingMode() const { return M_METAFILEDATA->m_windowsMappingMode; }
70 void SetWindowsMappingMode(int mm);
71
ffecfa5a
JS
72private:
73 DECLARE_DYNAMIC_CLASS(wxMetafile)
74};
75
53a2db12 76class WXDLLIMPEXP_CORE wxMetafileDC: public wxDC
ffecfa5a
JS
77{
78public:
79 // Don't supply origin and extent
80 // Supply them to wxMakeMetaFilePlaceable instead.
81 wxMetafileDC(const wxString& file = wxEmptyString);
82
83 // Supply origin and extent (recommended).
84 // Then don't need to supply them to wxMakeMetaFilePlaceable.
85 wxMetafileDC(const wxString& file, int xext, int yext, int xorg, int yorg);
86
87 virtual ~wxMetafileDC();
88
89 // Should be called at end of drawing
90 virtual wxMetafile *Close();
89efaf2b 91 virtual void SetMapMode(wxMappingMode mode);
ffecfa5a
JS
92 virtual void GetTextExtent(const wxString& string, long *x, long *y,
93 long *descent = NULL, long *externalLeading = NULL,
c94f845b 94 const wxFont *theFont = NULL, bool use16bit = FALSE) const;
ffecfa5a
JS
95
96 // Implementation
97 wxMetafile *GetMetaFile() const { return m_metaFile; }
98 void SetMetaFile(wxMetafile *mf) { m_metaFile = mf; }
99 int GetWindowsMappingMode() const { return m_windowsMappingMode; }
100 void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; }
101
102protected:
103 int m_windowsMappingMode;
104 wxMetafile* m_metaFile;
105
106private:
107 DECLARE_DYNAMIC_CLASS(wxMetafileDC)
108};
109
110/*
111 * Pass filename of existing non-placeable metafile, and bounding box.
112 * Adds a placeable metafile header, sets the mapping mode to anisotropic,
113 * and sets the window origin and extent to mimic the wxMM_TEXT mapping mode.
114 *
115 */
116
117// No origin or extent
53a2db12 118bool WXDLLIMPEXP_CORE wxMakeMetafilePlaceable(const wxString& filename, float scale = 1.0);
ffecfa5a
JS
119
120// Optional origin and extent
53a2db12 121bool WXDLLIMPEXP_CORE wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0, bool useOriginAndExtent = TRUE);
ffecfa5a
JS
122
123// ----------------------------------------------------------------------------
124// wxMetafileDataObject is a specialization of wxDataObject for metafile data
125// ----------------------------------------------------------------------------
126
127#if wxUSE_DRAG_AND_DROP
128
53a2db12 129class WXDLLIMPEXP_CORE wxMetafileDataObject : public wxDataObjectSimple
ffecfa5a
JS
130{
131public:
132 // ctors
133 wxMetafileDataObject() : wxDataObjectSimple(wxDF_METAFILE)
134 { }
135 wxMetafileDataObject(const wxMetafile& metafile)
136 : wxDataObjectSimple(wxDF_METAFILE), m_metafile(metafile) { }
137
138 // virtual functions which you may override if you want to provide data on
139 // demand only - otherwise, the trivial default versions will be used
140 virtual void SetMetafile(const wxMetafile& metafile)
141 { m_metafile = metafile; }
142 virtual wxMetafile GetMetafile() const
143 { return m_metafile; }
144
145 // implement base class pure virtuals
146 virtual size_t GetDataSize() const;
147 virtual bool GetDataHere(void *buf) const;
148 virtual bool SetData(size_t len, const void *buf);
149
150protected:
151 wxMetafile m_metafile;
152};
153
154#endif // wxUSE_DRAG_AND_DROP
155
ffecfa5a
JS
156#endif
157 // _WX_METAFIILE_H_
158