static PAINTSTRUCT g_paintStruct;
-#ifdef __WXDEBUG__
+#ifdef wxHAS_PAINT_DEBUG
// a global variable which we check to verify that wxPaintDC are only
// created in response to WM_PAINT message - doing this from elsewhere is a
// common programming error among wxWidgets programmers and might lead to
// very subtle and difficult to debug refresh/repaint bugs.
int g_isPainting = 0;
-#endif // __WXDEBUG__
+#endif // wxHAS_PAINT_DEBUG
// ===========================================================================
// implementation
{
}
-wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window ) :
+wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window ) :
wxMSWDCImpl( owner )
{
- wxCHECK_RET( window, _T("invalid window in wxWindowDCImpl") );
+ wxCHECK_RET( window, wxT("invalid window in wxWindowDCImpl") );
m_window = window;
m_hDC = (WXHDC) ::GetWindowDC(GetHwndOf(m_window));
// DrawText() to OPAQUE as required, otherwise always TRANSPARENT,
::SetBkMode(GetHdc(), TRANSPARENT);
- // default bg colour is pne of the window
- SetBackground(wxBrush(m_window->GetBackgroundColour(), wxSOLID));
-
// since we are a window dc we need to grab the palette from the window
#if wxUSE_PALETTE
InitializePalette();
void wxWindowDCImpl::DoGetSize(int *width, int *height) const
{
- wxCHECK_RET( m_window, _T("wxWindowDCImpl without a window?") );
+ wxCHECK_RET( m_window, wxT("wxWindowDCImpl without a window?") );
m_window->GetSize(width, height);
}
wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *window ) :
wxWindowDCImpl( owner )
{
- wxCHECK_RET( window, _T("invalid window in wxClientDCImpl") );
+ wxCHECK_RET( window, wxT("invalid window in wxClientDCImpl") );
m_window = window;
m_hDC = (WXHDC)::GetDC(GetHwndOf(window));
}
// clip the DC to avoid overwriting the non client area
- SetClippingRegion(wxPoint(0,0), m_window->GetClientSize());
+ wxSize size = m_window->GetClientSize();
+ DoSetClippingRegion(0, 0, size.x, size.y);
#endif // __WXUNIVERSAL__ || __WXWINCE__
}
void wxClientDCImpl::DoGetSize(int *width, int *height) const
{
- wxCHECK_RET( m_window, _T("wxClientDCImpl without a window?") );
+ wxCHECK_RET( m_window, wxT("wxClientDCImpl without a window?") );
m_window->GetClientSize(width, height);
}
{
wxCHECK_RET( window, wxT("NULL canvas in wxPaintDCImpl ctor") );
-#ifdef __WXDEBUG__
+#ifdef wxHAS_PAINT_DEBUG
if ( g_isPainting <= 0 )
{
wxFAIL_MSG( wxT("wxPaintDCImpl may be created only in EVT_PAINT handler!") );
return;
}
-#endif // __WXDEBUG__
+#endif // wxHAS_PAINT_DEBUG
+
+ // see comments in src/msw/window.cpp where this is defined
+ extern bool wxDidCreatePaintDC;
+
+ wxDidCreatePaintDC = true;
+
m_window = window;
public:
wxPaintDCExImpl( wxDC *owner, wxWindow *window, WXHDC dc );
~wxPaintDCExImpl();
-
+
int m_saveState;
};
IMPLEMENT_ABSTRACT_CLASS(wxPaintDCEx,wxPaintDC)
-wxPaintDCEx::wxPaintDCEx( wxWindow *window, WXHDC dc )
+wxPaintDCEx::wxPaintDCEx(wxWindow *window, WXHDC dc)
+ : wxPaintDC(new wxPaintDCExImpl(this, window, dc))
{
- m_pimpl = new wxPaintDCExImpl( this, window, dc );
}
-
-
-wxPaintDCExImpl::wxPaintDCExImpl( wxDC *owner, wxWindow *window, WXHDC dc ) :
- wxPaintDCImpl( owner )
+wxPaintDCExImpl::wxPaintDCExImpl(wxDC *owner, wxWindow *window, WXHDC dc)
+ : wxPaintDCImpl( owner )
{
wxCHECK_RET( dc, wxT("wxPaintDCEx requires an existing device context") );
m_saveState = 0;
-
+
m_window = window;
wxPaintDCInfo *info = FindInCache();