From: Vadim Zeitlin Date: Sun, 20 Jun 1999 21:32:00 +0000 (+0000) Subject: splitter doesn't change position when the window containing it is minimized and restored X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/a8731351d8adaddd2969f3c3570664b8589b6c88 splitter doesn't change position when the window containing it is minimized and restored git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2836 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/splitter.cpp b/src/generic/splitter.cpp index b458a92561..c0228dd890 100644 --- a/src/generic/splitter.cpp +++ b/src/generic/splitter.cpp @@ -352,24 +352,54 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) } } -void wxSplitterWindow::OnSize(wxSizeEvent& WXUNUSED(event)) +void wxSplitterWindow::OnSize(wxSizeEvent& event) { - int cw, ch; - GetClientSize( &cw, &ch ); - if ( m_windowTwo ) + // only process this message if we're not iconized - otherwise iconizing + // and restoring a window containing the splitter has a funny side effect + // of changing the splitter position! + wxWindow *parent = GetParent(); + while ( parent && !parent->IsTopLevel() ) { - if ( m_splitMode == wxSPLIT_VERTICAL ) - { - if ( m_sashPosition >= (cw - 5) ) - m_sashPosition = wxMax(10, cw - 40); - } - if ( m_splitMode == wxSPLIT_HORIZONTAL ) + parent = parent->GetParent(); + } + + bool iconized = false; + wxFrame *frame = wxDynamicCast(parent, wxFrame); + if ( frame ) + iconized = frame->IsIconized(); + else + { + wxDialog *dialog = wxDynamicCast(parent, wxDialog); + if ( dialog ) + iconized = dialog->IsIconized(); + else + wxFAIL_MSG(_T("should have a top level frame or dialog parent!")); + } + + if ( iconized ) + { + event.Skip(); + } + else + { + int cw, ch; + GetClientSize( &cw, &ch ); + if ( m_windowTwo ) { - if ( m_sashPosition >= (ch - 5) ) - m_sashPosition = wxMax(10, ch - 40); + if ( m_splitMode == wxSPLIT_VERTICAL ) + { + if ( m_sashPosition >= (cw - 5) ) + m_sashPosition = wxMax(10, cw - 40); + } + if ( m_splitMode == wxSPLIT_HORIZONTAL ) + { + if ( m_sashPosition >= (ch - 5) ) + m_sashPosition = wxMax(10, ch - 40); + } } + + SizeWindows(); } - SizeWindows(); } bool wxSplitterWindow::SashHitTest(int x, int y, int tolerance)