wxWidgets/include/wx/msw/metafile.h
Julian Smart 7f555861b7 Made wxStubs compile on Unix.
Improvements to doc/view on MDI, including multiple menus for wxFileHistory.
Added wxDirExists to wxMSW; moved wxMatchWild to filefn.cpp


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@740 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
1998-09-16 21:52:23 +00:00

105 lines
3.1 KiB
C++

/////////////////////////////////////////////////////////////////////////////
// Name: metafile.h
// Purpose: wxMetaFile, wxMetaFileDC classes
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_METAFIILE_H_
#define _WX_METAFIILE_H_
#ifdef __GNUG__
#pragma interface "metafile.h"
#endif
#include "wx/setup.h"
#if USE_METAFILE
#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);
virtual void GetTextExtent(const wxString& string, long *x, long *y,
long *descent = NULL, long *externalLeading = NULL,
wxFont *theFont = NULL, bool use16bit = FALSE) const;
// 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);
#endif // USE_METAFILE
#endif
// _WX_METAFIILE_H_