]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed child windows scrolling to use wxSIZE_ALLOW_MINUS_ONE
authorVáclav Slavík <vslavik@fastmail.fm>
Fri, 12 Jan 2007 21:46:51 +0000 (21:46 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Fri, 12 Jan 2007 21:46:51 +0000 (21:46 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44216 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/univ/winuniv.cpp

index 24e2865a77c1de5e989876428d78de9a956469ce..fcdda770e1e0a2aade8a7dba1c06e76e392f942d 100644 (file)
@@ -1079,24 +1079,30 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
         //          and scrolling direction
         //       2. if scrolling in both axes, scroll all children
 
+        bool shouldMove = false;
+
         if ( rect && (dx * dy == 0 /* moving in only one of x, y axis */) )
         {
             wxRect childRect = child->GetRect();
             if ( dx == 0 && (childRect.GetLeft() <= rect->GetRight() ||
                              childRect.GetRight() >= rect->GetLeft()) )
             {
-                child->Move(child->GetPosition() + offset);
+                shouldMove = true;
             }
             else if ( dy == 0 && (childRect.GetTop() <= rect->GetBottom() ||
                                   childRect.GetBottom() >= rect->GetTop()) )
             {
-                child->Move(child->GetPosition() + offset);
+                shouldMove = true;
             }
+            // else: child outside of scrolling shaft, don't move
         }
-        else
+        else // scrolling in both axes or rect=NULL
         {
-            child->Move(child->GetPosition() + offset);
+            shouldMove = true;
         }
+
+        if ( shouldMove )
+            child->Move(child->GetPosition() + offset, wxSIZE_ALLOW_MINUS_ONE);
     }
 #endif // wxX11/!wxX11
 }