]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/metafile.h
wxMotif::wxFont supports encodings too (and shares 99% of font code with wxGTK)
[wxWidgets.git] / include / wx / os2 / metafile.h
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 #include "wx/dc.h"
24
25 /*
26 * Metafile and metafile device context classes - work in Windows 3.1 only
27 *
28 */
29
30 class WXDLLEXPORT wxDC;
31 class WXDLLEXPORT wxMetaFile: public wxObject
32 {
33 DECLARE_DYNAMIC_CLASS(wxMetaFile)
34 public:
35 wxMetaFile(const wxString& file = "");
36 ~wxMetaFile();
37
38 // After this is called, the metafile cannot be used for anything
39 // since it is now owned by the clipboard.
40 virtual bool SetClipboard(int width = 0, int height = 0);
41
42 virtual bool Play(wxDC *dc);
43 // TODO
44 inline bool Ok() { return FALSE; };
45
46 /* TODO: Implementation
47 inline WXHANDLE GetHMETAFILE() { return m_metaFile; }
48 inline void SetHMETAFILE(WXHANDLE mf) { m_metaFile = mf; }
49
50 protected:
51 WXHANDLE m_metaFile;
52 */
53 };
54
55 class WXDLLEXPORT wxMetaFileDC: public wxDC
56 {
57 DECLARE_DYNAMIC_CLASS(wxMetaFileDC)
58
59 public:
60 // Don't supply origin and extent
61 // Supply them to wxMakeMetaFilePlaceable instead.
62 wxMetaFileDC(const wxString& file = "");
63
64 // Supply origin and extent (recommended).
65 // Then don't need to supply them to wxMakeMetaFilePlaceable.
66 wxMetaFileDC(const wxString& file, int xext, int yext, int xorg, int yorg);
67
68 ~wxMetaFileDC();
69
70 // Should be called at end of drawing
71 virtual wxMetaFile *Close();
72 virtual void SetMapMode(int mode);
73 virtual void GetTextExtent(const wxString& string, float *x, float *y,
74 float *descent = NULL, float *externalLeading = NULL,
75 wxFont *theFont = NULL, bool use16bit = FALSE);
76
77 // Implementation
78 inline wxMetaFile *GetMetaFile() { return m_metaFile; }
79 inline void SetMetaFile(wxMetaFile *mf) { m_metaFile = mf; }
80 inline int GetWindowsMappingMode() { return m_windowsMappingMode; }
81 inline void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; }
82
83 protected:
84 int m_windowsMappingMode;
85 wxMetaFile *m_metaFile;
86 };
87
88 /*
89 * Pass filename of existing non-placeable metafile, and bounding box.
90 * Adds a placeable metafile header, sets the mapping mode to anisotropic,
91 * and sets the window origin and extent to mimic the wxMM_TEXT mapping mode.
92 *
93 */
94
95 // No origin or extent
96 bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, float scale = 1.0);
97
98 // Optional origin and extent
99 bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0, bool useOriginAndExtent = TRUE);
100
101 #endif
102 // _WX_METAFIILE_H_