don't send SPLITTER_POS_CHANGED events when the splitter position was changed from the program itself
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15565 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -244,7 +244,12 @@ protected:
|
||||
int ConvertSashPosition(int sashPos) const;
|
||||
|
||||
// set the real sash position, sashPos here must be positive
|
||||
void DoSetSashPosition(int sashPos);
|
||||
//
|
||||
// returns TRUE if the sash position has been changed, FALSE otherwise
|
||||
bool DoSetSashPosition(int sashPos);
|
||||
|
||||
// set the sash position and send an event about it having been changed
|
||||
void SetSashPositionAndNotify(int sashPos);
|
||||
|
||||
// set the cursor appropriate for the current split mode
|
||||
void SetResizeCursor();
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: splitter.cpp
|
||||
// Name: src/generic/splitter.cpp
|
||||
// Purpose: wxSplitterWindow implementation
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
@@ -243,7 +243,7 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
||||
m_windowOne = m_windowTwo;
|
||||
m_windowTwo = (wxWindow *) NULL;
|
||||
OnUnsplit(removedWindow);
|
||||
DoSetSashPosition(0);
|
||||
SetSashPositionAndNotify(0);
|
||||
}
|
||||
else if ( posSashNew == GetWindowSize() )
|
||||
{
|
||||
@@ -251,16 +251,16 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
||||
wxWindow *removedWindow = m_windowTwo;
|
||||
m_windowTwo = (wxWindow *) NULL;
|
||||
OnUnsplit(removedWindow);
|
||||
DoSetSashPosition(0);
|
||||
SetSashPositionAndNotify(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoSetSashPosition(posSashNew);
|
||||
SetSashPositionAndNotify(posSashNew);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DoSetSashPosition(posSashNew);
|
||||
SetSashPositionAndNotify(posSashNew);
|
||||
}
|
||||
|
||||
SizeWindows();
|
||||
@@ -343,7 +343,7 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
||||
}
|
||||
else
|
||||
{
|
||||
DoSetSashPosition(posSashNew);
|
||||
SetSashPositionAndNotify(posSashNew);
|
||||
m_needUpdating = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -399,12 +399,12 @@ void wxSplitterWindow::OnSize(wxSizeEvent& event)
|
||||
if ( m_splitMode == wxSPLIT_VERTICAL )
|
||||
{
|
||||
if ( m_sashPosition >= (cw - 5) )
|
||||
DoSetSashPosition(wxMax(10, cw - 40));
|
||||
SetSashPositionAndNotify(wxMax(10, cw - 40));
|
||||
}
|
||||
else // m_splitMode == wxSPLIT_HORIZONTAL
|
||||
{
|
||||
if ( m_sashPosition >= (ch - 5) )
|
||||
DoSetSashPosition(wxMax(10, ch - 40));
|
||||
SetSashPositionAndNotify(wxMax(10, ch - 40));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -712,14 +712,22 @@ int wxSplitterWindow::AdjustSashPosition(int sashPos) const
|
||||
return sashPos;
|
||||
}
|
||||
|
||||
void wxSplitterWindow::DoSetSashPosition(int sashPos)
|
||||
bool wxSplitterWindow::DoSetSashPosition(int sashPos)
|
||||
{
|
||||
int newSashPosition = AdjustSashPosition(sashPos);
|
||||
|
||||
if ( newSashPosition != m_sashPosition )
|
||||
{
|
||||
if ( newSashPosition == m_sashPosition )
|
||||
return FALSE;
|
||||
|
||||
m_sashPosition = newSashPosition;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxSplitterWindow::SetSashPositionAndNotify(int sashPos)
|
||||
{
|
||||
if ( DoSetSashPosition(sashPos) )
|
||||
{
|
||||
wxSplitterEvent event(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, this);
|
||||
event.m_data.pos = m_sashPosition;
|
||||
|
||||
|
Reference in New Issue
Block a user