]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/metafile.h
function HasValue() added
[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$
8// Copyright: (c) Julian Smart and Markus Holzem
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12
13#ifndef __METAFIILEH__
14#define __METAFIILEH__
15
16#ifdef __GNUG__
17#pragma interface "metafile.h"
18#endif
19
20#include "wx/setup.h"
21
22#if USE_METAFILE
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);
74 virtual void GetTextExtent(const wxString& string, float *x, float *y,
75 float *descent = NULL, float *externalLeading = NULL,
76 wxFont *theFont = NULL, bool use16bit = FALSE);
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
102#endif // USE_METAFILE
103#endif
104 // __METAFIILEH__