Remove wxSplitterWindow::m_checkRequestedSashPosition.

This variable seemed to be redundant with m_requestedSashPosition being set to
INT_MAX so harmonise the code to always check for the latter and get rid of
the former.

There should be no observable changes in behaviour.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69597 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-10-30 19:48:38 +00:00
parent 8219f7f982
commit 31174267f8
2 changed files with 15 additions and 18 deletions

View File

@@ -294,7 +294,6 @@ protected:
bool m_needUpdating:1; bool m_needUpdating:1;
bool m_permitUnsplitAlways:1; bool m_permitUnsplitAlways:1;
bool m_isHot:1; bool m_isHot:1;
bool m_checkRequestedSashPosition:1;
private: private:
DECLARE_DYNAMIC_CLASS(wxSplitterWindow) DECLARE_DYNAMIC_CLASS(wxSplitterWindow)

View File

@@ -118,10 +118,10 @@ void wxSplitterWindow::Init()
m_oldX = 0; m_oldX = 0;
m_oldY = 0; m_oldY = 0;
m_sashStart = 0; m_sashStart = 0;
m_sashPosition = m_requestedSashPosition = 0; m_sashPosition = 0;
m_requestedSashPosition = INT_MAX;
m_sashGravity = 0.0; m_sashGravity = 0.0;
m_lastSize = wxSize(0,0); m_lastSize = wxSize(0,0);
m_checkRequestedSashPosition = false;
m_minimumPaneSize = 0; m_minimumPaneSize = 0;
m_sashCursorWE = wxCursor(wxCURSOR_SIZEWE); m_sashCursorWE = wxCursor(wxCURSOR_SIZEWE);
m_sashCursorNS = wxCursor(wxCURSOR_SIZENS); m_sashCursorNS = wxCursor(wxCURSOR_SIZENS);
@@ -193,20 +193,21 @@ void wxSplitterWindow::OnInternalIdle()
{ {
wxWindow::OnInternalIdle(); wxWindow::OnInternalIdle();
// if this is the first idle time after a sash position has potentially // We may need to update the children sizes in two cases: either because
// been set, allow SizeWindows to check for a requested size. // we're in the middle of a live update as indicated by m_needUpdating or
if (!m_checkRequestedSashPosition) // because we have a requested but not yet set sash position as indicated
{ // by m_requestedSashPosition having a valid value.
m_checkRequestedSashPosition = true; if ( m_needUpdating )
SizeWindows();
return; // it won't needUpdating in this case
}
if (m_needUpdating)
{ {
m_needUpdating = false; m_needUpdating = false;
SizeWindows();
} }
else if ( m_requestedSashPosition == INT_MAX )
{
// We don't need to resize the children.
return;
}
SizeWindows();
} }
void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
@@ -646,7 +647,7 @@ void wxSplitterWindow::SetSashPositionAndNotify(int sashPos)
void wxSplitterWindow::SizeWindows() void wxSplitterWindow::SizeWindows()
{ {
// check if we have delayed setting the real sash position // check if we have delayed setting the real sash position
if ( m_checkRequestedSashPosition && m_requestedSashPosition != INT_MAX ) if ( m_requestedSashPosition != INT_MAX )
{ {
int newSashPosition = ConvertSashPosition(m_requestedSashPosition); int newSashPosition = ConvertSashPosition(m_requestedSashPosition);
if ( newSashPosition != m_sashPosition ) if ( newSashPosition != m_sashPosition )
@@ -847,7 +848,6 @@ void wxSplitterWindow::SetSashPosition(int position, bool redraw)
// remember the sash position we want to set for later if we can't set it // remember the sash position we want to set for later if we can't set it
// right now (e.g. because the window is too small) // right now (e.g. because the window is too small)
m_requestedSashPosition = position; m_requestedSashPosition = position;
m_checkRequestedSashPosition = false;
DoSetSashPosition(ConvertSashPosition(position)); DoSetSashPosition(ConvertSashPosition(position));
@@ -862,9 +862,7 @@ void wxSplitterWindow::SetSashPosition(int position, bool redraw)
// window is shown, if you know the overall size is correct. // window is shown, if you know the overall size is correct.
void wxSplitterWindow::UpdateSize() void wxSplitterWindow::UpdateSize()
{ {
m_checkRequestedSashPosition = true;
SizeWindows(); SizeWindows();
m_checkRequestedSashPosition = false;
} }
bool wxSplitterWindow::DoSendEvent(wxSplitterEvent& event) bool wxSplitterWindow::DoSendEvent(wxSplitterEvent& event)