224 lines
5.7 KiB
C++
224 lines
5.7 KiB
C++
// ConfigScopeItem.cpp: implementation of the CConfigScopeItem class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#include "stdafx.h"
|
|
#include "snapin.h"
|
|
#include "ConfigScopeItem.h"
|
|
#include "ConfigResultsView.h"
|
|
#include "ActionManScopeItem.h"
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
// {33A7606E-CAA5-11d2-BD8E-0000F87A3912}
|
|
static GUID GUID_Config =
|
|
{ 0x33a7606e, 0xcaa5, 0x11d2, { 0xbd, 0x8e, 0x0, 0x0, 0xf8, 0x7a, 0x39, 0x12 } };
|
|
|
|
IMPLEMENT_DYNCREATE(CConfigScopeItem,CHMScopeItem)
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Construction/Destruction
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
CConfigScopeItem::CConfigScopeItem()
|
|
{
|
|
m_lpguidItemType = &GUID_Config;
|
|
}
|
|
|
|
CConfigScopeItem::~CConfigScopeItem()
|
|
{
|
|
Destroy();
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Creation Members
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
bool CConfigScopeItem::Create(CScopePane* pScopePane, CScopePaneItem* pParentItem)
|
|
{
|
|
TRACEX(_T("CConfigScopeItem::Create\n"));
|
|
TRACEARGn(pScopePane);
|
|
TRACEARGn(pParentItem);
|
|
|
|
// set up all the icons first
|
|
m_IconResIds.Add(IDI_ICON_CONFIG);
|
|
m_OpenIconResIds.Add(IDI_ICON_CONFIG);
|
|
SetIconIndex(0);
|
|
SetOpenIconIndex(0);
|
|
|
|
// call base class Create method
|
|
if( ! CScopePaneItem::Create(pScopePane,pParentItem) )
|
|
{
|
|
TRACE(_T("CScopePaneItem::Create failed.\n"));
|
|
return false;
|
|
}
|
|
|
|
// set display names
|
|
CString sName;
|
|
sName.LoadString(IDS_STRING_CONFIG);
|
|
SetDisplayName(0,sName);
|
|
|
|
// add children
|
|
CActionManScopeItem* pAMItem = new CActionManScopeItem;
|
|
if( ! pAMItem->Create(GetScopePane(),this) )
|
|
{
|
|
ASSERT(0);
|
|
delete pAMItem;
|
|
return false;
|
|
}
|
|
|
|
m_Children.Add(pAMItem);
|
|
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Results Pane View Members
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
CResultsPaneView* CConfigScopeItem::CreateResultsPaneView()
|
|
{
|
|
TRACEX(_T("CConfigScopeItem::CreateResultsPaneView\n"));
|
|
|
|
return new CConfigResultsView;
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// MMC Notify Handlers
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
HRESULT CConfigScopeItem::OnAddMenuItems(LPCONTEXTMENUCALLBACK piCallback,long __RPC_FAR *pInsertionAllowed)
|
|
{
|
|
TRACEX(_T("CConfigScopeItem::OnAddMenuItems\n"));
|
|
TRACEARGn(piCallback);
|
|
TRACEARGn(pInsertionAllowed);
|
|
|
|
HRESULT hr = S_OK;
|
|
|
|
// Add New Menu Items
|
|
if( CCM_INSERTIONALLOWED_NEW & *pInsertionAllowed )
|
|
{
|
|
}
|
|
|
|
// Add Task Menu Items
|
|
if( CCM_INSERTIONALLOWED_TASK & *pInsertionAllowed )
|
|
{
|
|
CONTEXTMENUITEM cmi;
|
|
CString sResString;
|
|
CString sResString2;
|
|
|
|
sResString.LoadString(IDS_STRING_CLEAR_EVENTS);
|
|
cmi.strName = LPTSTR(LPCTSTR(sResString));
|
|
sResString2.LoadString(IDS_STRING_CLEAR_EVENTS_DESCRIPTION);
|
|
cmi.strStatusBarText = LPTSTR(LPCTSTR(sResString2));
|
|
cmi.lCommandID = IDM_CLEAR_EVENTS;
|
|
cmi.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_TASK;
|
|
cmi.fFlags = 0;
|
|
cmi.fSpecialFlags = 0;
|
|
|
|
hr = piCallback->AddItem(&cmi);
|
|
if( !SUCCEEDED(hr) )
|
|
{
|
|
TRACE(_T("FAILED : IContextMenuCallback::AddItem failed.\n"));
|
|
return hr;
|
|
}
|
|
// separator
|
|
cmi.strName = NULL;
|
|
cmi.strStatusBarText = NULL;
|
|
cmi.lCommandID = NULL;
|
|
cmi.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_TASK;
|
|
cmi.fFlags = MF_SEPARATOR;
|
|
cmi.fSpecialFlags = 0;
|
|
|
|
hr = piCallback->AddItem(&cmi);
|
|
if( !SUCCEEDED(hr) )
|
|
{
|
|
TRACE(_T("FAILED : IContextMenuCallback::AddItem failed.\n"));
|
|
return hr;
|
|
}
|
|
}
|
|
|
|
// Add View Menu Items
|
|
if( CCM_INSERTIONALLOWED_VIEW & *pInsertionAllowed )
|
|
{
|
|
CONTEXTMENUITEM cmi;
|
|
CString sResString;
|
|
CString sResString2;
|
|
|
|
sResString.LoadString(IDS_STRING_STATUS_ONLY);
|
|
cmi.strName = LPTSTR(LPCTSTR(sResString));
|
|
sResString2.LoadString(IDS_STRING_STATUS_ONLY_DESCRIPTION);
|
|
cmi.strStatusBarText = LPTSTR(LPCTSTR(sResString2));
|
|
cmi.lCommandID = IDM_STATUS_ONLY;
|
|
cmi.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_VIEW;
|
|
cmi.fFlags = MF_UNCHECKED;
|
|
cmi.fSpecialFlags = 0;
|
|
|
|
hr = piCallback->AddItem(&cmi);
|
|
if( !SUCCEEDED(hr) )
|
|
{
|
|
TRACE(_T("FAILED : IContextMenuCallback::AddItem failed.\n"));
|
|
return hr;
|
|
}
|
|
|
|
sResString.LoadString(IDS_STRING_ICONS_STATUS);
|
|
cmi.strName = LPTSTR(LPCTSTR(sResString));
|
|
sResString2.LoadString(IDS_STRING_ICONS_STATUS_DESCRIPTION);
|
|
cmi.strStatusBarText = LPTSTR(LPCTSTR(sResString2));
|
|
cmi.lCommandID = IDM_ICONS_WITH_STATUS;
|
|
cmi.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_VIEW;
|
|
cmi.fFlags = MF_CHECKED;
|
|
cmi.fSpecialFlags = 0;
|
|
|
|
hr = piCallback->AddItem(&cmi);
|
|
if( !SUCCEEDED(hr) )
|
|
{
|
|
TRACE(_T("FAILED : IContextMenuCallback::AddItem failed.\n"));
|
|
return hr;
|
|
}
|
|
|
|
// icon legend
|
|
sResString.LoadString(IDS_STRING_ICON_LEGEND);
|
|
cmi.strName = LPTSTR(LPCTSTR(sResString));
|
|
sResString2.LoadString(IDS_STRING_ICON_LEGEND_DESCRIPTION);
|
|
cmi.strStatusBarText = LPTSTR(LPCTSTR(sResString2));
|
|
cmi.lCommandID = IDM_ICON_LEGEND;
|
|
cmi.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_VIEW;
|
|
cmi.fFlags = 0;
|
|
cmi.fSpecialFlags = 0;
|
|
|
|
hr = piCallback->AddItem(&cmi);
|
|
if( !SUCCEEDED(hr) )
|
|
{
|
|
TRACE(_T("FAILED : IContextMenuCallback::AddItem failed.\n"));
|
|
return hr;
|
|
}
|
|
}
|
|
|
|
return hr;
|
|
}
|
|
|
|
HRESULT CConfigScopeItem::OnCommand(long lCommandID)
|
|
{
|
|
TRACEX(_T("CConfigScopeItem::OnCommand\n"));
|
|
TRACEARGn(lCommandID);
|
|
|
|
HRESULT hr = S_OK;
|
|
|
|
switch(lCommandID)
|
|
{
|
|
case IDM_CLEAR_EVENTS:
|
|
{
|
|
}
|
|
break;
|
|
}
|
|
|
|
return hr;
|
|
}
|