Leaked source code of windows server 2003
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.

241 lines
6.6 KiB

  1. //============================================================================
  2. // Copyright (C) Microsoft Corporation, 1997 - 1999
  3. //
  4. // File: tfsnode.h
  5. //
  6. // History:
  7. //
  8. // 04/13/97 Kenn Takara Created.
  9. //
  10. // Declarations for some common code/macros.
  11. //============================================================================
  12. #ifndef _TFSNODE_H_
  13. #define _TFSNODE_H_
  14. #if _MSC_VER >= 1000 // VC 5.0 or later
  15. #pragma once
  16. #endif
  17. // UpdateAllViews hints
  18. #define RESULT_PANE_ADD_ITEM ( 0x00000001 )
  19. #define RESULT_PANE_DELETE_ITEM ( 0x00000002 )
  20. #define RESULT_PANE_CHANGE_ITEM_DATA ( 0x00000004 )
  21. #define RESULT_PANE_CHANGE_ITEM_ICON ( 0x00000008 )
  22. #define RESULT_PANE_CHANGE_ITEM ( RESULT_PANE_CHANGE_ITEM_DATA | RESULT_PANE_CHANGE_ITEM_ICON )
  23. #define RESULT_PANE_REPAINT ( 0x00000010 )
  24. #define RESULT_PANE_DELETE_ALL ( 0x00000020 )
  25. #define RESULT_PANE_ADD_ALL ( 0x00000040 )
  26. #define RESULT_PANE_COLUMN_CHANGE ( 0x00000080 )
  27. #define RESULT_PANE_SAVE_COLUMNS ( 0x00000100 )
  28. #define RESULT_PANE_UPDATE_VERBS ( 0x00000200 )
  29. #define RESULT_PANE_SET_VIRTUAL_LB_SIZE ( 0x00000400 )
  30. #define RESULT_PANE_CLEAR_VIRTUAL_LB ( 0x00000800 )
  31. #define RESULT_PANE_EXPAND ( 0x00001000 )
  32. #define RESULT_PANE_SHOW_MESSAGE ( 0x00002000 )
  33. #define RESULT_PANE_CLEAR_MESSAGE ( 0x00004000 )
  34. // Used for ChangeNode
  35. #define SCOPE_PANE_CHANGE_ITEM_DATA ( 0x00000080 )
  36. #define SCOPE_PANE_CHANGE_ITEM_ICON ( 0x00000100 )
  37. #define SCOPE_PANE_STATE_NORMAL ( 0x00000200 )
  38. #define SCOPE_PANE_STATE_BOLD ( 0x00000400 )
  39. #define SCOPE_PANE_STATE_EXPANDEDONCE ( 0x00000800 )
  40. #define SCOPE_PANE_STATE_CLEAR ( 0x00001000 )
  41. #define SCOPE_PANE_CHANGE_ITEM ( SCOPE_PANE_CHANGE_ITEM_DATA | \
  42. SCOPE_PANE_CHANGE_ITEM_ICON )
  43. typedef struct _TFSEXPANDDATA
  44. {
  45. SPITFSNode spNode;
  46. BOOL fExpand;
  47. } TFSEXPANDDATA, * LPTFSEXPANDDATA;
  48. typedef CList<ITFSNode *, ITFSNode *> CTFSNodeListBase;
  49. class CTFSNodeList : public CTFSNodeListBase
  50. {
  51. public:
  52. ~CTFSNodeList()
  53. {
  54. ReleaseAllNodes();
  55. }
  56. BOOL RemoveNode(ITFSNode* p)
  57. {
  58. POSITION pos = Find(p);
  59. if (pos == NULL)
  60. return FALSE;
  61. RemoveAt(pos);
  62. return TRUE;
  63. }
  64. void ReleaseAllNodes()
  65. {
  66. while (!IsEmpty())
  67. RemoveTail()->Release();
  68. }
  69. BOOL HasNode(ITFSNode* p)
  70. {
  71. return NULL != Find(p);
  72. }
  73. };
  74. #define IMPL
  75. /*---------------------------------------------------------------------------
  76. Class: TFSNode
  77. ---------------------------------------------------------------------------*/
  78. class TFSNode : public ITFSNode
  79. {
  80. public:
  81. TFSNode();
  82. virtual ~TFSNode();
  83. DeclareIUnknownMembers(IMPL);
  84. DeclareITFSNodeMembers(IMPL);
  85. HRESULT Construct(const GUID *pNodeType,
  86. ITFSNodeHandler *pHandler,
  87. ITFSResultHandler *pResultHandler,
  88. ITFSNodeMgr *pNodeMgr);
  89. protected:
  90. HRESULT UpdateAllViewsHelper(LPARAM data, LONG_PTR hint);
  91. HRESULT InternalRemoveFromUI(ITFSNode *pNode, BOOL fDeleteThis);
  92. HRESULT InternalZeroScopeID(ITFSNode *pNode, BOOL fZeroChildren);
  93. protected:
  94. TFSVisibility m_tfsVis;
  95. LONG_PTR m_uData; // user-settable data
  96. LONG_PTR m_uDataParent; // user-settable (set by the parent) data
  97. LONG_PTR m_uType; // user-settable data
  98. LONG_PTR m_cookie;
  99. IfDebug(BOOL m_bCookieSet);
  100. SPITFSNodeHandler m_spNodeHandler;
  101. SPITFSResultHandler m_spResultHandler;
  102. BOOL m_fContainer;
  103. int m_nImageIndex;
  104. int m_nOpenImageIndex;
  105. LPARAM m_lParam;
  106. long m_cPropSheet; // # of active property pages
  107. BOOL m_fDirty;
  108. SPITFSNode m_spNodeParent;
  109. SPITFSNodeMgr m_spNodeMgr;
  110. HSCOPEITEM m_hScopeItem;
  111. const GUID * m_pNodeType;
  112. // Positional data
  113. HSCOPEITEM m_hRelativeId;
  114. ULONG m_ulRelativeFlags;
  115. BOOL m_fScopeLeafNode;
  116. LONG m_cRef;
  117. private:
  118. HRESULT InitializeScopeDataItem(LPSCOPEDATAITEM pScopeDataItem,
  119. HSCOPEITEM pParentScopeItem,
  120. LPARAM lParam,
  121. int nImage,
  122. int nOpenImage,
  123. BOOL bHasChildren,
  124. ULONG ulRelativeFlags,
  125. HSCOPEITEM hSibling);
  126. };
  127. /*---------------------------------------------------------------------------
  128. Class: TFSContainer
  129. ---------------------------------------------------------------------------*/
  130. class TFSContainer : public TFSNode
  131. {
  132. public:
  133. virtual ~TFSContainer();
  134. // specific container-related functions that we need to override
  135. STDMETHOD_(BOOL, IsContainer) ();
  136. STDMETHOD(AddChild) (ITFSNode *pNodeChild);
  137. STDMETHOD(InsertChild) (ITFSNode *pInsertAfterNode, ITFSNode *pNodeChild);
  138. STDMETHOD(RemoveChild) (ITFSNode *pNodeChild);
  139. STDMETHOD(ExtractChild) (ITFSNode *pNodeChild);
  140. STDMETHOD(GetChildCount) (int *pVis, int *pTotal);
  141. STDMETHOD(GetEnum) (ITFSNodeEnum **ppNodeEnum);
  142. STDMETHOD(DeleteAllChildren) (BOOL fRemoveFromUI);
  143. STDMETHOD(CompareChildNodes) (int *pnResult, ITFSNode *pChild1, ITFSNode *pChild2);
  144. STDMETHOD_(LONG_PTR, Notify)(int nIndex, LPARAM lParam);
  145. // we override this node interface member for containers
  146. STDMETHOD(ChangeNode)(LONG_PTR changeMask);
  147. protected:
  148. HRESULT InternalAddToList(ITFSNode *pInsertAfterNode, ITFSNode *pNode);
  149. HRESULT InternalRemoveFromList(ITFSNode *pNode);
  150. HRESULT InternalRemoveChild(ITFSNode * pChild,
  151. BOOL fRemoveFromList,
  152. BOOL fRemoveFromUI,
  153. BOOL fRemoveChildren);
  154. CTFSNodeList m_listChildren;
  155. private:
  156. friend class TFSNodeEnum;
  157. };
  158. /*---------------------------------------------------------------------------
  159. Class: TFSNodeEnum
  160. ---------------------------------------------------------------------------*/
  161. class TFSNodeEnum : public ITFSNodeEnum
  162. {
  163. public:
  164. TFSNodeEnum(TFSContainer * pNode);
  165. virtual ~TFSNodeEnum();
  166. DeclareIUnknownMembers(IMPL);
  167. DeclareITFSNodeEnumMembers(IMPL);
  168. protected:
  169. TFSContainer * m_pNode;
  170. LONG m_cRef;
  171. POSITION m_pos;
  172. private:
  173. };
  174. /*---------------------------------------------------------------------------
  175. Class: TFSNodeMgr
  176. ---------------------------------------------------------------------------*/
  177. class TFSNodeMgr :
  178. public ITFSNodeMgr
  179. {
  180. public:
  181. TFSNodeMgr();
  182. ~TFSNodeMgr();
  183. DeclareIUnknownMembers(IMPL)
  184. DeclareITFSNodeMgrMembers(IMPL)
  185. HRESULT Construct(IComponentData *pCompData,
  186. IConsoleNameSpace2 *pConsoleNS);
  187. protected:
  188. SPIComponentData m_spComponentData;
  189. SPITFSNode m_spRootNode;
  190. SPITFSNode m_spResultPaneNode;
  191. SPIConsole m_spConsole;
  192. SPIConsoleNameSpace m_spConsoleNS;
  193. long m_cRef;
  194. };
  195. #endif // _TFSNODE_H_