Generate erase background events for native controls too under MSW.

Remove the test which prevented the generation of erase background events from
wxMSW::wxWindow::HandleEraseBkgnd(). Although it is true that native controls
mostly erase background on their own, there are exceptions: we must erase the
background of wxToolBar ourselves, for example. More importantly, there is no
reason to prevent the user code from defining wxEVT_ERASE_BACKGROUND handlers
for the native controls as this works just fine under MSW (although it doesn't
under GTK nor probably other ports...). So also add a test erase background
handler to the toolbar sample to verify that this does work.

Closes #11514.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62805 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-12-07 13:37:01 +00:00
parent d2356abe70
commit 0639363014
2 changed files with 55 additions and 7 deletions

View File

@@ -4754,12 +4754,6 @@ void wxWindowMSW::OnPaint(wxPaintEvent& event)
bool wxWindowMSW::HandleEraseBkgnd(WXHDC hdc)
{
// standard non top level controls (i.e. except the dialogs) always erase
// their background themselves in HandleCtlColor() or have some control-
// specific ways to set the colours (common controls)
if ( IsOfStandardClass() && !IsTopLevel() )
return false;
switch ( GetBackgroundStyle() )
{
case wxBG_STYLE_ERASE:
@@ -4782,7 +4776,7 @@ bool wxWindowMSW::HandleEraseBkgnd(WXHDC hdc)
if ( rc )
{
// background erase by the user-defined handler
// background erased by the user-defined handler
return true;
}
}