]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/window.cpp
Added const qualifier to char* in struct service_entry
[wxWidgets.git] / src / mac / carbon / window.cpp
index 199f23f20858087a89341376cdba22ab3bdb86b7..12f493093a7377f9527a0c6ac8275e1b431b4fb3 100644 (file)
@@ -24,6 +24,7 @@
 #include "wx/layout.h"
 #include "wx/dialog.h"
 #include "wx/scrolbar.h"
+#include "wx/scrolwin.h"
 #include "wx/statbox.h"
 #include "wx/button.h"
 #include "wx/settings.h"
@@ -36,6 +37,8 @@
 #include "wx/log.h"
 #include "wx/geometry.h"
 #include "wx/textctrl.h"
+#include "wx/laywin.h"
+#include "wx/splitter.h"
 
 #include "wx/toolbar.h"
 #include "wx/dc.h"
@@ -1603,10 +1606,50 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
         }
 #endif
         bool vis = m_peer->IsVisible();
+    
+        int outerBorder = MacGetLeftBorderSize() ;
+        if ( m_peer->NeedsFocusRect() && m_peer->HasFocus() )
+            outerBorder = 4 ;         
+
+        if ( vis && ( outerBorder > 0 ) )
+        {
+            // as the borders are drawn on the parent we have to properly invalidate all these areas
+            RgnHandle updateInner = NewRgn() , updateOuter = NewRgn() , updateTotal = NewRgn() ;
+            
+            Rect rect ;
+
+            m_peer->GetRect( &rect ) ;
+            RectRgn( updateInner , &rect ) ;
+            InsetRect( &rect , -outerBorder , -outerBorder ) ;
+            RectRgn( updateOuter , &rect ) ;
+            DiffRgn( updateOuter , updateInner ,updateOuter ) ;
+            wxPoint parent(0,0); 
+            GetParent()->MacWindowToRootWindow( &parent.x , &parent.y ) ;
+            parent -= GetParent()->GetClientAreaOrigin() ;
+            OffsetRgn( updateOuter , -parent.x , -parent.y ) ;
+            CopyRgn( updateOuter , updateTotal ) ; 
+    
+            rect = r ;
+            RectRgn( updateInner , &rect ) ;
+            InsetRect( &rect , -outerBorder , -outerBorder ) ;
+            RectRgn( updateOuter , &rect ) ;
+            DiffRgn( updateOuter , updateInner ,updateOuter ) ;
+            wxPoint parentorig(0,0); 
+            GetParent()->MacWindowToRootWindow( &parentorig.x , &parentorig.y ) ;
+            parent -= GetParent()->GetClientAreaOrigin() ;
+            OffsetRgn( updateOuter , -parentorig.x , -parentorig.y ) ;
+            UnionRgn( updateOuter , updateTotal , updateTotal ) ; 
+
+            GetParent()->m_peer->SetNeedsDisplay( true , updateTotal ) ;
+            DisposeRgn(updateOuter) ;
+            DisposeRgn(updateInner) ;
+            DisposeRgn(updateTotal) ;
+        }
 
         // the HIViewSetFrame call itself should invalidate the areas, but when testing with the UnicodeTextCtrl it does not !
         if ( vis )
             m_peer->SetVisibility( false , true ) ;
+
         m_peer->SetRect( &r ) ; 
         if ( vis )
             m_peer->SetVisibility( true , true ) ;
@@ -2591,7 +2634,11 @@ wxTopLevelWindowMac* wxWindowMac::MacGetTopLevelWindow() const
 }
 wxRegion wxWindowMac::MacGetVisibleRegion( bool includeOuterStructures )
 {
-
+    // includeOuterStructures is true if we try to draw somthing like a focus ring etc.
+    // also a window dc uses this, in this case we only clip in the hierarchy for hard
+    // borders like a scrollwindow, splitter etc otherwise we end up in a paranoia having
+    // to add focus borders everywhere
+    
     Rect r ;
     RgnHandle visRgn = NewRgn() ;
     RgnHandle tempRgn = NewRgn() ;
@@ -2644,12 +2691,19 @@ wxRegion wxWindowMac::MacGetVisibleRegion( bool includeOuterStructures )
                 parent->MacWindowToRootWindow( &x, &y ) ;
                 MacRootWindowToWindow( &x , &y ) ;
 
-                SetRectRgn( tempRgn ,
-                    x + parent->MacGetLeftBorderSize() , y + parent->MacGetTopBorderSize() ,
-                    x + size.x - parent->MacGetRightBorderSize(),
-                    y + size.y - parent->MacGetBottomBorderSize()) ;
+                if ( !includeOuterStructures || (
+                    parent->IsKindOf( CLASSINFO( wxScrolledWindow ) ) ||
+                    parent->IsKindOf( CLASSINFO( wxSashLayoutWindow ) ) ||
+                    ( parent->GetParent() && parent->GetParent()->IsKindOf( CLASSINFO( wxSplitterWindow ) ) )
+                    ) )
+                {
+                    SetRectRgn( tempRgn ,
+                        x + parent->MacGetLeftBorderSize() , y + parent->MacGetTopBorderSize() ,
+                        x + size.x - parent->MacGetRightBorderSize(),
+                        y + size.y - parent->MacGetBottomBorderSize()) ;
 
-                SectRgn( visRgn , tempRgn , visRgn ) ;
+                    SectRgn( visRgn , tempRgn , visRgn ) ;
+                }
                 if ( parent->IsTopLevel() )
                     break ;
                 child = parent ;