X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/327788acc5e4915df4e9e97db7fb08a4c4a00cdd..c4e387521b7297a24e4aa016b588cf77d32d1b5f:/src/mac/control.cpp diff --git a/src/mac/control.cpp b/src/mac/control.cpp index d416ffa799..fc90b8ea04 100644 --- a/src/mac/control.cpp +++ b/src/mac/control.cpp @@ -42,6 +42,7 @@ END_EVENT_TABLE() #endif #include "wx/mac/uma.h" +#include "wx/mac/private.h" // Item members @@ -694,13 +695,27 @@ void wxControl::MacRedrawControl() { wxClientDC dc(this) ; wxMacPortSetter helper(&dc) ; - - // the controls sometimes draw outside their boundaries, this - // should be resolved differently but is not trivial (e.g. drop shadows) - // since adding them to the border would yield in enormous gaps between - // the controls +/* Rect r = { 0 , 0 , 32000 , 32000 } ; ClipRect( &r ) ; +*/ + int x = 0 , y = 0; + wxWindow *parent = GetParent() ; + parent->MacWindowToRootWindow( &x,&y ) ; + RgnHandle clrgn = NewRgn() ; + RgnHandle insidergn = NewRgn() ; + wxSize size = parent->GetSize() ; + SetRectRgn( insidergn , parent->MacGetLeftBorderSize() , parent->MacGetTopBorderSize() , + size.x - parent->MacGetLeftBorderSize() - parent->MacGetRightBorderSize(), + size.y - parent->MacGetTopBorderSize() - parent->MacGetBottomBorderSize()) ; + + CopyRgn( (RgnHandle) parent->MacGetVisibleRegion(false).GetWXHRGN() , clrgn ) ; + SectRgn( clrgn , insidergn , clrgn ) ; + OffsetRgn( clrgn , x , y ) ; + SetClip( clrgn ) ; + DisposeRgn( clrgn ) ; + DisposeRgn( insidergn ) ; + wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ; UMADrawControl( (ControlHandle) m_macControl ) ; } @@ -712,12 +727,27 @@ void wxControl::OnPaint(wxPaintEvent& event) { wxPaintDC dc(this) ; wxMacPortSetter helper(&dc) ; - // the controls sometimes draw outside their boundaries, this - // should be resolved differently but is not trivial (e.g. drop shadows) - // since adding them to the border would yield in enormous gaps between - // the controls +/* Rect r = { 0 , 0 , 32000 , 32000 } ; ClipRect( &r ) ; +*/ + + int x = 0 , y = 0; + wxWindow *parent = GetParent() ; + parent->MacWindowToRootWindow( &x,&y ) ; + RgnHandle clrgn = NewRgn() ; + RgnHandle insidergn = NewRgn() ; + wxSize size = parent->GetSize() ; + SetRectRgn( insidergn , parent->MacGetLeftBorderSize() , parent->MacGetTopBorderSize() , + size.x - parent->MacGetLeftBorderSize() - parent->MacGetRightBorderSize(), + size.y - parent->MacGetTopBorderSize() - parent->MacGetBottomBorderSize()) ; + + CopyRgn( (RgnHandle) parent->MacGetVisibleRegion(false).GetWXHRGN() , clrgn ) ; + SectRgn( clrgn , insidergn , clrgn ) ; + OffsetRgn( clrgn , x , y ) ; + SetClip( clrgn ) ; + DisposeRgn( clrgn ) ; + DisposeRgn( insidergn ) ; wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ; UMADrawControl( (ControlHandle) m_macControl ) ;