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:
parent
936b18ac29
commit
63ec9dbbac
@ -244,7 +244,12 @@ protected:
|
|||||||
int ConvertSashPosition(int sashPos) const;
|
int ConvertSashPosition(int sashPos) const;
|
||||||
|
|
||||||
// set the real sash position, sashPos here must be positive
|
// 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
|
// set the cursor appropriate for the current split mode
|
||||||
void SetResizeCursor();
|
void SetResizeCursor();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: splitter.cpp
|
// Name: src/generic/splitter.cpp
|
||||||
// Purpose: wxSplitterWindow implementation
|
// Purpose: wxSplitterWindow implementation
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@ -243,7 +243,7 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
|||||||
m_windowOne = m_windowTwo;
|
m_windowOne = m_windowTwo;
|
||||||
m_windowTwo = (wxWindow *) NULL;
|
m_windowTwo = (wxWindow *) NULL;
|
||||||
OnUnsplit(removedWindow);
|
OnUnsplit(removedWindow);
|
||||||
DoSetSashPosition(0);
|
SetSashPositionAndNotify(0);
|
||||||
}
|
}
|
||||||
else if ( posSashNew == GetWindowSize() )
|
else if ( posSashNew == GetWindowSize() )
|
||||||
{
|
{
|
||||||
@ -251,16 +251,16 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
|||||||
wxWindow *removedWindow = m_windowTwo;
|
wxWindow *removedWindow = m_windowTwo;
|
||||||
m_windowTwo = (wxWindow *) NULL;
|
m_windowTwo = (wxWindow *) NULL;
|
||||||
OnUnsplit(removedWindow);
|
OnUnsplit(removedWindow);
|
||||||
DoSetSashPosition(0);
|
SetSashPositionAndNotify(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DoSetSashPosition(posSashNew);
|
SetSashPositionAndNotify(posSashNew);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DoSetSashPosition(posSashNew);
|
SetSashPositionAndNotify(posSashNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
SizeWindows();
|
SizeWindows();
|
||||||
@ -343,7 +343,7 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DoSetSashPosition(posSashNew);
|
SetSashPositionAndNotify(posSashNew);
|
||||||
m_needUpdating = TRUE;
|
m_needUpdating = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -384,7 +384,7 @@ void wxSplitterWindow::OnSize(wxSizeEvent& event)
|
|||||||
iconized = FALSE;
|
iconized = FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( iconized )
|
if ( iconized )
|
||||||
{
|
{
|
||||||
event.Skip();
|
event.Skip();
|
||||||
@ -399,12 +399,12 @@ void wxSplitterWindow::OnSize(wxSizeEvent& event)
|
|||||||
if ( m_splitMode == wxSPLIT_VERTICAL )
|
if ( m_splitMode == wxSPLIT_VERTICAL )
|
||||||
{
|
{
|
||||||
if ( m_sashPosition >= (cw - 5) )
|
if ( m_sashPosition >= (cw - 5) )
|
||||||
DoSetSashPosition(wxMax(10, cw - 40));
|
SetSashPositionAndNotify(wxMax(10, cw - 40));
|
||||||
}
|
}
|
||||||
else // m_splitMode == wxSPLIT_HORIZONTAL
|
else // m_splitMode == wxSPLIT_HORIZONTAL
|
||||||
{
|
{
|
||||||
if ( m_sashPosition >= (ch - 5) )
|
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;
|
return sashPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSplitterWindow::DoSetSashPosition(int sashPos)
|
bool wxSplitterWindow::DoSetSashPosition(int sashPos)
|
||||||
{
|
{
|
||||||
int newSashPosition = AdjustSashPosition(sashPos);
|
int newSashPosition = AdjustSashPosition(sashPos);
|
||||||
|
|
||||||
if ( newSashPosition != m_sashPosition )
|
if ( newSashPosition == m_sashPosition )
|
||||||
{
|
return FALSE;
|
||||||
m_sashPosition = newSashPosition;
|
|
||||||
|
|
||||||
|
m_sashPosition = newSashPosition;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSplitterWindow::SetSashPositionAndNotify(int sashPos)
|
||||||
|
{
|
||||||
|
if ( DoSetSashPosition(sashPos) )
|
||||||
|
{
|
||||||
wxSplitterEvent event(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, this);
|
wxSplitterEvent event(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, this);
|
||||||
event.m_data.pos = m_sashPosition;
|
event.m_data.pos = m_sashPosition;
|
||||||
|
|
||||||
@ -753,7 +761,7 @@ void wxSplitterWindow::SizeWindows()
|
|||||||
|
|
||||||
if ( GetWindow1() && !GetWindow2() )
|
if ( GetWindow1() && !GetWindow2() )
|
||||||
{
|
{
|
||||||
GetWindow1()->SetSize(GetBorderSize(), GetBorderSize(),
|
GetWindow1()->SetSize(GetBorderSize(), GetBorderSize(),
|
||||||
w - 2*GetBorderSize(), h - 2*GetBorderSize());
|
w - 2*GetBorderSize(), h - 2*GetBorderSize());
|
||||||
}
|
}
|
||||||
else if ( GetWindow1() && GetWindow2() )
|
else if ( GetWindow1() && GetWindow2() )
|
||||||
|
Loading…
Reference in New Issue
Block a user