void CSplitterWndEx::ShowPane(CWnd * pWnd,BOOL bShow) { if(m_pwnd1==NULL){ m_pwnd1=GetPane(0,0); m_pwnd2=GetPane(!IsHorizontal(),IsHorizontal()); } ASSERT(pWnd==m_pwnd1 || pWnd==m_pwnd2); int &nRowCols=IsHorizontal()?m_nCols:m_nRows; if(bShow){ if(!pWnd->IsWindowVisible()){ if(m_bParentHide){ ((CSplitterWndEx *)GetParent())->ShowPane(this,TRUE); // Ensure the correct pane reappears if(GetPane(0,0)!=pWnd){ // Need to swap the entries SwapRowColInfo(); } m_bParentHide=FALSE; } else { // maybe nothing to do nRowCols++; if(pWnd==m_pwnd1){ // Need to swap the entries SwapRowColInfo(); } } pWnd->ShowWindow(SW_SHOW); } if(pWnd==m_pwnd1){ m_pwnd1->SetDlgCtrlID(AFX_IDW_PANE_FIRST); m_pwnd2->SetDlgCtrlID(AFX_IDW_PANE_FIRST+(IsHorizontal()?1:16)); } } else { if(pWnd->IsWindowVisible()){ pWnd->ShowWindow(SW_HIDE); if(nRowCols == 1) { m_bParentHide=TRUE; ((CSplitterWndEx *)GetParent())->ShowPane(this,FALSE); } else { // Both panes currently active int rowActive, colActive; if (GetActivePane(&rowActive, &colActive) != NULL && pWnd==GetPane(rowActive, colActive)){ int bHorz=IsHorizontal(); SetActivePane((!bHorz)&(rowActive^1), (bHorz)&(colActive^1)); } if(pWnd==m_pwnd1){ SwapRowColInfo(); m_pwnd2->SetDlgCtrlID(AFX_IDW_PANE_FIRST); m_pwnd1->SetDlgCtrlID(AFX_IDW_PANE_FIRST+1); } nRowCols--; } } } RecalcLayout(); }
void CTabSplitterWnd::OnSetFocus(CWnd* pOldWnd) { CSplitterWnd::OnSetFocus(pOldWnd); // TODO: Add your message handler code here if (m_nCurRow >= 0 && m_nCurCol >= 0) { SetActivePane(m_nCurRow,m_nCurCol); CWnd *pWnd = GetPane(m_nCurRow,m_nCurCol); pWnd->SetFocus(); } }
void CTabSplitterWnd::StopTracking(BOOL bAccept) { // save old active view CWnd* pOldActiveView = GetActivePane(); CSplitterWnd::StopTracking(bAccept); if (bAccept) { if (pOldActiveView == GetActivePane()) { if (pOldActiveView == NULL) { if (m_nCols > 1) SetActivePane(0, 1); // pOldActiveView->SetFocus(); // make sure focus is restored if (m_nRows > 1) SetActivePane(0, 0); } } SaveSize(); } }
void CTabSplitterWnd::ActivateNext(BOOL bPrev) { ASSERT_VALID(this); // find the coordinate of the current pane int row, col; if (GetActivePane(&row, &col) == NULL) { SetActivePane(0,0); return; } ASSERT(row >= 0 && row < m_nRows); ASSERT(col >= 0 && col < m_nCols); // determine next pane if (bPrev) { // prev if (--col < 0) { col = m_nCols - 1; if (--row < 0) row = m_nRows - 1; } } else { // next if (++col >= m_nCols) { col = 0; if (++row >= m_nRows) row = 0; } } // set newly active pane SetActivePane(row, col); }
void CCustInfoSplitterWnd ::HideColumn(int nColHide) { ASSERT_VALID( this ); ASSERT( m_nCols > 1 ); ASSERT( nColHide < m_nCols ); ASSERT( m_nHiddenCol == -1 ); m_nHiddenCol = nColHide; // if the column has an active window -- change it int nActiveRow, nActiveCol; if( GetActivePane( &nActiveRow, &nActiveCol ) != NULL ) { if( nActiveCol == nColHide ) { if( ++nActiveCol >= m_nCols ) nActiveCol = 0; SetActivePane( nActiveRow, nActiveCol ); } } // hide all column panes for( int nRow = 0; nRow < m_nRows; nRow++) { CWnd* pPaneHide = GetPane(nRow, nColHide); ASSERT( pPaneHide != NULL ); pPaneHide->ShowWindow(SW_HIDE); pPaneHide->SetDlgCtrlID( AFX_IDW_PANE_FIRST+nRow +16*m_nCols ); for( int nCol = nColHide + 1; nCol < m_nCols; nCol++ ) { CWnd* pPane = GetPane( nRow, nCol ); ASSERT( pPane != NULL ); pPane->SetDlgCtrlID( IdFromRowCol( nRow, nCol - 1 )); } } m_nCols--; m_pColInfo[m_nCols].nCurSize = m_pColInfo[nColHide].nCurSize; RecalcLayout(); }
void CWinDiffSplitterWnd::setActivePanel(int index) { if(index >= 0 && index < getPanelCount()) { SetActivePane(0,index); } }
void CDynSplitterWnd::StopTracking(BOOL bAccept) { ASSERT_VALID(this); if (!m_bTracking) return; ReleaseCapture(); // erase tracker rectangle OnInvertTracker(m_rectTracker); if (m_bTracking2) OnInvertTracker(m_rectTracker2); m_bTracking = m_bTracking2 = FALSE; // save old active view CWnd* pOldActiveView = GetActivePane(); // m_rectTracker is set to the new splitter position (without border) // (so, adjust relative to where the border will be) m_rectTracker.OffsetRect(-CX_BORDER , -CY_BORDER); m_rectTracker2.OffsetRect(-CX_BORDER, -CY_BORDER); if (bAccept) { if (m_htTrack == vSplitterBox) { SplitRow(m_rectTracker.top); } else if (m_htTrack >= vSplitterBar1 && m_htTrack <= vSplitterBar15) { // set row height TrackRowSize(m_rectTracker.top, m_htTrack - vSplitterBar1); RecalcLayout(); } else if (m_htTrack == hSplitterBox) { SplitColumn(m_rectTracker.left); } else if (m_htTrack >= hSplitterBar1 && m_htTrack <= hSplitterBar15) { // set column width TrackColumnSize(m_rectTracker.left, m_htTrack - hSplitterBar1); RecalcLayout(); } else if (m_htTrack >= splitterIntersection1 && m_htTrack <= splitterIntersection225) { // set row height and column width int row = (m_htTrack - splitterIntersection1) / 15; int col = (m_htTrack - splitterIntersection1) % 15; TrackRowSize(m_rectTracker.top, row); TrackColumnSize(m_rectTracker2.left, col); RecalcLayout(); } else if (m_htTrack == bothSplitterBox) { // rectTracker is vSplitter (splits rows) // rectTracker2 is hSplitter (splits cols) SplitRow(m_rectTracker.top); SplitColumn(m_rectTracker2.left); } } if ( (pOldActiveView == GetActivePane()) && (pOldActiveView != NULL) ) SetActivePane(-1, -1, pOldActiveView); // re-activate }