Allow to not create wxPaintDC in EVT_PAINT handler in wxMSW.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 23 Jan 2010 13:22:25 +0000 (13:22 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 23 Jan 2010 13:22:25 +0000 (13:22 +0000)
commit7ca106e860dd06773f1b1d286cccfeb69d78468e
treeec241991d69d0b06bcf7c3a858b070a196c56379
parent975fb32b5cac366ad89be9c1d42cca9a789e1802
Allow to not create wxPaintDC in EVT_PAINT handler in wxMSW.

Failure to create a wxPaintDC in EVT_PAINT handler resulted in many serious
and difficult to debug problems under wxMSW. We used to document that the user
shouldn't do it but this wasn't enough (see #11648). We could also assert if
we detected that a handler didn't create a wxPaintDC but it seems better to
just handle this case gracefully for consistency with the other platforms.

Add wxDidCreatePaintDC global variable which is reset before generating
wxPaintEvent and set to true when ::BeginPaint() is called from wxPaintDC
ctor and validate the update region of the window ourselves if it wasn't set
(meaning that wxPaintDC wasn't created).

Update the documentation to emphasize the link between EVT_PAINT handlers and
wxPaintDC but without saying that wxPaintDC object must always be created in
the handler as this is not true any more.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63229 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
docs/changes.txt
interface/wx/event.h
src/msw/dcclient.cpp
src/msw/window.cpp