Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

223 lines
5.7 KiB

  1. // ConfigScopeItem.cpp: implementation of the CConfigScopeItem class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "stdafx.h"
  5. #include "snapin.h"
  6. #include "ConfigScopeItem.h"
  7. #include "ConfigResultsView.h"
  8. #include "ActionManScopeItem.h"
  9. #ifdef _DEBUG
  10. #undef THIS_FILE
  11. static char THIS_FILE[]=__FILE__;
  12. #define new DEBUG_NEW
  13. #endif
  14. // {33A7606E-CAA5-11d2-BD8E-0000F87A3912}
  15. static GUID GUID_Config =
  16. { 0x33a7606e, 0xcaa5, 0x11d2, { 0xbd, 0x8e, 0x0, 0x0, 0xf8, 0x7a, 0x39, 0x12 } };
  17. IMPLEMENT_DYNCREATE(CConfigScopeItem,CHMScopeItem)
  18. //////////////////////////////////////////////////////////////////////
  19. // Construction/Destruction
  20. //////////////////////////////////////////////////////////////////////
  21. CConfigScopeItem::CConfigScopeItem()
  22. {
  23. m_lpguidItemType = &GUID_Config;
  24. }
  25. CConfigScopeItem::~CConfigScopeItem()
  26. {
  27. Destroy();
  28. }
  29. //////////////////////////////////////////////////////////////////////
  30. // Creation Members
  31. //////////////////////////////////////////////////////////////////////
  32. bool CConfigScopeItem::Create(CScopePane* pScopePane, CScopePaneItem* pParentItem)
  33. {
  34. TRACEX(_T("CConfigScopeItem::Create\n"));
  35. TRACEARGn(pScopePane);
  36. TRACEARGn(pParentItem);
  37. // set up all the icons first
  38. m_IconResIds.Add(IDI_ICON_CONFIG);
  39. m_OpenIconResIds.Add(IDI_ICON_CONFIG);
  40. SetIconIndex(0);
  41. SetOpenIconIndex(0);
  42. // call base class Create method
  43. if( ! CScopePaneItem::Create(pScopePane,pParentItem) )
  44. {
  45. TRACE(_T("CScopePaneItem::Create failed.\n"));
  46. return false;
  47. }
  48. // set display names
  49. CString sName;
  50. sName.LoadString(IDS_STRING_CONFIG);
  51. SetDisplayName(0,sName);
  52. // add children
  53. CActionManScopeItem* pAMItem = new CActionManScopeItem;
  54. if( ! pAMItem->Create(GetScopePane(),this) )
  55. {
  56. ASSERT(0);
  57. delete pAMItem;
  58. return false;
  59. }
  60. m_Children.Add(pAMItem);
  61. return true;
  62. }
  63. //////////////////////////////////////////////////////////////////////
  64. // Results Pane View Members
  65. //////////////////////////////////////////////////////////////////////
  66. CResultsPaneView* CConfigScopeItem::CreateResultsPaneView()
  67. {
  68. TRACEX(_T("CConfigScopeItem::CreateResultsPaneView\n"));
  69. return new CConfigResultsView;
  70. }
  71. //////////////////////////////////////////////////////////////////////
  72. // MMC Notify Handlers
  73. //////////////////////////////////////////////////////////////////////
  74. HRESULT CConfigScopeItem::OnAddMenuItems(LPCONTEXTMENUCALLBACK piCallback,long __RPC_FAR *pInsertionAllowed)
  75. {
  76. TRACEX(_T("CConfigScopeItem::OnAddMenuItems\n"));
  77. TRACEARGn(piCallback);
  78. TRACEARGn(pInsertionAllowed);
  79. HRESULT hr = S_OK;
  80. // Add New Menu Items
  81. if( CCM_INSERTIONALLOWED_NEW & *pInsertionAllowed )
  82. {
  83. }
  84. // Add Task Menu Items
  85. if( CCM_INSERTIONALLOWED_TASK & *pInsertionAllowed )
  86. {
  87. CONTEXTMENUITEM cmi;
  88. CString sResString;
  89. CString sResString2;
  90. sResString.LoadString(IDS_STRING_CLEAR_EVENTS);
  91. cmi.strName = LPTSTR(LPCTSTR(sResString));
  92. sResString2.LoadString(IDS_STRING_CLEAR_EVENTS_DESCRIPTION);
  93. cmi.strStatusBarText = LPTSTR(LPCTSTR(sResString2));
  94. cmi.lCommandID = IDM_CLEAR_EVENTS;
  95. cmi.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_TASK;
  96. cmi.fFlags = 0;
  97. cmi.fSpecialFlags = 0;
  98. hr = piCallback->AddItem(&cmi);
  99. if( !SUCCEEDED(hr) )
  100. {
  101. TRACE(_T("FAILED : IContextMenuCallback::AddItem failed.\n"));
  102. return hr;
  103. }
  104. // separator
  105. cmi.strName = NULL;
  106. cmi.strStatusBarText = NULL;
  107. cmi.lCommandID = NULL;
  108. cmi.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_TASK;
  109. cmi.fFlags = MF_SEPARATOR;
  110. cmi.fSpecialFlags = 0;
  111. hr = piCallback->AddItem(&cmi);
  112. if( !SUCCEEDED(hr) )
  113. {
  114. TRACE(_T("FAILED : IContextMenuCallback::AddItem failed.\n"));
  115. return hr;
  116. }
  117. }
  118. // Add View Menu Items
  119. if( CCM_INSERTIONALLOWED_VIEW & *pInsertionAllowed )
  120. {
  121. CONTEXTMENUITEM cmi;
  122. CString sResString;
  123. CString sResString2;
  124. sResString.LoadString(IDS_STRING_STATUS_ONLY);
  125. cmi.strName = LPTSTR(LPCTSTR(sResString));
  126. sResString2.LoadString(IDS_STRING_STATUS_ONLY_DESCRIPTION);
  127. cmi.strStatusBarText = LPTSTR(LPCTSTR(sResString2));
  128. cmi.lCommandID = IDM_STATUS_ONLY;
  129. cmi.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_VIEW;
  130. cmi.fFlags = MF_UNCHECKED;
  131. cmi.fSpecialFlags = 0;
  132. hr = piCallback->AddItem(&cmi);
  133. if( !SUCCEEDED(hr) )
  134. {
  135. TRACE(_T("FAILED : IContextMenuCallback::AddItem failed.\n"));
  136. return hr;
  137. }
  138. sResString.LoadString(IDS_STRING_ICONS_STATUS);
  139. cmi.strName = LPTSTR(LPCTSTR(sResString));
  140. sResString2.LoadString(IDS_STRING_ICONS_STATUS_DESCRIPTION);
  141. cmi.strStatusBarText = LPTSTR(LPCTSTR(sResString2));
  142. cmi.lCommandID = IDM_ICONS_WITH_STATUS;
  143. cmi.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_VIEW;
  144. cmi.fFlags = MF_CHECKED;
  145. cmi.fSpecialFlags = 0;
  146. hr = piCallback->AddItem(&cmi);
  147. if( !SUCCEEDED(hr) )
  148. {
  149. TRACE(_T("FAILED : IContextMenuCallback::AddItem failed.\n"));
  150. return hr;
  151. }
  152. // icon legend
  153. sResString.LoadString(IDS_STRING_ICON_LEGEND);
  154. cmi.strName = LPTSTR(LPCTSTR(sResString));
  155. sResString2.LoadString(IDS_STRING_ICON_LEGEND_DESCRIPTION);
  156. cmi.strStatusBarText = LPTSTR(LPCTSTR(sResString2));
  157. cmi.lCommandID = IDM_ICON_LEGEND;
  158. cmi.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_VIEW;
  159. cmi.fFlags = 0;
  160. cmi.fSpecialFlags = 0;
  161. hr = piCallback->AddItem(&cmi);
  162. if( !SUCCEEDED(hr) )
  163. {
  164. TRACE(_T("FAILED : IContextMenuCallback::AddItem failed.\n"));
  165. return hr;
  166. }
  167. }
  168. return hr;
  169. }
  170. HRESULT CConfigScopeItem::OnCommand(long lCommandID)
  171. {
  172. TRACEX(_T("CConfigScopeItem::OnCommand\n"));
  173. TRACEARGn(lCommandID);
  174. HRESULT hr = S_OK;
  175. switch(lCommandID)
  176. {
  177. case IDM_CLEAR_EVENTS:
  178. {
  179. }
  180. break;
  181. }
  182. return hr;
  183. }