LRESULT CMainFrame::OnSelChanged(LPNMHDR /*lpNLHDR*/) { CTreeItem itemSelected; itemSelected = m_view.GetSelectedItem(); UIEnable(IDM_AGGR_UNBIND, FALSE); UIEnable(IDM_AGGR_SYNCHRONIZE, FALSE); UIEnable(IDM_AGGR_ADDMIRROR, FALSE); if ( !itemSelected.IsNull() ) { CDiskObjectPtr obj = m_mapObject[itemSelected.GetData()]; ATLASSERT( obj.get() != NULL ); CCommandSet cmdSet = CObjectUIHandler::GetUIHandler(obj)->GetCommandSet(obj); CCommandSet::iterator itr; for ( itr = cmdSet.begin(); itr != cmdSet.end(); itr++ ) { UIEnable( itr->GetID(), !itr->IsDisabled() ); } } return 0; }
void CMainFrame::RefreshAction() { int iItemSelected; // UIEnable(IDM_AGGR_BIND, FALSE); UIEnable(IDM_AGGR_UNBIND, FALSE); UIEnable(IDM_AGGR_SYNCHRONIZE, FALSE); UIEnable(IDM_AGGR_ADDMIRROR, FALSE); if (-1 != (iItemSelected = m_viewTreeList.GetSelectedItemData())) { CDiskObjectPtr obj = m_mapObject[iItemSelected]; ATLASSERT( obj.get() != NULL ); CCommandSet cmdSet = CObjectUIHandler::GetUIHandler(obj)->GetCommandSet(obj); CCommandSet::iterator itr; for ( itr = cmdSet.begin(); itr != cmdSet.end(); itr++ ) { UIEnable( itr->GetID(), !itr->IsDisabled() ); } } }