fixed child windows scrolling to use wxSIZE_ALLOW_MINUS_ONE

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44216 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2007-01-12 21:46:51 +00:00
parent 302129f896
commit 6a6e282245

View File

@@ -1079,24 +1079,30 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
// and scrolling direction // and scrolling direction
// 2. if scrolling in both axes, scroll all children // 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 */) ) if ( rect && (dx * dy == 0 /* moving in only one of x, y axis */) )
{ {
wxRect childRect = child->GetRect(); wxRect childRect = child->GetRect();
if ( dx == 0 && (childRect.GetLeft() <= rect->GetRight() || if ( dx == 0 && (childRect.GetLeft() <= rect->GetRight() ||
childRect.GetRight() >= rect->GetLeft()) ) childRect.GetRight() >= rect->GetLeft()) )
{ {
child->Move(child->GetPosition() + offset); shouldMove = true;
} }
else if ( dy == 0 && (childRect.GetTop() <= rect->GetBottom() || else if ( dy == 0 && (childRect.GetTop() <= rect->GetBottom() ||
childRect.GetBottom() >= rect->GetTop()) ) 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 #endif // wxX11/!wxX11
} }