X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1b5dfa53aa2c3ddf779332ca5b1b5bd29f725a84..eff339168e77e6a07d686824ff78df2dc7a866d9:/src/generic/splitter.cpp diff --git a/src/generic/splitter.cpp b/src/generic/splitter.cpp index f4a4107e30..77b246750c 100644 --- a/src/generic/splitter.cpp +++ b/src/generic/splitter.cpp @@ -451,20 +451,23 @@ void wxSplitterWindow::OnSize(wxSizeEvent& event) // Don't do anything if the size didn't really change. if ( size != old_size ) { + int newPosition = -1; + // Apply gravity if we use it. int delta = (int) ( (size - old_size)*m_sashGravity ); if ( delta != 0 ) { - int newPosition = m_sashPosition + delta; + newPosition = m_sashPosition + delta; if( newPosition < m_minimumPaneSize ) newPosition = m_minimumPaneSize; - SetSashPositionAndNotify(newPosition); } // Also check if the second window became too small. - int adjustedPosition = AdjustSashPosition(m_sashPosition); - if ( adjustedPosition != m_sashPosition ) - SetSashPositionAndNotify(adjustedPosition); + newPosition = AdjustSashPosition(newPosition == -1 + ? m_sashPosition + : newPosition); + if ( newPosition != m_sashPosition ) + SetSashPositionAndNotify(newPosition); } } @@ -493,7 +496,18 @@ bool wxSplitterWindow::SashHitTest(int x, int y, int tolerance) return z >= hitMin && z <= hitMax; } +void wxSplitterWindow::SetSashInvisible(bool invisible) +{ + if ( IsSashInvisible() != invisible ) + ToggleWindowStyle(wxSP_NOSASH); +} + int wxSplitterWindow::GetSashSize() const +{ + return IsSashInvisible() ? 0 : GetDefaultSashSize(); +} + +int wxSplitterWindow::GetDefaultSashSize() const { return wxRendererNative::Get().GetSplitterParams(this).widthSash; } @@ -519,7 +533,7 @@ void wxSplitterWindow::DrawSash(wxDC& dc) return; // nor if we're configured to not show it - if ( HasFlag(wxSP_NOSASH) ) + if ( IsSashInvisible() ) return; wxRendererNative::Get().DrawSplitterSash