- // do default background painting
- if ( !DoEraseBackground(GetHdcOf(*impl)) )
- {
- // let the system paint the background
- event.Skip();
+ wxEraseEvent event(m_windowId, &dc);
+ event.SetEventObject(this);
+ bool rc = HandleWindowEvent(event);
+
+ // must be called manually as ~wxDC doesn't do anything for
+ // wxDCTemp
+ impl->SelectOldObjects(hdc);
+
+ if ( rc )
+ {
+ // background erase by the user-defined handler
+ return true;
+ }
+ }
+ // fall through
+
+ case wxBG_STYLE_SYSTEM:
+ if ( !DoEraseBackground(hdc) )
+ {
+ // let the default processing to take place if we didn't erase
+ // the background ourselves
+ return false;
+ }
+ break;
+
+ case wxBG_STYLE_PAINT:
+ // no need to do anything here at all, background will be entirely
+ // redrawn in WM_PAINT handler
+ break;
+
+ default:
+ wxFAIL_MSG( "unknown background style" );