#if wxUSE_METAFILE
#ifndef WX_PRECOMP
-#include "wx/utils.h"
-#include "wx/app.h"
+ #include "wx/utils.h"
+ #include "wx/app.h"
#endif
#include "wx/metafile.h"
{
}
+wxGDIRefData *wxMetafile::CreateGDIRefData() const
+{
+ return new wxMetafileRefData;
+}
+
+wxGDIRefData *wxMetafile::CloneGDIRefData(const wxGDIRefData *data) const
+{
+ return new wxMetafileRefData(*static_cast<const wxMetafileRefData *>(data));
+}
+
bool wxMetafile::SetClipboard(int width, int height)
{
#if !wxUSE_CLIPBOARD
if (!alreadyOpen)
{
wxOpenClipboard();
- if (!wxEmptyClipboard()) return FALSE;
+ if (!wxEmptyClipboard()) return false;
}
bool success = wxSetClipboardData(wxDF_METAFILE, this, width,height);
if (!alreadyOpen) wxCloseClipboard();
bool wxMetafile::Play(wxDC *dc)
{
if (!m_refData)
- return FALSE;
-
- dc->BeginDrawing();
+ return false;
// if (dc->GetHDC() && M_METAFILEDATA->m_metafile)
// PlayMetaFile((HDC) dc->GetHDC(), (HMETAFILE) M_METAFILEDATA->m_metafile);
- dc->EndDrawing();
-
return true;
}
// Original constructor that does not takes origin and extent. If you use this,
// *DO* give origin/extent arguments to wxMakeMetafilePlaceable.
-wxMetafileDC::wxMetafileDC(const wxString& file)
+wxMetafileDCImpl::wxMetafileDCImpl(wxDC *owner, const wxString& file)
+ : wxPMDCImpl(owner)
{
m_metaFile = NULL;
m_minX = 10000;
// New constructor that takes origin and extent. If you use this, don't
// give origin/extent arguments to wxMakeMetafilePlaceable.
-wxMetafileDC::wxMetafileDC( const wxString& file,
- int WXUNUSED(xext),
- int WXUNUSED(yext),
- int WXUNUSED(xorg),
- int WXUNUSED(yorg) )
+wxMetafileDCImpl::wxMetafileDCImpl( wxDC *owner, const wxString& file,
+ int WXUNUSED(xext),
+ int WXUNUSED(yext),
+ int WXUNUSED(xorg),
+ int WXUNUSED(yorg) )
+ : wxPMDCImpl(owner)
{
m_minX = 10000;
m_minY = 10000;
SetMapMode(wxMM_TEXT); // NOTE: does not set HDC mapmode (this is correct)
}
-wxMetafileDC::~wxMetafileDC(void)
+wxMetafileDCImpl::~wxMetafileDCImpl(void)
{
m_hDC = 0;
}
-void wxMetafileDC::GetTextExtent(const wxString& WXUNUSED(string),
- long *WXUNUSED(x),
- long *WXUNUSED(y),
- long *WXUNUSED(descent),
- long *WXUNUSED(externalLeading),
- wxFont *theFont,
- bool WXUNUSED(use16bit) ) const
+void wxMetafileDCImpl::DoGetTextExtent(const wxString& WXUNUSED(string),
+ wxCoord *WXUNUSED(x),
+ wxCoord *WXUNUSED(y),
+ wxCoord *WXUNUSED(descent),
+ wxCoord *WXUNUSED(externalLeading),
+ const wxFont *theFont) const
{
- wxFont *fontToUse = theFont;
+ const wxFont *fontToUse = theFont;
if (!fontToUse)
- fontToUse = (wxFont*) &m_font;
+ fontToUse = &m_font;
// TODO:
/*
*/
}
-wxMetafile *wxMetafileDC::Close(void)
+wxMetafile *wxMetafileDCImpl::Close(void)
{
SelectOldObjects(m_hDC);
HANDLE mf = 0; // TODO: CloseMetaFile((HDC) m_hDC);
return NULL;
}
-void wxMetafileDC::SetMapMode(int mode)
+void wxMetafileDCImpl::SetMapMode(wxMappingMode mode)
{
m_mappingMode = mode;
FILE *fd = fopen(filename.fn_str(), "rb");
if (!fd)
- return FALSE;
+ return false;
wxChar tempFileBuf[256];
wxGetTempFileName(wxT("mf"), tempFileBuf);
FILE *fHandle = fopen(wxConvFile.cWX2MB(tempFileBuf), "wb");
if (!fHandle)
- return FALSE;
+ return false;
fwrite((void *)&header, sizeof(unsigned char), sizeof(mfPLACEABLEHEADER), fHandle);
// Calculate origin and extent