]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/metafile.h
1 /////////////////////////////////////////////////////////////////////////////
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
10 // Copyright: (c) Julian Smart
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
14 #ifndef _WX_METAFIILE_H_
15 #define _WX_METAFIILE_H_
18 #pragma interface "metafile.h"
24 * Metafile and metafile device context classes - work in Windows 3.1 only
28 class WXDLLEXPORT wxDC
;
29 class WXDLLEXPORT wxMetaFile
: public wxObject
31 DECLARE_DYNAMIC_CLASS(wxMetaFile
)
33 wxMetaFile(const wxString
& file
= "");
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);
40 virtual bool Play(wxDC
*dc
);
42 inline bool Ok() { return FALSE
; };
46 class WXDLLEXPORT wxMetaFileDC
: public wxDC
48 DECLARE_DYNAMIC_CLASS(wxMetaFileDC
)
51 // Don't supply origin and extent
52 // Supply them to wxMakeMetaFilePlaceable instead.
53 wxMetaFileDC(const wxString
& file
= "");
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
);
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
);
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
; }
75 int m_windowsMappingMode
;
76 wxMetaFile
*m_metaFile
;
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.
86 // No origin or extent
87 bool WXDLLEXPORT
wxMakeMetaFilePlaceable(const wxString
& filename
, float scale
= 1.0);
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
);