]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: metafile.h | |
3 | // Purpose: wxMetaFile, wxMetaFileDC classes. | |
4 | // This probably should be restricted to Windows platforms, | |
5 | // but if there is an equivalent on your platform, great. | |
6 | // Author: AUTHOR | |
7 | // Modified by: | |
8 | // Created: ??/??/98 | |
9 | // RCS-ID: $Id$ | |
10 | // Copyright: (c) AUTHOR | |
11 | // Licence: wxWindows licence | |
12 | ///////////////////////////////////////////////////////////////////////////// | |
13 | ||
14 | ||
15 | #ifndef _WX_METAFIILE_H_ | |
16 | #define _WX_METAFIILE_H_ | |
17 | ||
18 | #ifdef __GNUG__ | |
19 | #pragma interface "metafile.h" | |
20 | #endif | |
21 | ||
22 | #include "wx/setup.h" | |
23 | ||
24 | /* | |
25 | * Metafile and metafile device context classes - work in Windows 3.1 only | |
26 | * | |
27 | */ | |
28 | ||
29 | class WXDLLEXPORT wxDC; | |
30 | class WXDLLEXPORT wxMetaFile: public wxObject | |
31 | { | |
32 | DECLARE_DYNAMIC_CLASS(wxMetaFile) | |
33 | public: | |
34 | wxMetaFile(const wxString& file = ""); | |
35 | ~wxMetaFile(); | |
36 | ||
37 | // After this is called, the metafile cannot be used for anything | |
38 | // since it is now owned by the clipboard. | |
39 | virtual bool SetClipboard(int width = 0, int height = 0); | |
40 | ||
41 | virtual bool Play(wxDC *dc); | |
42 | inline bool Ok() { return m_metaFile != 0; }; | |
43 | ||
44 | /* TODO: Implementation | |
45 | inline WXHANDLE GetHMETAFILE() { return m_metaFile; } | |
46 | inline void SetHMETAFILE(WXHANDLE mf) { m_metaFile = mf; } | |
47 | ||
48 | protected: | |
49 | WXHANDLE m_metaFile; | |
50 | */ | |
51 | }; | |
52 | ||
53 | class WXDLLEXPORT wxMetaFileDC: public wxDC | |
54 | { | |
55 | DECLARE_DYNAMIC_CLASS(wxMetaFileDC) | |
56 | ||
57 | public: | |
58 | // Don't supply origin and extent | |
59 | // Supply them to wxMakeMetaFilePlaceable instead. | |
60 | wxMetaFileDC(const wxString& file = ""); | |
61 | ||
62 | // Supply origin and extent (recommended). | |
63 | // Then don't need to supply them to wxMakeMetaFilePlaceable. | |
64 | wxMetaFileDC(const wxString& file, int xext, int yext, int xorg, int yorg); | |
65 | ||
66 | ~wxMetaFileDC(); | |
67 | ||
68 | // Should be called at end of drawing | |
69 | virtual wxMetaFile *Close(); | |
70 | virtual void SetMapMode(int mode); | |
71 | virtual void GetTextExtent(const wxString& string, float *x, float *y, | |
72 | float *descent = NULL, float *externalLeading = NULL, | |
73 | wxFont *theFont = NULL, bool use16bit = FALSE); | |
74 | ||
75 | // Implementation | |
76 | inline wxMetaFile *GetMetaFile() { return m_metaFile; } | |
77 | inline void SetMetaFile(wxMetaFile *mf) { m_metaFile = mf; } | |
78 | inline int GetWindowsMappingMode() { return m_windowsMappingMode; } | |
79 | inline void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; } | |
80 | ||
81 | protected: | |
82 | int m_windowsMappingMode; | |
83 | wxMetaFile *m_metaFile; | |
84 | }; | |
85 | ||
86 | /* | |
87 | * Pass filename of existing non-placeable metafile, and bounding box. | |
88 | * Adds a placeable metafile header, sets the mapping mode to anisotropic, | |
89 | * and sets the window origin and extent to mimic the MM_TEXT mapping mode. | |
90 | * | |
91 | */ | |
92 | ||
93 | // No origin or extent | |
94 | bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, float scale = 1.0); | |
95 | ||
96 | // Optional origin and extent | |
97 | bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0, bool useOriginAndExtent = TRUE); | |
98 | ||
99 | #endif | |
100 | // _WX_METAFIILE_H_ |