//----- OnInitialUpdate() --------------------------------------------------- LRESULT BCTabBarCtrl::OnInitialUpdate(WPARAM wParam, LPARAM lParam) { HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); SetFont(CFont::FromHandle(hFont)); ASSERT(m_pParentFrame); ASSERT(IsWindow(*m_pParentFrame)); int iSel = GetCurSel(); ASSERT(iSel > -1); CWnd* pView = GetViewFromItem(iSel); pView->SetDlgCtrlID(AFX_IDW_PANE_FIRST); m_pParentFrame->RecalcLayout(); m_pParentFrame->SetActiveView((CView*)pView); pView = m_pParentFrame->GetActiveView(); m_bSendInitialUpdate = TRUE; CRect rectItem; GetItemRect(0, rectItem); m_cyDefault = rectItem.Height() + CLIENT_FUDGE; return 0; }
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(); }
//----- OnSizeParent() ------------------------------------------------------ void BCTabBarCtrl::OnSelchange(NMHDR* pNMHDR, LRESULT* pResult) { int iSel = GetCurSel(); ASSERT(m_pParentFrame); ASSERT(IsWindow(*m_pParentFrame)); /**** JohnCz ***/ // get current view CWnd *pViewCurrent = m_pParentFrame->GetDlgItem(AFX_IDW_PANE_FIRST); if (pViewCurrent != NULL) { ASSERT(pViewCurrent); ASSERT(IsWindow(*pViewCurrent)); /**** JohnCz ***/ // retrieve original ID UINT uiID = GetViewTabID(pViewCurrent); pViewCurrent->SetDlgCtrlID(uiID); pViewCurrent->ShowWindow(SW_HIDE); } /**** JohnCz ***/ // get View for selected tab CWnd *pNewViewWnd = GetViewFromItem(iSel); ASSERT(pNewViewWnd); ASSERT(IsWindow(*pNewViewWnd)); /**** JohnCz ***/ // make view current pNewViewWnd->SetDlgCtrlID(AFX_IDW_PANE_FIRST); pNewViewWnd->ShowWindow(SW_SHOW); m_pParentFrame->RecalcLayout(); ((CNifUtilsSuiteFrame*) m_pParentFrame)->SetActiveView((CView*)pNewViewWnd); *pResult = 0; }
void CCustInfoSplitterWnd ::ShowColumn() { ASSERT_VALID( this ); ASSERT( m_nCols < m_nMaxCols ); ASSERT( m_nHiddenCol != -1 ); int nShowCol = m_nHiddenCol; m_nHiddenCol = -1; int cxNew = m_pColInfo[m_nCols].nCurSize; m_nCols++; // add a column ASSERT( m_nCols == m_nMaxCols ); int nCol; // Show the hidden column for( int nRow = 0; nRow < m_nRows; ++nRow ) { CWnd* pPaneShow = GetDlgItem( AFX_IDW_PANE_FIRST+nRow +16*m_nCols ); ASSERT( pPaneShow != NULL ); pPaneShow->ShowWindow( SW_SHOWNA ); for( nCol = m_nCols - 2; nCol >= nShowCol; --nCol ) { CWnd* pPane = GetPane( nRow, nCol ); ASSERT( pPane != NULL ); pPane->SetDlgCtrlID( IdFromRowCol( nRow, nCol + 1 )); } pPaneShow->SetDlgCtrlID( IdFromRowCol( nRow, nShowCol )); } // new panes have been created -- recalculate layout for( nCol = nShowCol+1; nCol < m_nCols; nCol++ ) m_pColInfo[nCol].nIdealSize = m_pColInfo[nCol - 1].nCurSize; /* m_pColInfo[nShowCol].nIdealSize = cxNew;*/ RecalcLayout(); }
int AW_CMultiViewSplitter::HideCurrentView(int nRow, int nCol) { int prevID; CWnd * pCurView = GetCurrentView(nRow, nCol, &prevID); if (pCurView == NULL) return -1; else { pCurView->SetDlgCtrlID(0); pCurView->ShowWindow(SW_HIDE); return prevID; } }
void AW_CMultiViewSplitter::SetCurrentView(int nRow, int nCol, int nViewID) { long paneID = MAKELONG(nRow,nCol); map<long, int>::iterator itCur; itCur = m_mapCurrentViews.find(paneID); if (itCur != m_mapCurrentViews.end()) (*itCur).second = nViewID; else m_mapCurrentViews.insert(map<long,int>::value_type(paneID,nViewID)); CWnd * pView = GetView(nViewID); pView->SetDlgCtrlID(IdFromRowCol(nRow, nCol)); pView->ShowWindow(SW_SHOW); }
BOOL CGamDlg::OnInitDialog() { CDialog::OnInitDialog(); CRect rect; CWnd *pWnd =GetDlgItem(IDC_G3D_BUTTON1); pWnd->SetDlgCtrlID(0xffff); pWnd->GetWindowRect(rect); ScreenToClient(&rect); m_Video.Create(NULL,NULL,WS_CHILD|WS_VISIBLE,rect,this,IDC_G3D_BUTTON1); m_Video.Play(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CSplitterWndEx::ShowRow(int r) { ASSERT_VALID(this); ASSERT(m_nRows < m_nMaxRows); ASSERT(m_arr); ASSERT(r < m_length); ASSERT(m_arr[r] >= m_nRows); ASSERT(m_arr[r] < m_length); int rowNew = r; int cyNew = m_pRowInfo[m_arr[r]].nCurSize; int cyIdealNew = m_pRowInfo[m_arr[r]].nIdealSize; int new_val = 0; for (int i = rowNew - 1; i >= 0; i--) if (m_arr[i] < m_nRows) // not hidden { new_val = m_arr[i] + 1; break; } int old_val = m_arr[rowNew]; m_nRows++; // add a row // fill the hided row int row; for (int col = 0; col < m_nCols; col++) { CWnd* pPaneShow = GetDlgItem( Id_short(old_val, col)); ASSERT(pPaneShow != NULL); pPaneShow->ShowWindow(SW_SHOWNA); for (row = m_length - 1; row >= 0; row--) { if ((m_arr[row] >= new_val) && (m_arr[row] < old_val)) { CWnd* pPane = CSplitterWnd::GetPane(m_arr[row], col); ASSERT(pPane != NULL); pPane->SetDlgCtrlID(Id_short(m_arr[row] + 1, col)); } } pPaneShow->SetDlgCtrlID(Id_short(new_val, col)); } for (row = 0; row < m_length; row++) if ((m_arr[row] >= new_val) && (m_arr[row] < old_val)) m_arr[row]++; m_arr[rowNew] = new_val; //new panes have been created -- recalculate layout for (row = new_val + 1; row < m_length; row++) { if (m_arr[row]<m_nRows) { m_pRowInfo[m_arr[row]].nIdealSize = m_pRowInfo[m_arr[row-1]].nCurSize; m_pRowInfo[m_arr[row]].nCurSize = m_pRowInfo[m_arr[row-1]].nCurSize; } } if (cyNew>=0x10000) { int rowToResize=(cyNew>>16)-1; cyNew%=0x10000; cyIdealNew%=0x10000; m_pRowInfo[m_arr[rowToResize]].nCurSize-=cyNew+m_cxSplitter; m_pRowInfo[m_arr[rowToResize]].nIdealSize=m_pRowInfo[m_arr[rowToResize]].nCurSize;//-=cyIdealNew+m_cxSplitter; }
// RemoveView contains certain guards to tell whenever attempted remove is not valid //----- OnSizeParent() ------------------------------------------------------ BOOL BCTabBarCtrl::RemoveView(int iItem) { ASSERT(::IsWindow(m_hWnd)); int iCount = GetItemCount(); /**** JohnCz ***/ // if this fires, it is an attempt to remove view that does not exist or the last view ASSERT((iCount > iItem) || (iCount > 1) || (iItem > 0)); // return FALSE to continue working if((iCount <= iItem) || (iCount < 2)) { return FALSE; } BARTCITEM item; item.hdr.mask = TCIF_PARAM; VERIFY(GetItem(iItem, (TCITEMHEADER*)&item)); ASSERT(item.pWnd); ASSERT(IsWindow(*item.pWnd)); int iTabItem = -1; CWnd *pNewView = NULL; CWnd *pRemoveView = item.pWnd; // just to simplify int iSetCurr = iItem + 1; /**** JohnCz ***/ // this will set active tab either after or if tab does not exist before removed one if(AFX_IDW_PANE_FIRST == pRemoveView->GetDlgCtrlID()) //removing active? { /**** JohnCz ***/ // to set active tab after removed pNewView = GetViewFromItem(iSetCurr); // is it last tab? if so set tab before if(NULL == pNewView) { iSetCurr = iItem - 1; // attempt to set active tab before removved pNewView = GetViewFromItem(iSetCurr); } } m_mapUsedID.RemoveKey(item.uiID); pRemoveView->DestroyWindow(); /**** JohnCz ***/ // we just removed active, set new view. if(pNewView) { pNewView->SetDlgCtrlID(AFX_IDW_PANE_FIRST); pNewView->ShowWindow(SW_SHOW); SetCurSel(iSetCurr); m_pParentFrame->RecalcLayout(); pNewView->SetFocus(); } return (BOOL)::SendMessage(m_hWnd, TCM_DELETEITEM, iItem, 0L); }