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