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.

172 lines
5.0 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 2000 **/
  4. /**********************************************************************/
  5. /*
  6. IPSMhand.h
  7. Header file for IPSecMon specific base handler classes and query obj
  8. FILE HISTORY:
  9. */
  10. #ifndef _IPSMHAND_H
  11. #define _IPSMHAND_H
  12. #ifndef _HANDLERS_H
  13. #include <handlers.h>
  14. #endif
  15. #ifndef _QUERYOBJ_H
  16. #include <queryobj.h>
  17. #endif
  18. extern const TCHAR g_szDefaultHelpTopic[];
  19. /*---------------------------------------------------------------------------
  20. Class: CHandlerEx
  21. ---------------------------------------------------------------------------*/
  22. class CHandlerEx
  23. {
  24. // Interface
  25. public:
  26. virtual HRESULT InitializeNode(ITFSNode * pNode) = 0;
  27. LPCTSTR GetDisplayName() { return m_strDisplayName; }
  28. void SetDisplayName(LPCTSTR pName) { m_strDisplayName = pName; }
  29. private:
  30. CString m_strDisplayName;
  31. };
  32. /*---------------------------------------------------------------------------
  33. Class: CIpsmHandler
  34. ---------------------------------------------------------------------------*/
  35. class CIpsmHandler :
  36. public CHandler,
  37. public CHandlerEx
  38. {
  39. public:
  40. CIpsmHandler(ITFSComponentData *pCompData) :
  41. CHandler(pCompData),
  42. m_verbDefault(MMC_VERB_OPEN) {};
  43. ~CIpsmHandler() {};
  44. // base handler virtual function over-rides
  45. virtual HRESULT SaveColumns(ITFSComponent *, MMC_COOKIE, LPARAM, LPARAM);
  46. // by default we don't allow nodes to be renamed
  47. OVERRIDE_BaseHandlerNotify_OnRename() { return hrFalse; }
  48. OVERRIDE_BaseResultHandlerNotify_OnResultSelect();
  49. OVERRIDE_BaseResultHandlerNotify_OnResultDelete();
  50. OVERRIDE_BaseResultHandlerNotify_OnResultContextHelp();
  51. OVERRIDE_BaseResultHandlerNotify_OnResultRefresh();
  52. // Multi-select functionalty
  53. OVERRIDE_ResultHandler_OnCreateDataObject();
  54. void EnableVerbs(IConsoleVerb * pConsoleVerb,
  55. MMC_BUTTON_STATE ButtonState[],
  56. BOOL bEnable[]);
  57. MMC_CONSOLE_VERB m_verbDefault;
  58. protected:
  59. HRESULT CreateMultiSelectData(ITFSComponent * pComponent, CDataObject * pObject);
  60. public:
  61. };
  62. /*---------------------------------------------------------------------------
  63. Class: CMTIpsmHandler
  64. ---------------------------------------------------------------------------*/
  65. class CMTIpsmHandler :
  66. public CMTHandler,
  67. public CHandlerEx
  68. {
  69. public:
  70. // enumeration for node states, to handle icon changes
  71. typedef enum
  72. {
  73. notLoaded = 0, // initial state, valid only if server never contacted
  74. loading,
  75. loaded,
  76. unableToLoad
  77. } nodeStateType;
  78. CMTIpsmHandler(ITFSComponentData *pCompData) :
  79. CMTHandler(pCompData),
  80. m_verbDefault(MMC_VERB_OPEN)
  81. { m_nState = notLoaded; m_bSelected = FALSE; }
  82. ~CMTIpsmHandler() {};
  83. // base handler virtual function over-rides
  84. virtual HRESULT SaveColumns(ITFSComponent *, MMC_COOKIE, LPARAM, LPARAM);
  85. // by default we don't allow nodes to be renamed
  86. OVERRIDE_BaseHandlerNotify_OnRename() { return hrFalse; }
  87. // base result handler overrides
  88. OVERRIDE_BaseResultHandlerNotify_OnResultRefresh();
  89. OVERRIDE_BaseResultHandlerNotify_OnResultUpdateView();
  90. OVERRIDE_BaseResultHandlerNotify_OnResultSelect();
  91. OVERRIDE_BaseResultHandlerNotify_OnResultContextHelp();
  92. // Multi-select functionalty
  93. OVERRIDE_ResultHandler_OnCreateDataObject();
  94. void EnableVerbs(IConsoleVerb * pConsoleVerb,
  95. MMC_BUTTON_STATE ButtonState[],
  96. BOOL bEnable[]);
  97. protected:
  98. virtual void OnChangeState(ITFSNode* pNode);
  99. virtual void GetErrorPrefix(ITFSNode * pNode, CString * pstrPrefix) { };
  100. virtual void OnHaveData(ITFSNode * pParentNode, ITFSNode * pNewNode)
  101. {
  102. if (pNewNode->IsContainer())
  103. {
  104. // assume all the child containers are derived from this class
  105. //((CIpsmMTContainer*)pNode)->SetServer(GetServer());
  106. }
  107. pParentNode->AddChild(pNewNode);
  108. }
  109. virtual void UpdateConsoleVerbs(IConsoleVerb * pConsoleVerb, LONG_PTR dwNodeType, BOOL bMultiSelect = FALSE);
  110. void UpdateStandardVerbs(ITFSNode * pToolbar, LONG_PTR dwNodeType);
  111. HRESULT CreateMultiSelectData(ITFSComponent * pComponent, CDataObject * pObject);
  112. void ExpandNode(ITFSNode * pNode, BOOL fExpand);
  113. MMC_CONSOLE_VERB m_verbDefault;
  114. protected:
  115. BOOL m_bSelected;
  116. };
  117. /*---------------------------------------------------------------------------
  118. Class: CIpsmQueryObj : general purpose base class
  119. ---------------------------------------------------------------------------*/
  120. class CIpsmQueryObj : public CNodeQueryObject
  121. {
  122. public:
  123. CIpsmQueryObj
  124. (
  125. ITFSComponentData * pTFSCompData,
  126. ITFSNodeMgr * pNodeMgr
  127. ) : m_dwErr(0)
  128. {
  129. m_spTFSCompData.Set(pTFSCompData);
  130. m_spNodeMgr.Set(pNodeMgr);
  131. }
  132. CQueueDataListBase & GetQueue() { return m_dataQueue; }
  133. public:
  134. CString m_strServer;
  135. SPITFSComponentData m_spTFSCompData;
  136. SPITFSNodeMgr m_spNodeMgr;
  137. DWORD m_dwErr;
  138. };
  139. #endif _IPSMHAND_H