// virtual BOOL FW_Cmd::OnCmdMsg( UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo ) { BOOL bOK = CCmdTarget::OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ); if(!bOK) { if(nID == GetCmdId()) { switch(nCode) { case CN_COMMAND: { // pHandlerInfo!=NULL means it is checking whether the command should be enable, // otherwise the command is executed if(!pHandlerInfo) { if(!OnExecute()) OnTerminate(); } bOK = TRUE; } break; case CN_UPDATE_COMMAND_UI: { OnUpdateCmdUI((CCmdUI*)pExtra); bOK = TRUE; // Enable the command } break; default: break; } } } return bOK; }
LRESULT CControlBar::OnIdleUpdateCmdUI(WPARAM wParam, LPARAM) { // handle delay hide/show BOOL bVis = GetStyle() & WS_VISIBLE; UINT swpFlags = 0; if ((m_nStateFlags & delayHide) && bVis) swpFlags = SWP_HIDEWINDOW; else if ((m_nStateFlags & delayShow) && !bVis) swpFlags = SWP_SHOWWINDOW; m_nStateFlags &= ~(delayShow|delayHide); if (swpFlags != 0) { SetWindowPos(NULL, 0, 0, 0, 0, swpFlags| SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE); } // the style must be visible and if it is docked // the dockbar style must also be visible if ((GetStyle() & WS_VISIBLE) && (m_pDockBar == NULL || (m_pDockBar->GetStyle() & WS_VISIBLE))) { CFrameWnd* pTarget = (CFrameWnd*)GetOwner(); if (pTarget == NULL || !pTarget->IsFrameWnd()) pTarget = GetParentFrame(); if (pTarget != NULL) OnUpdateCmdUI(pTarget, (BOOL)wParam); } return 0L; }
LPARAM CToolBarEx::OnIdleUpdateCmdUI(WPARAM wParam, LPARAM lParam) { if (IsWindowVisible()) { CFrameWnd* pParent = (CFrameWnd *)GetParent(); if (pParent) OnUpdateCmdUI(pParent, (BOOL)wParam); } return 0L; }
LRESULT CDlgStatusBar::OnIdleUpdateCmdUI(WPARAM wParam, LPARAM) { if (IsWindowVisible()) { CFrameWnd *pParent = (CFrameWnd *)GetParent(); if (pParent) OnUpdateCmdUI(pParent, (BOOL)wParam); } return 0L; }
//************************************************************************************ LRESULT CBCGPRadialMenu::OnIdleUpdateCmdUI(WPARAM wParam, LPARAM) { CFrameWnd* pTarget = (CFrameWnd*)GetOwner(); if (pTarget == NULL || !pTarget->IsFrameWnd()) pTarget = BCGPGetParentFrame(this); if (pTarget != NULL) OnUpdateCmdUI(pTarget, (BOOL)wParam); return 0L; }
LRESULT CIVToolBar::OnIdleUpdateCmdUI(WPARAM wParam, LPARAM) { if (IsWindowVisible()) { CFrameWnd* pParent = (CFrameWnd*)AfxGetMainWnd (); if (pParent) OnUpdateCmdUI(pParent, (BOOL)wParam); } return 0L; }
LRESULT CControlBar::OnIdleUpdateCmdUI( WPARAM wParam, LPARAM lParam ) /********************************************************************/ { UNUSED_ALWAYS( lParam ); CFrameWnd *pFrame = GetParentFrame(); if( pFrame != NULL ) { OnUpdateCmdUI( pFrame, (BOOL)wParam ); } return( 0L ); }
LRESULT CControlBar::OnIdleUpdateCmdUI(WPARAM wParam, LPARAM) { // the style must be visible and if it is docked // the dockbar style must also be visible if ((GetStyle() & WS_VISIBLE) && (m_pDockBar == NULL || (m_pDockBar->GetStyle() & WS_VISIBLE))) { CFrameWnd* pTarget = (CFrameWnd*)GetOwner(); if (pTarget == NULL || !pTarget->IsFrameWnd()) pTarget = GetParentFrame(); if (pTarget != NULL) OnUpdateCmdUI(pTarget, (BOOL)wParam); } return 0L; }