]> git.saurik.com Git - wxWidgets.git/commitdiff
Initial support for EVT_ERASE_BACKGROUND for OS X Cocoa.
authorKevin Ollivier <kevino@theolliviers.com>
Mon, 9 Feb 2009 02:20:03 +0000 (02:20 +0000)
committerKevin Ollivier <kevino@theolliviers.com>
Mon, 9 Feb 2009 02:20:03 +0000 (02:20 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58796 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/cocoa/window.mm

index 49cde7ade9e14680494669539081bc443268dc75..3f9f4e7154c674c7823d8330a6eb70764a4f824f 100644 (file)
@@ -12,6 +12,7 @@
 #include "wx/wxprec.h"
 
 #ifndef WX_PRECOMP
+    #include "wx/dcclient.h"
     #include "wx/nonownedwnd.h"
     #include "wx/log.h"
 #endif
@@ -754,6 +755,20 @@ void wxWidgetCocoaImpl::drawRect(void* rect, WXWidget slf, void *_cmd)
     wxpeer->GetUpdateRegion() = updateRgn;
     wxpeer->MacSetCGContextRef( context );
     
+    // first send an erase event to the entire update area
+    // 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)
+    
+    wxDC* dc = new wxWindowDC(wxpeer);
+    dc->SetDeviceClippingRegion(updateRgn);
+
+    wxEraseEvent eevent( wxpeer->GetId(), dc );
+    eevent.SetEventObject( wxpeer );
+    wxpeer->HandleWindowEvent( eevent );
+    delete dc ;
+    
     wxPaintEvent event;
     event.SetTimestamp(0); //  todo
     event.SetEventObject(wxpeer);