drawing code now in common file
authorStefan Csomor <csomor@advancedconcepts.ch>
Mon, 9 Feb 2009 09:54:23 +0000 (09:54 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Mon, 9 Feb 2009 09:54:23 +0000 (09:54 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58807 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/cocoa/window.mm

index 3f9f4e7154c674c7823d8330a6eb70764a4f824f..479d0c776cca143044722c55692b2202a2f85519 100644 (file)
@@ -755,34 +755,22 @@ 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);
-    bool handled = wxpeer->HandleWindowEvent(event);
+    bool handled = wxpeer->MacDoRedraw( 0 );
             
     CGContextRestoreGState( context );
-    
+
+    CGContextSaveGState( context );
     if ( !handled )
     {
         // call super
         SEL _cmd = @selector(drawRect:);
         wxOSX_DrawRectHandlerPtr superimpl = (wxOSX_DrawRectHandlerPtr) [[slf superclass] instanceMethodForSelector:_cmd];
         superimpl(slf, _cmd, *(NSRect*)rect);
+        CGContextRestoreGState( context );
+        CGContextSaveGState( context );
     }
+    wxpeer->MacPaintChildrenBorders();
+    CGContextRestoreGState( context );
 }
 
 void wxWidgetCocoaImpl::clickedAction( WXWidget slf, void *_cmd, void *sender)