]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/metafile.h
A few tweaks and cleanups
[wxWidgets.git] / include / wx / motif / metafile.h
CommitLineData
9b6dbb09
JS
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
9b6dbb09
JS
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/*
83df96d6
JS
24* Metafile and metafile device context classes - work in Windows 3.1 only
25*
26*/
9b6dbb09
JS
27
28class WXDLLEXPORT wxDC;
29class WXDLLEXPORT wxMetaFile: public wxObject
30{
83df96d6
JS
31 DECLARE_DYNAMIC_CLASS(wxMetaFile)
32public:
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
9b6dbb09
JS
44};
45
46class WXDLLEXPORT wxMetaFileDC: public wxDC
47{
83df96d6
JS
48 DECLARE_DYNAMIC_CLASS(wxMetaFileDC)
49
50public:
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
9b6dbb09 74protected:
83df96d6
JS
75 int m_windowsMappingMode;
76 wxMetaFile *m_metaFile;
9b6dbb09
JS
77};
78
79/*
83df96d6
JS
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*/
9b6dbb09
JS
85
86// No origin or extent
87bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, float scale = 1.0);
88
89// Optional origin and extent
90bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0, bool useOriginAndExtent = TRUE);
91
92#endif
83df96d6 93// _WX_METAFIILE_H_