]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/metafile.h
Ignore.
[wxWidgets.git] / include / wx / motif / 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: Julian Smart
7 // Modified by:
8 // Created: 17/09/98
9 // RCS-ID: $Id$
10 // Copyright: (c) Julian Smart
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 // TODO
43 inline bool Ok() { return FALSE; };
44
45 /* TODO: Implementation
46 inline WXHANDLE GetHMETAFILE() { return m_metaFile; }
47 inline void SetHMETAFILE(WXHANDLE mf) { m_metaFile = mf; }
48
49 protected:
50 WXHANDLE m_metaFile;
51 */
52 };
53
54 class WXDLLEXPORT wxMetaFileDC: public wxDC
55 {
56 DECLARE_DYNAMIC_CLASS(wxMetaFileDC)
57
58 public:
59 // Don't supply origin and extent
60 // Supply them to wxMakeMetaFilePlaceable instead.
61 wxMetaFileDC(const wxString& file = "");
62
63 // Supply origin and extent (recommended).
64 // Then don't need to supply them to wxMakeMetaFilePlaceable.
65 wxMetaFileDC(const wxString& file, int xext, int yext, int xorg, int yorg);
66
67 ~wxMetaFileDC();
68
69 // Should be called at end of drawing
70 virtual wxMetaFile *Close();
71 virtual void SetMapMode(int mode);
72 virtual void GetTextExtent(const wxString& string, float *x, float *y,
73 float *descent = NULL, float *externalLeading = NULL,
74 wxFont *theFont = NULL, bool use16bit = FALSE);
75
76 // Implementation
77 inline wxMetaFile *GetMetaFile() { return m_metaFile; }
78 inline void SetMetaFile(wxMetaFile *mf) { m_metaFile = mf; }
79 inline int GetWindowsMappingMode() { return m_windowsMappingMode; }
80 inline void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; }
81
82 protected:
83 int m_windowsMappingMode;
84 wxMetaFile *m_metaFile;
85 };
86
87 /*
88 * Pass filename of existing non-placeable metafile, and bounding box.
89 * Adds a placeable metafile header, sets the mapping mode to anisotropic,
90 * and sets the window origin and extent to mimic the wxMM_TEXT mapping mode.
91 *
92 */
93
94 // No origin or extent
95 bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, float scale = 1.0);
96
97 // Optional origin and extent
98 bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0, bool useOriginAndExtent = TRUE);
99
100 #endif
101 // _WX_METAFIILE_H_