implemented wxDC::DoGetSize() correctly for metafile DC classes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36566 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -87,6 +87,12 @@ public:
|
|||||||
wxEnhMetaFile *Close();
|
wxEnhMetaFile *Close();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
virtual void DoGetSize(int *width, int *height) const;
|
||||||
|
|
||||||
|
// size passed to ctor and returned by DoGetSize()
|
||||||
|
int m_width,
|
||||||
|
m_height;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxEnhMetaFileDC)
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxEnhMetaFileDC)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -107,6 +107,8 @@ public:
|
|||||||
void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; }
|
void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void DoGetSize(int *width, int *height) const;
|
||||||
|
|
||||||
int m_windowsMappingMode;
|
int m_windowsMappingMode;
|
||||||
wxMetafile* m_metaFile;
|
wxMetafile* m_metaFile;
|
||||||
|
|
||||||
|
@@ -194,7 +194,9 @@ wxEnhMetaFileDC::wxEnhMetaFileDC(const wxString& filename,
|
|||||||
int width, int height,
|
int width, int height,
|
||||||
const wxString& description)
|
const wxString& description)
|
||||||
{
|
{
|
||||||
ScreenHDC hdcRef;
|
m_width = width;
|
||||||
|
m_height = height;
|
||||||
|
|
||||||
RECT rect;
|
RECT rect;
|
||||||
RECT *pRect;
|
RECT *pRect;
|
||||||
if ( width && height )
|
if ( width && height )
|
||||||
@@ -215,6 +217,7 @@ wxEnhMetaFileDC::wxEnhMetaFileDC(const wxString& filename,
|
|||||||
pRect = (LPRECT)NULL;
|
pRect = (LPRECT)NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScreenHDC hdcRef;
|
||||||
m_hDC = (WXHDC)::CreateEnhMetaFile(hdcRef, GetMetaFileName(filename),
|
m_hDC = (WXHDC)::CreateEnhMetaFile(hdcRef, GetMetaFileName(filename),
|
||||||
pRect, description);
|
pRect, description);
|
||||||
if ( !m_hDC )
|
if ( !m_hDC )
|
||||||
@@ -223,6 +226,14 @@ wxEnhMetaFileDC::wxEnhMetaFileDC(const wxString& filename,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxEnhMetaFileDC::DoGetSize(int *width, int *height) const
|
||||||
|
{
|
||||||
|
if ( width )
|
||||||
|
*width = m_width;
|
||||||
|
if ( height )
|
||||||
|
*height = m_height;
|
||||||
|
}
|
||||||
|
|
||||||
wxEnhMetaFile *wxEnhMetaFileDC::Close()
|
wxEnhMetaFile *wxEnhMetaFileDC::Close()
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( Ok(), NULL, _T("invalid wxEnhMetaFileDC") );
|
wxCHECK_MSG( Ok(), NULL, _T("invalid wxEnhMetaFileDC") );
|
||||||
|
@@ -243,6 +243,16 @@ void wxMetafileDC::GetTextExtent(const wxString& string, long *x, long *y,
|
|||||||
*externalLeading = tm.tmExternalLeading;
|
*externalLeading = tm.tmExternalLeading;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxMetafileDC::DoGetSize(int *width, int *height) const
|
||||||
|
{
|
||||||
|
wxCHECK_RET( m_refData, _T("invalid wxMetafileDC") );
|
||||||
|
|
||||||
|
if ( width )
|
||||||
|
*width = M_METAFILEDATA->m_width;
|
||||||
|
if ( height )
|
||||||
|
*height = M_METAFILEDATA->m_height;
|
||||||
|
}
|
||||||
|
|
||||||
wxMetafile *wxMetafileDC::Close()
|
wxMetafile *wxMetafileDC::Close()
|
||||||
{
|
{
|
||||||
SelectOldObjects(m_hDC);
|
SelectOldObjects(m_hDC);
|
||||||
|
Reference in New Issue
Block a user