vector <CCoolDialogBar *> CCoolDialogBar::AllVisibleNeighbours(int *OwnIndex) { vector <CCoolDialogBar *> ret; CDockBar *pDockBar = (CDockBar*)GetParent(); ASSERT_KINDOF(CDockBar , pDockBar); bool row = false; CPtrArray *bars = &pDockBar->m_arrBars; for (int i = 0; i < bars->GetSize(); i++) { //CControlBar *pBar = pDockBar->GetDockedControlBar(i); CControlBar* pBar = (CControlBar*)pDockBar->m_arrBars[i]; if (HIWORD(pBar) == 0) pBar = NULL; if (!pBar) { if (row) break; ret.clear(); continue; } if (!pBar->IsVisible()) continue; if (this == pBar) { row = true; if (OwnIndex) *OwnIndex = ret.size(); } ret.push_back((CCoolDialogBar*)pBar); } return ret; }
BOOL CMainFrame::OnBarCheckEx(UINT nID) { int count = m_wndSplitter.GetRowCount (); for ( int i = 0 ; i < count ; i++ ) { (m_wndSplitter.GetPane(i, 0))->InvalidateRect(NULL); } //vls-begin// multiple output CControlBar* pBar = GetControlBar(nID); if (pBar != NULL) { BOOL bVisible = (pBar->GetStyle() & WS_VISIBLE); for (int i = 0; i < MAX_OUTPUT; i++) { if (nID == outputwindows[i]) { m_coolBar[i].m_bFlag = !bVisible; break; } } } //vls-end// return OnBarCheck(nID); }
DWORD CFrameWnd::CanDock( CRect rect, DWORD dwDockStyle, CDockBar **ppDockBar ) /*****************************************************************************/ { POSITION position = m_listControlBars.GetHeadPosition(); while( position != NULL ) { CControlBar *pControlBar = (CControlBar *)m_listControlBars.GetNext( position ); ASSERT( pControlBar != NULL ); if( pControlBar->IsDockBar() && (pControlBar->GetBarStyle() & dwDockStyle) ) { CDockBar *pDockBar = (CDockBar *)pControlBar; ASSERT( pDockBar->IsKindOf( RUNTIME_CLASS( CDockBar ) ) ); if( !pDockBar->m_bFloating || (pDockBar->GetBarStyle() & CBRS_FLOAT_MULTI) ) { CRect rectBar; pDockBar->GetWindowRect( &rectBar ); RECT rectJunk; if( rectBar.left == rectBar.right ) { rectBar.right++; } if( rectBar.top == rectBar.bottom ) { rectBar.bottom++; } if( ::IntersectRect( &rectJunk, &rect, &rectBar ) ) { if( ppDockBar != NULL ) { *ppDockBar = pDockBar; } return( pDockBar->GetBarStyle() & dwDockStyle ); } } } } return( 0L ); }
void CExtDockBar::_ContextMenuTrack() { // find any control bar CControlBar * pBar = NULL; for( int nPos = 0; nPos < m_arrBars.GetSize(); nPos++ ) { pBar = GetDockedControlBar(nPos); if( pBar != NULL ) { ASSERT_VALID( pBar ); break; } } if( pBar == NULL ) return; CFrameWnd * pFrame = _GetDockingFrameImpl(); CPoint point; VERIFY( ::GetCursorPos(&point) ); CExtPopupMenuWnd * pPopup = new CExtPopupMenuWnd; VERIFY( pPopup->CreatePopupMenu( pBar->GetOwner()->GetSafeHwnd() ) ); _ContextMenuBuild( pFrame, pPopup ); pPopup->TrackPopupMenu( 0, point.x,point.y, pBar->GetOwner()->GetSafeHwnd() // pFrame->GetSafeHwnd() ); }
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) { if (pMsg->message == WM_RBUTTONDOWN) { CWnd* pWnd = CWnd::FromHandlePermanent(pMsg->hwnd); CControlBar* pBar = DYNAMIC_DOWNCAST(CControlBar, pWnd); if (pBar != NULL) { CMenu Menu; CPoint pt; pt.x = LOWORD(pMsg->lParam); pt.y = HIWORD(pMsg->lParam); pBar->ClientToScreen(&pt); if (Menu.LoadMenu(IDR_TOOLBAR)) { CMenu* pSubMenu = Menu.GetSubMenu(0); if (pSubMenu!=NULL) { pSubMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,pt.x,pt.y,this); } } } } return CFrameWnd::PreTranslateMessage(pMsg); }
void CMainFrame::OnUpdateTabbar(CCmdUI* pCmdUI) { CControlBar* pBar = (CControlBar*)&m_wndTabBar ; if (pBar != NULL) { pCmdUI->SetCheck((pBar->GetStyle() & WS_VISIBLE) != 0); } }
void COXDockTabCtrl::ShowSelectedTab() { int iSelected = GetCurSel(); // Show first for (int i = 0; i < GetItemCount(); i++) { CControlBar* pBar = GetBar(i); if (iSelected == i) { pBar->GetDockingFrame()->ShowControlBar(pBar, TRUE, TRUE); // show } else { pBar->GetDockingFrame()->ShowControlBar(pBar, FALSE, TRUE); // hide } } CRect rect; m_pSizeDockBar->GetClientRect(rect); CControlBar* pBar = GetBar(iSelected); if (pBar != NULL) { COXSizeControlBar* pSizeBar = DYNAMIC_DOWNCAST(COXSizeControlBar, pBar); if (m_pSizeDockBar->IsBarHorizontal()) { if (m_pLastSelectedBar != NULL) { pSizeBar->m_HorzDockSize.cx = m_pLastSelectedBar->m_HorzDockSize.cx; } m_pLastSelectedBar = pSizeBar; } else // vertical { CFrameWnd* pMF = (CFrameWnd*) GetParentFrame();//AfxGetMainWnd(); if (pMF != NULL) { if (pMF->GetControlBar(AFX_IDW_DOCKBAR_LEFT) == m_pSizeDockBar) rect.right -= 3; if (pMF->GetControlBar(AFX_IDW_DOCKBAR_RIGHT) == m_pSizeDockBar) rect.left += 4; } rect.bottom -= m_pSizeDockBar->GetTabHeight(); pBar->MoveWindow(rect, TRUE); COXSizeControlBar* pSizeBar = DYNAMIC_DOWNCAST(COXSizeControlBar, pBar); if (pSizeBar) { pSizeBar->m_VertDockSize.cx = rect.Width(); pSizeBar->m_VertDockSize.cy = rect.Height() + 5; } } } }
// Inserts the given control bar as a new tab void COXDockTabCtrl::InsertTab(CControlBar* pBar, int iIndex, BOOL bShowSelectedTab) { // If this is the only control bar in the dock bar do nothing int iSizeControlBarCount = m_pSizeDockBar->GetSizeControlBarCount(pBar); if (iSizeControlBarCount == 0) return; // Add a tab for all other size control bars that are docked but not tabbed int i = 0; for (i = 0; i < m_pSizeDockBar->m_arrBars.GetSize(); i++) { COXSizeControlBar* pSizeBar = DYNAMIC_DOWNCAST(COXSizeControlBar, m_pSizeDockBar->GetDockedControlBar(i)); if (pSizeBar != NULL && pSizeBar != pBar && FindTab(pSizeBar) == -1) { CString strTextOther; pSizeBar->GetWindowText(strTextOther); TCITEM tciOther; tciOther.mask = TCIF_TEXT | TCIF_PARAM; tciOther.pszText = strTextOther.GetBuffer(strTextOther.GetLength()); tciOther.lParam = (LPARAM) pSizeBar; //Check added for visibility so that hidden control //bars don't get shown - Nish - Feb 15th 2005 if(pSizeBar->IsWindowVisible()) InsertItem(0, &tciOther); } } // Insert this control bar to the tab control CString strText; pBar->GetWindowText(strText); TCITEM tci; tci.mask = TCIF_TEXT | TCIF_PARAM; tci.pszText = strText.GetBuffer(strText.GetLength()); tci.lParam = (LPARAM) pBar; InsertItem(iIndex, &tci); SetCurSel(iIndex); // Reshresh the tab control m_pSizeDockBar->PositionTabCtrl(); if (bShowSelectedTab) ShowSelectedTab(); else { int iSelected = GetCurSel(); for (i = 0; i < GetItemCount(); i++) { CControlBar* pBar = GetBar(i); if (iSelected != i) pBar->GetDockingFrame()->ShowControlBar(pBar, FALSE, TRUE); // hide } } }
void CMainFrame::OnTabbar() { CControlBar* pBar = (CControlBar*)&m_wndTabBar ; if( pBar ) { ShowControlBar( pBar, (pBar->GetStyle() & WS_VISIBLE) == 0, FALSE ) ; } }
void CMainFrame::OnViewEditingtoolbar() { CControlBar *pBar = DYNAMIC_DOWNCAST(CControlBar,&m_wndEditBar); if(pBar) { ShowControlBar(pBar, (pBar->GetStyle() & WS_VISIBLE) == 0, FALSE); } }
void CMainFrame::OnUpdateFcToolBarMenu(CCmdUI* pCmdUI) { CControlBar* pBar = GetControlBar(IDR_FORMAT); if (pBar != NULL) { pCmdUI->SetCheck((pBar->GetStyle() & WS_VISIBLE) != 0); return; } pCmdUI->ContinueRouting(); }
CExtControlBar * CExtMiniDockFrameWnd::GetControlBarExt() { CControlBar * pTempWnd = GetControlBar(); if( pTempWnd == NULL ) return NULL; // ASSERT_KINDOF( CExtControlBar, pTempWnd ); if( !pTempWnd->IsKindOf( RUNTIME_CLASS(CExtControlBar) ) ) return NULL; return reinterpret_cast < CExtControlBar * >( pTempWnd ); }
void CMainFrame::OnUpdateViewEditingtoolbar(CCmdUI* pCmdUI) { CControlBar *pBar = DYNAMIC_DOWNCAST(CControlBar,&m_wndEditBar); if (pBar != NULL) { pCmdUI->SetCheck((pBar->GetStyle() & WS_VISIBLE) != 0); return; } }
BOOL CMainFrame::OnToggleFcToolBar(UINT nID) { CControlBar* pBar = GetControlBar(IDR_FORMAT); if (pBar != NULL) { ShowControlBar(pBar, (pBar->GetStyle() & WS_VISIBLE) == 0, FALSE); return TRUE; } return FALSE; }
void CFrameWnd::OnUpdateControlBarMenu( CCmdUI *pCmdUI ) /******************************************************/ { CControlBar *pBar = GetControlBar( pCmdUI->m_nID ); if( pBar != NULL ) { pCmdUI->SetCheck( pBar->IsWindowVisible() ? 1 : 0 ); } else { pCmdUI->ContinueRouting(); } }
BOOL CFrameWnd::OnBarCheck( UINT nID ) /************************************/ { CControlBar *pBar = GetControlBar( nID ); if( pBar == NULL ) { return( FALSE ); } ShowControlBar( pBar, !pBar->IsWindowVisible(), FALSE ); return( TRUE ); }
BOOL CGuiDocBarExtenEx::_IsMenuBar(int nPos, CPtrArray& arrBars) { if (nPos < arrBars.GetSize()) { CControlBar* pBar = (CControlBar*)arrBars[nPos]; if (pBar && pBar->GetDlgCtrlID() == AFX_IDW_MENUBAR) return TRUE; else return FALSE; } else return FALSE; }
void CDockBar::ShowAll(BOOL bShow) { for (int nPos = 0; nPos < m_arrBars.GetSize(); nPos++) { CControlBar* pBar = (CControlBar*)m_arrBars[nPos]; if (pBar != NULL) { CFrameWnd* pFrameWnd = pBar->GetDockingFrame(); pFrameWnd->ShowControlBar(pBar, bShow, TRUE); } } }
int CDockBar::GetDockedVisibleCount() const { int nCount = 0; for (int i = 0; i < m_arrBars.GetSize(); i++) { CControlBar* pBar = (CControlBar*)m_arrBars[i]; ASSERT(pBar == NULL || pBar->IsKindOf(RUNTIME_CLASS(CControlBar))); if (pBar != NULL && pBar->IsVisible()) nCount++; } return nCount; }
//vls-begin// multiple output LONG CMainFrame::OnShowOutput(UINT wParam, LONG lParam) { int wnd = (int)wParam; int opt = (int)lParam; UINT nId = outputwindows[wnd]; CControlBar* pBar = GetControlBar(nId); if (pBar != NULL && opt > 0) { BOOL bVisible = (pBar->GetStyle() & WS_VISIBLE); if ( (opt>1 && bVisible) || (opt==1 && !bVisible) ) return 0; } return SendMessage(WM_COMMAND, nId, 0); }
CControlBar *CFrameWnd::GetControlBar( UINT nID ) /***********************************************/ { POSITION position = m_listControlBars.GetHeadPosition(); while( position != NULL ) { CControlBar *pBar = (CControlBar *)m_listControlBars.GetNext( position ); ASSERT( pBar != NULL ); ASSERT( pBar->IsKindOf( RUNTIME_CLASS( CControlBar ) ) ); if( pBar->GetDlgCtrlID() == nID ) { return( pBar ); } } return( NULL ); }
BOOL CMainFrame::OnBarCheck(UINT nID) { ASSERT(ID_VIEW_STATUS_BAR == AFX_IDW_STATUS_BAR); ASSERT(ID_VIEW_TOOLBAR == AFX_IDW_TOOLBAR); ASSERT(ID_VIEW_REBAR == AFX_IDW_REBAR); CControlBar* pBar = GetControlBar(nID); if (pBar != NULL) { ShowControlBar(pBar, (pBar->GetStyle() & WS_VISIBLE) == 0, FALSE); return TRUE; } return FALSE; }
void CMainFrame::OnUpdateControlBarMenu(CCmdUI* pCmdUI) { ASSERT(ID_VIEW_STATUS_BAR == AFX_IDW_STATUS_BAR); ASSERT(ID_VIEW_TOOLBAR == AFX_IDW_TOOLBAR); ASSERT(ID_VIEW_REBAR == AFX_IDW_REBAR); CControlBar* pBar = GetControlBar(pCmdUI->m_nID); if (pBar != NULL) { pCmdUI->SetCheck((pBar->GetStyle() & WS_VISIBLE) != 0); return; } pCmdUI->ContinueRouting(); }
void CSizingControlBar::GetRowSizingBars(CSCBArray& arrSCBars) { arrSCBars.RemoveAll(); int nFirst, nLast, nThis; GetRowInfo(nFirst, nLast, nThis); for (int i = nFirst; i <= nLast; i++) { CControlBar* pBar = (CControlBar*)m_pDockBar->m_arrBars[i]; if (HIWORD(pBar) == 0) continue; // placeholder if (!pBar->IsVisible()) continue; if (FindSizingBar(pBar) >= 0) arrSCBars.Add((CSizingControlBar*)pBar); } }
CSize CSizableReBar::CalcFixedLayout( BOOL bStretch, BOOL bHorz ) { // ASSERT( bStretch ); // the bar is stretched (is not the child of a dockbar) REBARBANDINFO rbbi; rbbi.cbSize = sizeof( rbbi ); rbbi.fMask = RBBIM_CHILD | RBBIM_STYLE; for ( UINT nBand = 0; nBand < m_rbCtrl.GetBandCount(); nBand++ ) { VERIFY( m_rbCtrl.GetBandInfo( nBand, &rbbi ) ); CControlBar* pBar = DYNAMIC_DOWNCAST( CControlBar, CWnd::FromHandlePermanent( rbbi.hwndChild ) ); BOOL bWindowVisible = ( pBar != 0 ) ? pBar->IsVisible() : ( ( ::GetWindowLong( rbbi.hwndChild, GWL_STYLE ) & WS_VISIBLE ) != 0 ); BOOL bBandVisible = !( rbbi.fStyle & RBBS_HIDDEN ); if ( bWindowVisible != bBandVisible ) { VERIFY( m_rbCtrl.ShowBand( nBand, bWindowVisible ) ); } } CRect rcReBar; m_rbCtrl.GetWindowRect( rcReBar ); CSize szCurrent( ( bHorz && bStretch ) ? 32767 : rcReBar.Width(), ( !bHorz && bStretch ) ? 32767 : rcReBar.Height() ); if ( m_dwStyle & CBRS_ORIENT_VERT ) { if ( !m_bLocked && ( szCurrent.cx > 0 ) ) { szCurrent.cx += m_cxEdge; } } if ( m_dwStyle & CBRS_ORIENT_HORZ ) { if ( !m_bLocked && ( szCurrent.cy > 0 ) ) { szCurrent.cy += m_cyEdge; } } return szCurrent; }
void CSizingControlBar::AlignControlBars() { int nFirst, nLast, nThis; GetRowInfo(nFirst, nLast, nThis); BOOL bHorz = IsHorzDocked(); BOOL bNeedRecalc = FALSE; int nPos, nAlign = bHorz ? -2 : 0; CRect rc, rcDock; m_pDockBar->GetWindowRect(&rcDock); for (int i = nFirst; i <= nLast; i++) { CControlBar* pBar = (CControlBar*)m_pDockBar->m_arrBars[i]; if (HIWORD(pBar) == 0) continue; // placeholder if (!pBar->IsVisible()) continue; pBar->GetWindowRect(&rc); rc.OffsetRect(-rcDock.TopLeft()); if ((nPos = FindSizingBar(pBar)) >= 0) rc = CRect(rc.TopLeft(), bHorz ? m_arrBars[nPos]->m_szHorz : m_arrBars[nPos]->m_szVert); if ((bHorz ? rc.left : rc.top) != nAlign) { if (!bHorz) rc.OffsetRect(0, nAlign - rc.top - 2); else if (m_nDockBarID == AFX_IDW_DOCKBAR_TOP) rc.OffsetRect(nAlign - rc.left, -2); else rc.OffsetRect(nAlign - rc.left, 0); pBar->MoveWindow(rc); bNeedRecalc = TRUE; } nAlign += (bHorz ? rc.Width() : rc.Height()) - 2; } if (bNeedRecalc) { m_pDockSite->DelayRecalcLayout(); TRACE(_T("ccc\n")); } }
int CDockBar::Insert(CControlBar* pBarIns, CRect rect, CPoint ptMid) { ASSERT_VALID(this); ASSERT(pBarIns != NULL); int nPos = 0; int nPosInsAfter = 0; int nWidth = 0; int nTotalWidth = 0; BOOL bHorz = m_dwStyle & CBRS_ORIENT_HORZ ? TRUE : FALSE; for (nPos = 0; nPos < m_arrBars.GetSize(); nPos++) { CControlBar* pBar = (CControlBar*)m_arrBars[nPos]; if (pBar != NULL && pBar->IsVisible()) { CRect rectBar; pBar->GetWindowRect(&rectBar); ScreenToClient(&rectBar); nWidth = max(nWidth, bHorz ? rectBar.Size().cy : rectBar.Size().cx - 1); if (bHorz ? rect.left > rectBar.left : rect.top > rectBar.top) nPosInsAfter = nPos; } else // end of row because pBar == NULL { nTotalWidth += nWidth - afxData.cyBorder2; nWidth = 0; if ((bHorz ? ptMid.y : ptMid.x) < nTotalWidth) { if (nPos == 0) // first section m_arrBars.InsertAt(nPosInsAfter+1, (CObject*)NULL); m_arrBars.InsertAt(nPosInsAfter+1, pBarIns); return nPosInsAfter+1; } nPosInsAfter = nPos; } } // create a new row m_arrBars.InsertAt(nPosInsAfter+1, (CObject*)NULL); m_arrBars.InsertAt(nPosInsAfter+1, pBarIns); return nPosInsAfter+1; }
BOOL COleClientItem::OnShowControlBars(CFrameWnd* pFrameWnd, BOOL bShow) { ASSERT_VALID(pFrameWnd); ASSERT_VALID(this); // show/hide all bars marked with CBRS_HIDE_INPLACE style BOOL bResult = FALSE; if (bShow) { POSITION pos = pFrameWnd->m_listControlBars.GetHeadPosition(); while (pos) { CControlBar* pBar = (CControlBar*)pFrameWnd->m_listControlBars.GetNext(pos); ASSERT_VALID(pBar); if ((pBar->GetBarStyle() & CBRS_HIDE_INPLACE) && (pBar->m_nStateFlags & CControlBar::tempHide)) { pBar->m_nStateFlags &= ~CControlBar::tempHide; pFrameWnd->ShowControlBar(pBar, TRUE, TRUE); bResult = TRUE; } } } else { POSITION pos = pFrameWnd->m_listControlBars.GetHeadPosition(); while (pos) { CControlBar* pBar = (CControlBar*)pFrameWnd->m_listControlBars.GetNext(pos); ASSERT_VALID(pBar); if (pBar->IsVisible() && (pBar->GetBarStyle() & CBRS_HIDE_INPLACE)) { pBar->m_nStateFlags |= CControlBar::tempHide; pFrameWnd->ShowControlBar(pBar, FALSE, TRUE); bResult = TRUE; } } } return bResult; }
//----------------------------------------------------------------- void CMRCFrameWndSizeDock::GetFloatingBars(CObArray & arrWnd) // Appends the floating bars, visible bars to an array //----------------------------------------------------------------- { CPtrList & listControlBars = m_listControlBars; POSITION pos = listControlBars.GetHeadPosition(); while (pos != NULL) { CControlBar* pBar = (CControlBar*)listControlBars.GetNext(pos); ASSERT(pBar != NULL); if (!pBar->IsDockBar() && pBar->IsFloating() && pBar->IsVisible()) // not a dockbar and floating.... { ASSERT(pBar->m_pDockBar != NULL); CWnd * pFloatFrame = ((CWnd *)pBar->m_pDockBar)->GetParent(); ASSERT(pBar != NULL); arrWnd.Add(pFloatFrame); } } }
void CMiniDockFrameWnd::OnNcLButtonDown(UINT nHitTest, CPoint point) { if (nHitTest == HTCAPTION) { // special activation for floating toolbars ActivateTopParent(); // initiate toolbar drag for non-CBRS_FLOAT_MULTI toolbars if ((m_wndDockBar.m_dwStyle & CBRS_FLOAT_MULTI) == 0) { CControlBar* pBar = (CControlBar*)m_wndDockBar.m_arrBars[1]; ASSERT(pBar != NULL); ASSERT(pBar->IsKindOf(RUNTIME_CLASS(CControlBar))); ASSERT(pBar->m_pDockContext != NULL); pBar->m_pDockContext->StartDrag(point); return; } } CMiniFrameWnd::OnNcLButtonDown(nHitTest, point); }