]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/metafile.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxMetaFile, wxMetaFileDC classes
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #ifndef _WX_METAFIILE_H_
14 #define _WX_METAFIILE_H_
17 #pragma interface "metafile.h"
26 * Metafile and metafile device context classes - work in Windows 3.1 only
30 class WXDLLEXPORT wxDC
;
31 class WXDLLEXPORT wxMetaFile
: public wxObject
33 DECLARE_DYNAMIC_CLASS(wxMetaFile
)
35 wxMetaFile(const wxString
& file
= "");
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);
42 virtual bool Play(wxDC
*dc
);
43 inline bool Ok(void) { return m_metaFile
!= 0; };
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
; }
53 int m_windowsMappingMode
;
56 class WXDLLEXPORT wxMetaFileDC
: public wxDC
58 DECLARE_DYNAMIC_CLASS(wxMetaFileDC
)
61 // Don't supply origin and extent
62 // Supply them to wxMakeMetaFilePlaceable instead.
63 wxMetaFileDC(const wxString
& file
= "");
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
);
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
);
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
; }
85 int m_windowsMappingMode
;
86 wxMetaFile
*m_metaFile
;
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.
96 // No origin or extent
97 bool WXDLLEXPORT
wxMakeMetaFilePlaceable(const wxString
& filename
, float scale
= 1.0);
99 // Optional origin and extent
100 bool WXDLLEXPORT
wxMakeMetaFilePlaceable(const wxString
& filename
, int x1
, int y1
, int x2
, int y2
, float scale
= 1.0, bool useOriginAndExtent
= TRUE
);
102 #endif // USE_METAFILE