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; } } } }
void CExtThemeSwitcherToolButton::OnUpdateCmdUI( CWnd * pTarget, BOOL bDisableIfNoHndler, int nIndex ) { ASSERT_VALID( this ); ASSERT_VALID( GetBar() ); ASSERT_VALID( pTarget ); pTarget; bDisableIfNoHndler; nIndex; ((CExtThemeSwitcherToolControlBar*)GetBar()) -> ThemeSwitcher_OnButtonUpdate( this ); }
void CDockButton::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default if (!m_bMouseOver) return; CRect m_rc; CPoint pt(GetMessagePos()); CRect m_rect; GetClientRect(m_rect); CPoint ptB=pt; ScreenToClient(&pt); CGuiControlBar* m_tb=GetBar(m_hWnd); m_tb->GetWindowRect(&m_rc); if (m_rc.PtInRect(ptB)) return; if (m_rect.PtInRect(pt)) return; if (m_tb->IsTracking()) return; if (!m_rect.PtInRect(pt)) { m_bMouseOver=0; KillTimer(1); CGuiControlBar* m_tb1=IsControlVisible(m_tb); if (!m_tb1) m_tb->ScrollOff(); //aqui se debe ocultar la ventana auto hide } CWnd::OnTimer(nIDEvent); }
// 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 } } }
BOOL CExtThemeSwitcherToolButton::PutToPopupMenu( CExtPopupMenuWnd * pPopup ) { ASSERT_VALID( this ); ASSERT( pPopup != NULL ); ASSERT( pPopup->GetSafeHwnd() == NULL ); ASSERT( CtrlGet() == NULL ); if( (GetStyle()&TBBS_HIDDEN) != 0 ) return TRUE; if( IsSeparator() ) return CExtBarButton::PutToPopupMenu( pPopup ); ASSERT( ! IsAbleToTrackMenu() ); CExtToolControlBar * pBar = GetBar(); ASSERT_VALID( pBar ); CExtCmdItem * pCmdItem = g_CmdManager->CmdGetPtr( g_CmdManager->ProfileNameFromWnd( pBar->GetSafeHwnd() ), GetCmdID( false ) ); ASSERT( pCmdItem != NULL ); HWND hWndCmdReceiver = pBar->GetSafeHwnd(); int nCheck = ( (GetStyle()&TBBS_CHECKED) != 0 ) ? 1 : 0; // const CExtCmdIcon & _icon = GetIcon(); CExtCmdIcon _icon; // CExtCmdIcon _cmdIconEmpty, * pCmdIcon = ((CExtThemeSwitcherToolControlBar*)pBar)->ThemeSwitcher_GetMenuIconByToolBarCmdID(GetCmdID(false)); // const CExtCmdIcon & _icon = ( pCmdIcon != NULL ) ? ( * pCmdIcon ) : _cmdIconEmpty; CExtSafeString strButtonText; if( (pPopup->TrackFlagsGet()&TPMX_PALETTE) == 0 ) strButtonText = pCmdItem->m_sMenuText; if( ! pPopup->ItemInsertCommand( ((CExtThemeSwitcherToolControlBar*)pBar)->ThemeSwitcher_GetMenuCmdIDByToolBarCmdID(GetCmdID( false )), //GetCmdID( false ), -1, strButtonText.IsEmpty() ? NULL : LPCTSTR(strButtonText), NULL, _icon, nCheck, hWndCmdReceiver ) ) { ASSERT( FALSE ); return FALSE; } CExtPopupMenuWnd::MENUITEMDATA & mi = pPopup->ItemGetInfo( pPopup->ItemGetCount() - 1 ); mi.Enable( IsEnabled() ); mi.SetNoCmdUI( true ); if( ! pCmdItem->m_sTipTool.IsEmpty() ) mi.SetCustomTip( LPCTSTR(pCmdItem->m_sTipTool) ); return TRUE; }
void CExtThemeSwitcherToolButton::OnDeliverCmd() { ASSERT_VALID( this ); CExtToolControlBar * pBar = GetBar(); ASSERT_VALID( pBar ); if( pBar->_OnHookButtonDeliverCmd( this ) ) return; if( pBar->OnDeliverCmd( this ) ) return; if( ! CExtCmdManager::IsCommand( GetCmdID(false) ) ) return; ((CExtThemeSwitcherToolControlBar*)pBar) -> ThemeSwitcher_OnButtonInvoke( this ); }
void COXDockTabCtrl::OnMouseMove(UINT nFlags, CPoint point) { // In order to start dragging the left button must be down and the current point // must be at least 3 pixels away from the point where the button was pressed if ((nFlags & MK_LBUTTON) && (abs(point.x - m_ptLButtonDown.x) > 3 || abs(point.y - m_ptLButtonDown.y) > 3)) { TCHITTESTINFO thti; thti.pt = point; int iIndex = HitTest(&thti); if (iIndex != -1) { CControlBar* pBar = GetBar(iIndex); // Handle COXCoolToolBar COXCoolToolBar* pToolBar = DYNAMIC_DOWNCAST(COXCoolToolBar, pBar); if (pToolBar) { // We have a toolbar pToolBar->SaveMouseOffset(CPoint(0, 0)); pToolBar->SetCapture(); pToolBar->m_bDragging = true; ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_SIZEALL)); return; } // Handle COXSizeControlBar COXSizeControlBar* pControlBar = DYNAMIC_DOWNCAST(COXSizeControlBar, pBar); if (pControlBar) { // We have a docking window pControlBar->SaveMouseOffset(CPoint(0, 0)); pControlBar->SetCapture(); pControlBar->m_bDragging = true; ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_SIZEALL)); return; } } } COXSkinnedTabCtrl::OnMouseMove(nFlags, point); }
void CDockButton::OnMouseMove(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default if (m_bMouseOver) return; if (!IsTopParentActive() || !GetTopLevelParent()->IsWindowEnabled()) return; CRect m_rect; GetClientRect(m_rect); if (m_rect.PtInRect(point)) { CGuiControlBar* m_tb=GetBar(m_hWnd); if ((m_tb->IsVisible() && m_tb->IsAutoHide()) ) { m_tb->ScrollOff(); GetParentFrame()->ShowControlBar(m_tb, FALSE, FALSE); } else { if (!m_tb->IsVisible()) { CGuiControlBar* m_tb1=IsControlVisible(m_tb); if (m_tb1!= NULL) { if (m_tb1 != m_tb) { GetParentFrame()->ShowControlBar(m_tb1, FALSE, TRUE); } } m_tb->ScrollOn(); m_bMouseOver=TRUE; //numero de ventana a activar SetTimer(1,500,0); } } } CWnd::OnMouseMove(nFlags, point); }
CGuiControlBar* CDockButton::IsControlVisible(CGuiControlBar* m_Bar) { CGuiMDIFrame* pB; CGuiFrameWnd* pB1; CDockButton* pBtn; BOOL isMDI=FALSE; if (GetParentFrame()->IsKindOf(RUNTIME_CLASS(CGuiMDIFrame))) isMDI=TRUE; if (isMDI) pB=(CGuiMDIFrame*)GetParentFrame(); else pB1= (CGuiFrameWnd*)GetParentFrame(); int nSize=isMDI==TRUE? pB->m_dockHideBottom.m_ArrayButton.GetSize() : pB1->m_dockHideBottom.m_ArrayButton.GetSize() ; for(int i=0; i < nSize; i++) { if (isMDI==TRUE) pBtn= (CDockButton*) pB->m_dockHideBottom.m_ArrayButton[i]; else pBtn= (CDockButton*) pB1->m_dockHideBottom.m_ArrayButton[i]; CGuiControlBar* pBar= GetBar(pBtn->m_hWnd); if(pBar == m_Bar) continue; if (pBar->IsWindowVisible()) return pBar; } nSize=(isMDI==TRUE) ? pB->m_dockHideLeft.m_ArrayButton.GetSize(): pB1->m_dockHideLeft.m_ArrayButton.GetSize(); for( i=0; i < nSize; i++) { if (isMDI==TRUE) pBtn= (CDockButton*) pB->m_dockHideLeft.m_ArrayButton[i]; else pBtn= (CDockButton*) pB1->m_dockHideLeft.m_ArrayButton[i]; CGuiControlBar* pBar= GetBar(pBtn->m_hWnd); if(pBar == m_Bar) continue; if(pBar->IsWindowVisible()) return pBar; } nSize=(isMDI==TRUE) ? pB->m_dockHideRight.m_ArrayButton.GetSize() : pB1->m_dockHideRight.m_ArrayButton.GetSize(); for( i=0; i < nSize; i++) { if (isMDI==TRUE) pBtn=(CDockButton*) pB->m_dockHideRight.m_ArrayButton[i] ; else pBtn=(CDockButton*) pB1->m_dockHideRight.m_ArrayButton[i]; CGuiControlBar* pBar= GetBar(pBtn->m_hWnd); if(pBar == m_Bar) continue; if (pBar->IsWindowVisible()) return pBar; } nSize=(isMDI==TRUE) ? pB->m_dockHideTop.m_ArrayButton.GetSize() : pB1->m_dockHideTop.m_ArrayButton.GetSize(); for( i=0; i < nSize; i++) { if (isMDI==TRUE) pBtn= (CDockButton*) pB->m_dockHideTop.m_ArrayButton[i]; else pBtn= (CDockButton*)pB1->m_dockHideTop.m_ArrayButton[i]; CGuiControlBar* pBar= GetBar(pBtn->m_hWnd); if(pBar == m_Bar) continue; if (pBar->IsWindowVisible()) return pBar; } return NULL; }