Fix the check for second window becoming too small in wxSplitterWindow.

There was a strange check for the second pane size in OnSize() which hardcoded
5 pixels as minimal pane size in the check and 40 pixels as the minimal size
to set. This resulted in strange behaviour when the second pane size would
decrease to 6 pixels smoothly and then jump back to 40 pixels when the
splitter window was resized and also was ugly at the code level.

Get rid of this code and simply call AdjustSashPosition() to ensure that the
sash position remains valid as the splitter is resized.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69600 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2011-10-30 19:48:48 +00:00
parent 853f4764c0
commit 1b5dfa53aa

View File

@ -461,9 +461,10 @@ void wxSplitterWindow::OnSize(wxSizeEvent& event)
SetSashPositionAndNotify(newPosition);
}
if ( m_sashPosition >= size - 5 )
SetSashPositionAndNotify(wxMax(10, size - 40));
m_lastSize = wxSize(w,h);
// Also check if the second window became too small.
int adjustedPosition = AdjustSashPosition(m_sashPosition);
if ( adjustedPosition != m_sashPosition )
SetSashPositionAndNotify(adjustedPosition);
}
}