1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: metafile.h
|
|
|
|
// Purpose: wxMetaFile, wxMetaFileDC classes
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
1998-08-07 19:52:45 -04:00
|
|
|
// Copyright: (c) Julian Smart
|
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
1998-08-07 19:52:45 -04:00
|
|
|
#ifndef _WX_METAFIILE_H_
|
|
|
|
#define _WX_METAFIILE_H_
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface "metafile.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/setup.h"
|
|
|
|
|
1998-09-25 09:28:52 -04:00
|
|
|
#if wxUSE_METAFILE
|
1998-05-20 10:12:05 -04:00
|
|
|
#include "wx/dc.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Metafile and metafile device context classes - work in Windows 3.1 only
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxDC;
|
|
|
|
class WXDLLEXPORT wxMetaFile: public wxObject
|
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxMetaFile)
|
|
|
|
public:
|
|
|
|
wxMetaFile(const wxString& file = "");
|
|
|
|
~wxMetaFile(void);
|
|
|
|
|
|
|
|
// After this is called, the metafile cannot be used for anything
|
|
|
|
// since it is now owned by the clipboard.
|
|
|
|
virtual bool SetClipboard(int width = 0, int height = 0);
|
|
|
|
|
|
|
|
virtual bool Play(wxDC *dc);
|
|
|
|
inline bool Ok(void) { return m_metaFile != 0; };
|
|
|
|
|
|
|
|
// Implementation
|
|
|
|
inline WXHANDLE GetHMETAFILE(void) { return m_metaFile; }
|
|
|
|
inline void SetHMETAFILE(WXHANDLE mf) { m_metaFile = mf; }
|
|
|
|
inline int GetWindowsMappingMode(void) { return m_windowsMappingMode; }
|
|
|
|
inline void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
WXHANDLE m_metaFile;
|
|
|
|
int m_windowsMappingMode;
|
|
|
|
};
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxMetaFileDC: public wxDC
|
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxMetaFileDC)
|
|
|
|
|
|
|
|
public:
|
|
|
|
// Don't supply origin and extent
|
|
|
|
// Supply them to wxMakeMetaFilePlaceable instead.
|
|
|
|
wxMetaFileDC(const wxString& file = "");
|
|
|
|
|
|
|
|
// Supply origin and extent (recommended).
|
|
|
|
// Then don't need to supply them to wxMakeMetaFilePlaceable.
|
|
|
|
wxMetaFileDC(const wxString& file, int xext, int yext, int xorg, int yorg);
|
|
|
|
|
|
|
|
~wxMetaFileDC(void);
|
|
|
|
|
|
|
|
// Should be called at end of drawing
|
|
|
|
virtual wxMetaFile *Close(void);
|
|
|
|
virtual void SetMapMode(int mode);
|
1998-09-16 17:52:23 -04:00
|
|
|
virtual void GetTextExtent(const wxString& string, long *x, long *y,
|
|
|
|
long *descent = NULL, long *externalLeading = NULL,
|
|
|
|
wxFont *theFont = NULL, bool use16bit = FALSE) const;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
// Implementation
|
|
|
|
inline wxMetaFile *GetMetaFile(void) { return m_metaFile; }
|
|
|
|
inline void SetMetaFile(wxMetaFile *mf) { m_metaFile = mf; }
|
|
|
|
inline int GetWindowsMappingMode(void) { return m_windowsMappingMode; }
|
|
|
|
inline void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int m_windowsMappingMode;
|
|
|
|
wxMetaFile *m_metaFile;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Pass filename of existing non-placeable metafile, and bounding box.
|
|
|
|
* Adds a placeable metafile header, sets the mapping mode to anisotropic,
|
|
|
|
* and sets the window origin and extent to mimic the MM_TEXT mapping mode.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
// No origin or extent
|
|
|
|
bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, float scale = 1.0);
|
|
|
|
|
|
|
|
// Optional origin and extent
|
|
|
|
bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0, bool useOriginAndExtent = TRUE);
|
|
|
|
|
1998-09-25 09:28:52 -04:00
|
|
|
#endif // wxUSE_METAFILE
|
1998-05-20 10:12:05 -04:00
|
|
|
#endif
|
1998-08-07 19:52:45 -04:00
|
|
|
// _WX_METAFIILE_H_
|