// Position and size subwindows. // Note that the border size applies to each subwindow, not // including the edges next to the sash. void wxSplitterWindow::SizeWindows() { // check if we have delayed setting the real sash position if ( m_checkRequestedSashPosition && m_requestedSashPosition != INT_MAX ) { int newSashPosition = ConvertSashPosition(m_requestedSashPosition); if ( newSashPosition != m_sashPosition ) { DoSetSashPosition(newSashPosition); } if ( newSashPosition <= m_sashPosition && newSashPosition >= m_sashPosition - GetBorderSize() ) { // don't update it any more m_requestedSashPosition = INT_MAX; } } int w, h; GetClientSize(&w, &h); if ( GetWindow1() && !GetWindow2() ) { GetWindow1()->SetSize(GetBorderSize(), GetBorderSize(), w - 2*GetBorderSize(), h - 2*GetBorderSize()); } else if ( GetWindow1() && GetWindow2() ) { const int border = GetBorderSize(), sash = GetSashSize(); int size1 = GetSashPosition() - border, size2 = GetSashPosition() + sash; int x2, y2, w1, h1, w2, h2; if ( GetSplitMode() == wxSPLIT_VERTICAL ) { w1 = size1; w2 = w - 2*border - sash - w1; h1 = h2 = h - 2*border; x2 = size2; y2 = border; } else // horz splitter { w1 = w2 = w - 2*border; h1 = size1; h2 = h - 2*border - sash - h1; x2 = border; y2 = size2; } GetWindow1()->SetSize(border, border, w1, h1); GetWindow2()->SetSize(x2, y2, w2, h2); } wxClientDC dc(this); DrawSash(dc); SetNeedUpdating(false); }
// Position and size subwindows. // Note that the border size applies to each subwindow, not // including the edges next to the sash. void wxSplitWindow::SizeWindows() { // check if we have delayed setting the real sash position if (m_checkRequestedSashPosition && m_requestedSashPosition != INT_MAX) { int newSashPosition = ConvertSashPosition (m_requestedSashPosition); if (newSashPosition != m_sashPosition) DoSetSashPosition (newSashPosition); if (newSashPosition <= m_sashPosition && newSashPosition >= m_sashPosition - GetBorderSize()) { // don't update it any more m_requestedSashPosition = INT_MAX; } } int w, h; GetClientSize(&w, &h); const int border = GetBorderSize(); const int sash = GetSashSize(); if (m_windowOne && m_windowTwo) { int size = GetWindowSize(); int size1; int size2; if (m_sashPosition == 0) { size1 = 0; size2 = size - 2*border; }else if (m_sashPosition > 0 && m_sashPosition < size) { size1 = m_sashPosition - border; size2 = size - m_sashPosition - sash - border; }else{ size1 = size; size2 = 0 - 2*border; } int x2, y2, w1, h1, w2, h2; if (m_splitMode == wxSPLIT_VERTICAL) { w1 = size1; w2 = size2; h1 = h - 2*border; h2 = h1; x2 = size - (size2 - border); y2 = border; } else // horz splitwindow { w1 = w - 2*border; w2 = w1; h1 = size1; h2 = size2; x2 = border; y2 = size - (size2 - border); } m_windowOne->SetSize (border, border, w1, h1); m_windowTwo->SetSize (x2, y2, w2, h2); } wxClientDC dc(this); DrawSash(dc); SetNeedUpdating (false); }