]> git.saurik.com Git - wxWidgets.git/commitdiff
erase background using the window background colour when using wxBG_STYLE_ERASE/SYSTEM
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 18 Jun 2009 23:00:49 +0000 (23:00 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 18 Jun 2009 23:00:49 +0000 (23:00 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61125 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/window_osx.cpp

index 50b3bc90e93a7f48252c57b3d0765279da27fe19..cb59ce7889d7fd00e189fe231dc6ab3e63effe14 100644 (file)
@@ -1755,27 +1755,44 @@ bool wxWindowMac::MacDoRedraw( long time )
 
     // first send an erase event to the entire update area
     const wxBackgroundStyle bgStyle = GetBackgroundStyle();
 
     // first send an erase event to the entire update area
     const wxBackgroundStyle bgStyle = GetBackgroundStyle();
-    if ( bgStyle == wxBG_STYLE_ERASE )
-    {
-        // for the toplevel window this really is the entire area
-        // for all the others only their client area, otherwise they
-        // might be drawing with full alpha and eg put blue into
-        // the grow-box area of a scrolled window (scroll sample)
-        wxWindowDC dc(this);
-        if ( IsTopLevel() )
-            dc.SetDeviceClippingRegion(formerUpdateRgn);
-        else
-            dc.SetDeviceClippingRegion(clientUpdateRgn);
-
-        wxEraseEvent eevent( GetId(), &dc );
-        eevent.SetEventObject( this );
-        if ( !ProcessWindowEvent( eevent ) )
-        {
-            if ( bgStyle == wxBG_STYLE_SYSTEM && MacGetTopLevelWindow() )
+    switch ( bgStyle )
+    {
+        case wxBG_STYLE_ERASE:
+        case wxBG_STYLE_SYSTEM:
             {
             {
-                dc.Clear();
+                // for the toplevel window this really is the entire area for
+                // all the others only their client area, otherwise they might
+                // be drawing with full alpha and eg put blue into the grow-box
+                // area of a scrolled window (scroll sample)
+                wxWindowDC dc(this);
+                if ( IsTopLevel() )
+                    dc.SetDeviceClippingRegion(formerUpdateRgn);
+                else
+                    dc.SetDeviceClippingRegion(clientUpdateRgn);
+
+                if ( bgStyle == wxBG_STYLE_ERASE )
+                {
+                    wxEraseEvent eevent( GetId(), &dc );
+                    eevent.SetEventObject( this );
+                    if ( ProcessWindowEvent( eevent ) )
+                        break;
+                }
+
+                if ( MacGetTopLevelWindow() )
+                {
+                    dc.SetBackground(GetBackgroundColour());
+                    dc.Clear();
+                }
             }
             }
-        }
+            break;
+
+        case wxBG_STYLE_PAINT:
+            // nothing to do, user-defined EVT_PAINT handler will overwrite the
+            // entire window client area
+            break;
+
+        default:
+            wxFAIL_MSG( "unsupported background style" );
     }
 
     MacPaintGrowBox();
     }
 
     MacPaintGrowBox();