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.

210 lines
6.5 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1999 **/
  4. /**********************************************************************/
  5. /*
  6. winshand.h
  7. Header file for wins specific base handler classes and query obj
  8. FILE HISTORY:
  9. */
  10. #ifndef _WINSHAND_H
  11. #define _WINSHAND_H
  12. #ifndef _HANDLERS_H
  13. #include <handlers.h>
  14. #endif
  15. #ifndef _QUERYOBJ_H
  16. #include <queryobj.h>
  17. #endif
  18. extern MMC_CONSOLE_VERB g_ConsoleVerbs[8];
  19. extern MMC_BUTTON_STATE g_ConsoleVerbStates[WINSSNAP_NODETYPE_MAX][ARRAYLEN(g_ConsoleVerbs)];
  20. extern MMC_BUTTON_STATE g_ConsoleVerbStatesMultiSel[WINSSNAP_NODETYPE_MAX][ARRAYLEN(g_ConsoleVerbs)];
  21. /*---------------------------------------------------------------------------
  22. Class: CHandlerEx
  23. ---------------------------------------------------------------------------*/
  24. class CHandlerEx
  25. {
  26. // Interface
  27. public:
  28. virtual HRESULT InitializeNode(ITFSNode * pNode) = 0;
  29. LPCTSTR GetDisplayName() { return m_strDisplayName; }
  30. void SetDisplayName(LPCTSTR pName) { m_strDisplayName = pName; }
  31. private:
  32. CString m_strDisplayName;
  33. };
  34. /*---------------------------------------------------------------------------
  35. Class: CWinsHandler
  36. ---------------------------------------------------------------------------*/
  37. class CWinsHandler :
  38. public CHandler,
  39. public CHandlerEx
  40. {
  41. public:
  42. // enumeration for node states, to handle icon changes
  43. typedef enum
  44. {
  45. notLoaded = 0, // initial state, valid only if server never contacted
  46. loading,
  47. loaded,
  48. unableToLoad
  49. } nodeStateType;
  50. CWinsHandler(ITFSComponentData *pCompData)
  51. : CHandler(pCompData),
  52. m_verbDefault(MMC_VERB_OPEN)
  53. {
  54. };
  55. ~CWinsHandler() {};
  56. // base handler virtual function over-rides
  57. virtual HRESULT SaveColumns(ITFSComponent *, MMC_COOKIE, LPARAM, LPARAM);
  58. // Multi-select functionalty
  59. OVERRIDE_ResultHandler_OnCreateDataObject();
  60. // by default we don't allow nodes to be renamed
  61. OVERRIDE_BaseHandlerNotify_OnRename() { return hrFalse; }
  62. OVERRIDE_ResultHandler_AddMenuItems();
  63. OVERRIDE_ResultHandler_Command();
  64. OVERRIDE_BaseResultHandlerNotify_OnResultSelect();
  65. OVERRIDE_BaseResultHandlerNotify_OnResultDelete();
  66. OVERRIDE_BaseResultHandlerNotify_OnResultContextHelp();
  67. HRESULT HandleScopeCommand(MMC_COOKIE cookie, int nCommandID, LPDATAOBJECT pDataObject);
  68. HRESULT HandleScopeMenus(MMC_COOKIE cookie, LPDATAOBJECT pDataObject, LPCONTEXTMENUCALLBACK pContextMenuCallback, long * pInsertionAllowed);
  69. void EnableVerbs(IConsoleVerb * pConsoleVerb,
  70. MMC_BUTTON_STATE ButtonState[],
  71. BOOL bEnable[]);
  72. virtual const GUID * GetVirtualGuid(int nIndex) { return NULL; }
  73. protected:
  74. HRESULT CreateMultiSelectData(ITFSComponent * pComponent, CDataObject * pObject, BOOL bVirtual);
  75. void UpdateConsoleVerbs(IConsoleVerb * pConsoleVerb, LONG_PTR dwNodeType, BOOL bMultiSelect = FALSE);
  76. virtual DWORD UpdateStatistics(ITFSNode * pNode) { return 0; }
  77. // This is the default verb, by default it is set to MMC_VERB_OPEN
  78. MMC_CONSOLE_VERB m_verbDefault;
  79. };
  80. /*---------------------------------------------------------------------------
  81. Class: CMTWinsHandler
  82. ---------------------------------------------------------------------------*/
  83. class CMTWinsHandler :
  84. public CMTHandler,
  85. public CHandlerEx
  86. {
  87. public:
  88. // enumeration for node states, to handle icon changes
  89. typedef enum
  90. {
  91. notLoaded = 0, // initial state, valid only if server never contacted
  92. loading,
  93. loaded,
  94. unableToLoad
  95. } nodeStateType;
  96. CMTWinsHandler(ITFSComponentData *pCompData)
  97. : CMTHandler(pCompData),
  98. m_verbDefault(MMC_VERB_OPEN),
  99. m_fSilent(FALSE),
  100. m_fExpandSync(FALSE)
  101. {
  102. m_nState = notLoaded;
  103. }
  104. ~CMTWinsHandler() {};
  105. // base handler virtual function over-rides
  106. virtual HRESULT SaveColumns(ITFSComponent *, MMC_COOKIE, LPARAM, LPARAM);
  107. // by default we don't allow nodes to be renamed
  108. OVERRIDE_BaseHandlerNotify_OnRename() { return hrFalse; }
  109. OVERRIDE_BaseHandlerNotify_OnExpandSync();
  110. // Multi-select functionalty
  111. OVERRIDE_ResultHandler_OnCreateDataObject();
  112. OVERRIDE_BaseResultHandlerNotify_OnResultSelect();
  113. OVERRIDE_BaseResultHandlerNotify_OnResultUpdateView();
  114. OVERRIDE_BaseResultHandlerNotify_OnResultDelete();
  115. OVERRIDE_BaseResultHandlerNotify_OnResultContextHelp();
  116. HRESULT HandleScopeCommand(MMC_COOKIE cookie, int nCommandID, LPDATAOBJECT pDataObject);
  117. HRESULT HandleScopeMenus(MMC_COOKIE cookie, LPDATAOBJECT pDataObject, LPCONTEXTMENUCALLBACK pContextMenuCallback, long * pInsertionAllowed);
  118. void EnableVerbs(IConsoleVerb * pConsoleVerb,
  119. MMC_BUTTON_STATE ButtonState[],
  120. BOOL bEnable[]);
  121. virtual const GUID * GetVirtualGuid(int nIndex) { return NULL; }
  122. void ExpandNode(ITFSNode * pNode, BOOL fExpand);
  123. // any node with taskpads should override this to identify itself
  124. virtual int GetTaskpadIndex() { return 0; }
  125. protected:
  126. virtual void GetErrorInfo(CString & strTitle, CString & strBody, IconIdentifier * pIcon) { };
  127. virtual void OnChangeState(ITFSNode* pNode);
  128. virtual void OnHaveData(ITFSNode * pParentNode, ITFSNode * pNewNode)
  129. {
  130. if (pNewNode->IsContainer())
  131. {
  132. // assume all the child containers are derived from this class
  133. //((CWinsMTContainer*)pNode)->SetServer(GetServer());
  134. }
  135. pParentNode->AddChild(pNewNode);
  136. }
  137. HRESULT CreateMultiSelectData(ITFSComponent * pComponent, CDataObject * pObject, BOOL bVirtual);
  138. void UpdateStandardVerbs(ITFSNode * pToolbar, LONG_PTR dwNodeType);
  139. void UpdateConsoleVerbs(IConsoleVerb * pConsoleVerb, LONG_PTR dwNodeType, BOOL bMultiSelect = FALSE);
  140. // This is the default verb, by default it is set to MMC_VERB_OPEN
  141. MMC_CONSOLE_VERB m_verbDefault;
  142. BOOL m_bSelected;
  143. BOOL m_fSilent;
  144. BOOL m_fExpandSync;
  145. };
  146. /*---------------------------------------------------------------------------
  147. Class: CWinsQueryObj : general purpose base class
  148. ---------------------------------------------------------------------------*/
  149. class CWinsQueryObj : public CNodeQueryObject
  150. {
  151. public:
  152. CWinsQueryObj
  153. (
  154. ITFSComponentData * pTFSCompData,
  155. ITFSNodeMgr * pNodeMgr
  156. )
  157. {
  158. m_spTFSCompData.Set(pTFSCompData);
  159. m_spNodeMgr.Set(pNodeMgr);
  160. }
  161. CQueueDataListBase & GetQueue() { return m_dataQueue; }
  162. public:
  163. CString m_strServer;
  164. SPITFSComponentData m_spTFSCompData;
  165. SPITFSNodeMgr m_spNodeMgr;
  166. };
  167. #endif _WINSHAND_H