1. fixes to wxDC deleting logic (should fix ~wxPrinterDC leak), some code

reorganized/removed
2. applied (slightly modified) wxEnhMetaFileSimpleDataObject patch


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9687 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-04-09 01:22:48 +00:00
parent 4658c44ec2
commit 7ba4fbebbc
21 changed files with 436 additions and 301 deletions

View File

@@ -53,37 +53,47 @@ IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC)
wxMemoryDC::wxMemoryDC()
{
m_hDC = (WXHDC) ::CreateCompatibleDC((HDC) NULL);
m_ok = (m_hDC != 0);
CreateCompatible(NULL);
Init();
}
wxMemoryDC::wxMemoryDC(wxDC *dc)
{
wxCHECK_RET( dc, _T("NULL dc in wxMemoryDC ctor") );
dc->BeginDrawing();
CreateCompatible(dc);
dc->EndDrawing();
Init();
}
void wxMemoryDC::Init()
{
if ( m_ok )
{
SetBrush(*wxWHITE_BRUSH);
SetPen(*wxBLACK_PEN);
// the background mode is only used for text background and is set in
// DrawText() to OPAQUE as required, otherwise always TRANSPARENT
::SetBkMode( GetHdc(), TRANSPARENT );
}
}
bool wxMemoryDC::CreateCompatible(wxDC *dc)
{
m_hDC = (WXHDC)::CreateCompatibleDC(dc ? GetHdcOf(*dc) : NULL);
// as we created the DC, we must delete it in the dtor
m_bOwnsDC = TRUE;
SetBrush(*wxWHITE_BRUSH);
SetPen(*wxBLACK_PEN);
m_ok = m_hDC != 0;
// the background mode is only used for text background and is set in
// DrawText() to OPAQUE as required, otherwise always TRANSPARENT
::SetBkMode( GetHdc(), TRANSPARENT );
}
wxMemoryDC::wxMemoryDC(wxDC *old_dc)
{
old_dc->BeginDrawing();
m_hDC = (WXHDC) ::CreateCompatibleDC(GetHdcOf(*old_dc));
m_ok = (m_hDC != 0);
old_dc->EndDrawing();
SetBrush(*wxWHITE_BRUSH);
SetPen(*wxBLACK_PEN);
// the background mode is only used for text background and is set in
// DrawText() to OPAQUE as required, otherwise always TRANSPARENT
::SetBkMode( GetHdc(), TRANSPARENT );
}
wxMemoryDC::~wxMemoryDC()
{
return m_ok;
}
void wxMemoryDC::SelectObject(const wxBitmap& bitmap)