X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c085e333984dc079a001cd3f581aeb1f51a1f227..8162b8489765fbc579b9f60f229265ca1bfd8ab0:/src/msw/dcclient.cpp diff --git a/src/msw/dcclient.cpp b/src/msw/dcclient.cpp index b813a115be..50fd1ad86e 100644 --- a/src/msw/dcclient.cpp +++ b/src/msw/dcclient.cpp @@ -13,11 +13,6 @@ #pragma implementation "dcclient.h" #endif -#ifdef __GNUG__ -#pragma implementation -#pragma implementation "dcclient.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -34,61 +29,77 @@ #include #if !USE_SHARED_LIBRARY -IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxDC) IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC) -IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxDC) +IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC) +IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC) #endif -wxClientDC::wxClientDC(void) +/* + * wxWindowDC + */ + +wxWindowDC::wxWindowDC(void) { m_canvas = NULL; } -wxClientDC::wxClientDC(wxWindow *the_canvas) +wxWindowDC::wxWindowDC(wxWindow *the_canvas) { m_canvas = the_canvas; -// BeginDrawing(); - m_hDC = (WXHDC) ::GetDC((HWND) the_canvas->GetHWND()); +// m_hDC = (WXHDC) ::GetDCEx((HWND) the_canvas->GetHWND(), NULL, DCX_WINDOW); + m_hDC = (WXHDC) ::GetWindowDC((HWND) the_canvas->GetHWND() ); + m_hDCCount ++; + + SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID)); } -wxClientDC::~wxClientDC(void) +wxWindowDC::~wxWindowDC(void) { -// EndDrawing(); - - if (m_canvas && (HDC) m_hDC) + if (m_canvas && m_hDC) { SelectOldObjects(m_hDC); ::ReleaseDC((HWND) m_canvas->GetHWND(), (HDC) m_hDC); m_hDC = 0; } + m_hDCCount --; } -wxWindowDC::wxWindowDC(void) +/* + * wxClientDC + */ + +wxClientDC::wxClientDC(void) { m_canvas = NULL; } -wxWindowDC::wxWindowDC(wxWindow *the_canvas) +wxClientDC::wxClientDC(wxWindow *the_canvas) { m_canvas = the_canvas; -// m_hDC = (WXHDC) ::GetDCEx((HWND) the_canvas->GetHWND(), NULL, DCX_WINDOW); - m_hDC = (WXHDC) ::GetWindowDC((HWND) the_canvas->GetHWND() ); - m_hDCCount ++; +// BeginDrawing(); + m_hDC = (WXHDC) ::GetDC((HWND) the_canvas->GetHWND()); + + SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID)); } -wxWindowDC::~wxWindowDC(void) +wxClientDC::~wxClientDC(void) { - if (m_canvas && m_hDC) +// EndDrawing(); + + if (m_canvas && (HDC) m_hDC) { SelectOldObjects(m_hDC); ::ReleaseDC((HWND) m_canvas->GetHWND(), (HDC) m_hDC); m_hDC = 0; } - m_hDCCount --; } +/* + * wxPaintDC + */ + wxPaintDC::wxPaintDC(void) { m_canvas = NULL; @@ -121,6 +132,8 @@ wxPaintDC::wxPaintDC(wxWindow *canvas) ms_PaintCount = 1; m_hDCCount++; } + + SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID)); } wxPaintDC::~wxPaintDC() @@ -129,8 +142,8 @@ wxPaintDC::~wxPaintDC() if ( !--ms_PaintCount ) { ::EndPaint((HWND)m_canvas->GetHWND(), &g_paintStruct); m_hDCCount--; - m_hDC = NULL; - ms_PaintHDC = NULL; + m_hDC = (WXHDC) NULL; + ms_PaintHDC = (WXHDC) NULL; } else { }//: ms_PaintHDC still in use }