]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/metafile.h
Added Win95 implementation of OutputDebugString; added to wxVariant class
[wxWidgets.git] / include / wx / msw / metafile.h
CommitLineData
2bda0e17
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: metafile.h
3// Purpose: wxMetaFile, wxMetaFileDC classes
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
bbcdf8bc
JS
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
12
bbcdf8bc
JS
13#ifndef _WX_METAFIILE_H_
14#define _WX_METAFIILE_H_
2bda0e17
KB
15
16#ifdef __GNUG__
17#pragma interface "metafile.h"
18#endif
19
20#include "wx/setup.h"
21
47d67540 22#if wxUSE_METAFILE
2bda0e17
KB
23#include "wx/dc.h"
24
25/*
26 * Metafile and metafile device context classes - work in Windows 3.1 only
27 *
28 */
29
30class WXDLLEXPORT wxDC;
31class WXDLLEXPORT wxMetaFile: public wxObject
32{
33 DECLARE_DYNAMIC_CLASS(wxMetaFile)
34 public:
35 wxMetaFile(const wxString& file = "");
36 ~wxMetaFile(void);
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 inline bool Ok(void) { return m_metaFile != 0; };
44
45 // Implementation
46 inline WXHANDLE GetHMETAFILE(void) { return m_metaFile; }
47 inline void SetHMETAFILE(WXHANDLE mf) { m_metaFile = mf; }
48 inline int GetWindowsMappingMode(void) { return m_windowsMappingMode; }
49 inline void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; }
50
51protected:
52 WXHANDLE m_metaFile;
53 int m_windowsMappingMode;
54};
55
56class WXDLLEXPORT wxMetaFileDC: public wxDC
57{
58 DECLARE_DYNAMIC_CLASS(wxMetaFileDC)
59
60 public:
61 // Don't supply origin and extent
62 // Supply them to wxMakeMetaFilePlaceable instead.
63 wxMetaFileDC(const wxString& file = "");
64
65 // Supply origin and extent (recommended).
66 // Then don't need to supply them to wxMakeMetaFilePlaceable.
67 wxMetaFileDC(const wxString& file, int xext, int yext, int xorg, int yorg);
68
69 ~wxMetaFileDC(void);
70
71 // Should be called at end of drawing
72 virtual wxMetaFile *Close(void);
73 virtual void SetMapMode(int mode);
7f555861
JS
74 virtual void GetTextExtent(const wxString& string, long *x, long *y,
75 long *descent = NULL, long *externalLeading = NULL,
76 wxFont *theFont = NULL, bool use16bit = FALSE) const;
2bda0e17
KB
77
78 // Implementation
79 inline wxMetaFile *GetMetaFile(void) { return m_metaFile; }
80 inline void SetMetaFile(wxMetaFile *mf) { m_metaFile = mf; }
81 inline int GetWindowsMappingMode(void) { return m_windowsMappingMode; }
82 inline void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; }
83
84protected:
85 int m_windowsMappingMode;
86 wxMetaFile *m_metaFile;
87};
88
89/*
90 * Pass filename of existing non-placeable metafile, and bounding box.
91 * Adds a placeable metafile header, sets the mapping mode to anisotropic,
92 * and sets the window origin and extent to mimic the MM_TEXT mapping mode.
93 *
94 */
95
96// No origin or extent
97bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, float scale = 1.0);
98
99// Optional origin and extent
100bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0, bool useOriginAndExtent = TRUE);
101
47d67540 102#endif // wxUSE_METAFILE
2bda0e17 103#endif
bbcdf8bc 104 // _WX_METAFIILE_H_