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.

275 lines
11 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1999 **/
  4. /**********************************************************************/
  5. /*
  6. basehand.h
  7. base classes for node handlers.
  8. FILE HISTORY:
  9. */
  10. #ifndef _BASEHAND_H
  11. #define _BASEHAND_H
  12. #ifndef _TFSINT_H
  13. #include "tfsint.h"
  14. #endif
  15. #ifndef _TFSNODE_H
  16. #include "tfsnode.h"
  17. #endif
  18. /*---------------------------------------------------------------------------
  19. Class: CBaseHandler
  20. This class provides functionality for handling notification from the
  21. IComponentData interface on a node (or handler) basis. The
  22. CBaseResultHandler class handles notifcation to the IConponent interface
  23. that a snapin exposes.
  24. ---------------------------------------------------------------------------*/
  25. #define OVERRIDE_BaseHandlerNotify_OnPropertyChange() \
  26. virtual HRESULT OnPropertyChange(ITFSNode *pNode,LPDATAOBJECT pdo,DWORD dwType,LPARAM arg,LPARAM lParam) \
  27. #define OVERRIDE_BaseHandlerNotify_OnDelete() \
  28. virtual HRESULT OnDelete(ITFSNode *pNode,LPARAM arg,LPARAM lParam)
  29. #define OVERRIDE_BaseHandlerNotify_OnRename() \
  30. virtual HRESULT OnRename(ITFSNode *pNode,LPARAM arg,LPARAM lParam)
  31. #define OVERRIDE_BaseHandlerNotify_OnRemoveChildren() \
  32. virtual HRESULT OnRemoveChildren(ITFSNode *pNode,LPDATAOBJECT pdo,LPARAM arg,LPARAM lParam)
  33. #define OVERRIDE_BaseHandlerNotify_OnExpandSync() \
  34. virtual HRESULT OnExpandSync(ITFSNode *pNode,LPDATAOBJECT pdo,LPARAM arg,LPARAM lParam)
  35. #define OVERRIDE_BaseHandlerNotify_OnExpand() \
  36. virtual HRESULT OnExpand(ITFSNode *pNode,LPDATAOBJECT pdo, DWORD dwType, LPARAM arg,LPARAM lParam)
  37. #define OVERRIDE_BaseHandlerNotify_OnContextMenu() \
  38. virtual HRESULT OnContextMenu(ITFSNode *pNode,LPARAM arg,LPARAM lParam)
  39. #define OVERRIDE_BaseHandlerNotify_OnVerbCopy() \
  40. virtual HRESULT OnVerbCopy(ITFSNode *pNode,LPARAM arg,LPARAM lParam)
  41. #define OVERRIDE_BaseHandlerNotify_OnVerbPaste() \
  42. virtual HRESULT OnVerbPaste(ITFSNode *pNode,LPARAM arg,LPARAM lParam)
  43. #define OVERRIDE_BaseHandlerNotify_OnVerbDelete() \
  44. virtual HRESULT OnVerbDelete(ITFSNode *pNode,LPARAM arg,LPARAM lParam)
  45. #define OVERRIDE_BaseHandlerNotify_OnVerbProperties() \
  46. virtual HRESULT OnVerbProperties(ITFSNode *pNode,LPARAM arg,LPARAM lParam)
  47. #define OVERRIDE_BaseHandlerNotify_OnVerbRename() \
  48. virtual HRESULT OnVerbRename(ITFSNode *pNode,LPARAM arg,LPARAM lParam)
  49. #define OVERRIDE_BaseHandlerNotify_OnVerbRefresh() \
  50. virtual HRESULT OnVerbRefresh(ITFSNode *pNode,LPARAM arg,LPARAM lParam)
  51. #define OVERRIDE_BaseHandlerNotify_OnVerbPrint() \
  52. virtual HRESULT OnVerbPrint(ITFSNode *pNode,LPARAM arg,LPARAM lParam)
  53. #define OVERRIDE_BaseHandlerNotify_OnRestoreView() \
  54. virtual HRESULT OnRestoreView(ITFSNode *pNode,LPARAM arg,LPARAM lParam)
  55. #define OVERRIDE_BaseHandlerNotify_OnCreateNodeId2() \
  56. virtual HRESULT OnCreateNodeId2(ITFSNode *pNode,CString & strId,LPDWORD pdwFlags)
  57. //class TFS_EXPORT_CLASS CBaseHandler :
  58. class CBaseHandler :
  59. public ITFSNodeHandler
  60. {
  61. public:
  62. DeclareIUnknownMembers(IMPL)
  63. DeclareITFSNodeHandlerMembers(IMPL)
  64. CBaseHandler(ITFSComponentData *pTFSCompData);
  65. virtual ~CBaseHandler();
  66. // Here are the possible notifications
  67. OVERRIDE_BaseHandlerNotify_OnPropertyChange();
  68. OVERRIDE_BaseHandlerNotify_OnDelete();
  69. OVERRIDE_BaseHandlerNotify_OnRename();
  70. OVERRIDE_BaseHandlerNotify_OnRemoveChildren();
  71. OVERRIDE_BaseHandlerNotify_OnExpandSync();
  72. OVERRIDE_BaseHandlerNotify_OnExpand();
  73. OVERRIDE_BaseHandlerNotify_OnContextMenu();
  74. OVERRIDE_BaseHandlerNotify_OnVerbCopy();
  75. OVERRIDE_BaseHandlerNotify_OnVerbPaste();
  76. OVERRIDE_BaseHandlerNotify_OnVerbDelete();
  77. OVERRIDE_BaseHandlerNotify_OnVerbProperties();
  78. OVERRIDE_BaseHandlerNotify_OnVerbRename();
  79. OVERRIDE_BaseHandlerNotify_OnVerbRefresh();
  80. OVERRIDE_BaseHandlerNotify_OnVerbPrint();
  81. OVERRIDE_BaseHandlerNotify_OnRestoreView();
  82. OVERRIDE_BaseHandlerNotify_OnCreateNodeId2();
  83. protected:
  84. SPITFSComponentData m_spTFSCompData;
  85. SPITFSNodeMgr m_spNodeMgr;
  86. long m_cRef;
  87. };
  88. /*---------------------------------------------------------------------------
  89. Class: CBaseResultHandler
  90. ---------------------------------------------------------------------------*/
  91. #define OVERRIDE_BaseResultHandlerNotify_OnResultActivate() \
  92. virtual HRESULT OnResultActivate(ITFSComponent *,MMC_COOKIE,LPARAM,LPARAM)
  93. #define OVERRIDE_BaseResultHandlerNotify_OnResultColumnClick() \
  94. virtual HRESULT OnResultColumnClick(ITFSComponent *, LPARAM, BOOL)
  95. #define OVERRIDE_BaseResultHandlerNotify_OnResultColumnsChanged() \
  96. virtual HRESULT OnResultColumnsChanged(ITFSComponent *, LPDATAOBJECT, MMC_VISIBLE_COLUMNS *)
  97. #define OVERRIDE_BaseResultHandlerNotify_OnResultDelete() \
  98. virtual HRESULT OnResultDelete(ITFSComponent *,LPDATAOBJECT,MMC_COOKIE,LPARAM,LPARAM)
  99. #define OVERRIDE_BaseResultHandlerNotify_OnResultRename() \
  100. virtual HRESULT OnResultRename(ITFSComponent *,LPDATAOBJECT,MMC_COOKIE,LPARAM,LPARAM)
  101. #define OVERRIDE_BaseResultHandlerNotify_OnResultRefresh() \
  102. virtual HRESULT OnResultRefresh(ITFSComponent *,LPDATAOBJECT,MMC_COOKIE,LPARAM,LPARAM)
  103. #define OVERRIDE_BaseResultHandlerNotify_OnResultContextHelp() \
  104. virtual HRESULT OnResultContextHelp(ITFSComponent *,LPDATAOBJECT,MMC_COOKIE,LPARAM,LPARAM)
  105. #define OVERRIDE_BaseResultHandlerNotify_OnResultQueryPaste() \
  106. virtual HRESULT OnResultQueryPaste(ITFSComponent *,LPDATAOBJECT,MMC_COOKIE,LPARAM,LPARAM)
  107. #define OVERRIDE_BaseResultHandlerNotify_OnResultPropertyChange() \
  108. virtual HRESULT OnResultPropertyChange(ITFSComponent *,LPDATAOBJECT,MMC_COOKIE,LPARAM,LPARAM)
  109. #define OVERRIDE_BaseResultHandlerNotify_OnResultItemClkOrDblClk() \
  110. virtual HRESULT OnResultItemClkOrDblClk(ITFSComponent *,MMC_COOKIE,LPARAM,LPARAM,BOOL)
  111. #define OVERRIDE_BaseResultHandlerNotify_OnResultMinimize() \
  112. virtual HRESULT OnResultMinimize(ITFSComponent *,MMC_COOKIE,LPARAM,LPARAM)
  113. #define OVERRIDE_BaseResultHandlerNotify_OnResultSelect() \
  114. virtual HRESULT OnResultSelect(ITFSComponent *,LPDATAOBJECT,MMC_COOKIE,LPARAM,LPARAM)
  115. #define OVERRIDE_BaseResultHandlerNotify_OnResultInitOcx() \
  116. virtual HRESULT OnResultInitOcx(ITFSComponent *,LPDATAOBJECT,MMC_COOKIE,LPARAM,LPARAM)
  117. #define OVERRIDE_BaseResultHandlerNotify_OnResultShow() \
  118. virtual HRESULT OnResultShow(ITFSComponent *,MMC_COOKIE,LPARAM,LPARAM)
  119. #define OVERRIDE_BaseResultHandlerNotify_OnResultUpdateView() \
  120. virtual HRESULT OnResultUpdateView(ITFSComponent *,LPDATAOBJECT,LPARAM,LPARAM)
  121. #define OVERRIDE_BaseResultHandlerNotify_OnResultVerbCopy() \
  122. virtual HRESULT OnResultVerbCopy(ITFSComponent *,MMC_COOKIE,LPARAM,LPARAM)
  123. #define OVERRIDE_BaseResultHandlerNotify_OnResultVerbPaste() \
  124. virtual HRESULT OnResultVerbPaste(ITFSComponent *,MMC_COOKIE,LPARAM,LPARAM)
  125. #define OVERRIDE_BaseResultHandlerNotify_OnResultVerbDelete() \
  126. virtual HRESULT OnResultVerbDelete(ITFSComponent *,MMC_COOKIE,LPARAM,LPARAM)
  127. #define OVERRIDE_BaseResultHandlerNotify_OnResultVerbProperties() \
  128. virtual HRESULT OnResultVerbProperties(ITFSComponent *,MMC_COOKIE,LPARAM,LPARAM)
  129. #define OVERRIDE_BaseResultHandlerNotify_OnResultVerbRename() \
  130. virtual HRESULT OnResultVerbRename(ITFSComponent *,MMC_COOKIE,LPARAM,LPARAM)
  131. #define OVERRIDE_BaseResultHandlerNotify_OnResultVerbPrint() \
  132. virtual HRESULT OnResultVerbPrint(ITFSComponent *,MMC_COOKIE,LPARAM,LPARAM)
  133. #define OVERRIDE_BaseResultHandlerNotify_OnResultVerbRefresh() \
  134. virtual HRESULT OnResultVerbRefresh(ITFSComponent *,MMC_COOKIE,LPARAM,LPARAM)
  135. #define OVERRIDE_BaseResultHandlerNotify_OnResultRestoreView() \
  136. virtual HRESULT OnResultRestoreView(ITFSComponent *,MMC_COOKIE,LPARAM,LPARAM)
  137. //class TFS_EXPORT_CLASS CBaseResultHandlerNotify :
  138. class CBaseResultHandler :
  139. public ITFSResultHandler
  140. {
  141. public:
  142. CBaseResultHandler(ITFSComponentData *pTFSCompData);
  143. virtual ~CBaseResultHandler();
  144. DeclareIUnknownMembers(IMPL)
  145. DeclareITFSResultHandlerMembers(IMPL)
  146. // Here are the possible notifications
  147. OVERRIDE_BaseResultHandlerNotify_OnResultActivate();
  148. OVERRIDE_BaseResultHandlerNotify_OnResultColumnClick();
  149. OVERRIDE_BaseResultHandlerNotify_OnResultColumnsChanged();
  150. OVERRIDE_BaseResultHandlerNotify_OnResultDelete();
  151. OVERRIDE_BaseResultHandlerNotify_OnResultRename();
  152. OVERRIDE_BaseResultHandlerNotify_OnResultRefresh();
  153. OVERRIDE_BaseResultHandlerNotify_OnResultContextHelp();
  154. OVERRIDE_BaseResultHandlerNotify_OnResultQueryPaste();
  155. OVERRIDE_BaseResultHandlerNotify_OnResultItemClkOrDblClk();
  156. OVERRIDE_BaseResultHandlerNotify_OnResultMinimize();
  157. OVERRIDE_BaseResultHandlerNotify_OnResultPropertyChange();
  158. OVERRIDE_BaseResultHandlerNotify_OnResultSelect();
  159. OVERRIDE_BaseResultHandlerNotify_OnResultInitOcx();
  160. OVERRIDE_BaseResultHandlerNotify_OnResultShow();
  161. OVERRIDE_BaseResultHandlerNotify_OnResultUpdateView();
  162. OVERRIDE_BaseResultHandlerNotify_OnResultVerbCopy();
  163. OVERRIDE_BaseResultHandlerNotify_OnResultVerbPaste();
  164. OVERRIDE_BaseResultHandlerNotify_OnResultVerbDelete();
  165. OVERRIDE_BaseResultHandlerNotify_OnResultVerbProperties();
  166. OVERRIDE_BaseResultHandlerNotify_OnResultVerbRename();
  167. OVERRIDE_BaseResultHandlerNotify_OnResultVerbRefresh();
  168. OVERRIDE_BaseResultHandlerNotify_OnResultVerbPrint();
  169. OVERRIDE_BaseResultHandlerNotify_OnResultRestoreView();
  170. // Over-ride these to provide custom column functionality
  171. // or custom ways to add things to the result pane
  172. virtual HRESULT LoadColumns(ITFSComponent *, MMC_COOKIE, LPARAM, LPARAM);
  173. virtual HRESULT SaveColumns(ITFSComponent *, MMC_COOKIE, LPARAM, LPARAM);
  174. virtual HRESULT EnumerateResultPane(ITFSComponent *, MMC_COOKIE, LPARAM, LPARAM);
  175. virtual HRESULT SortColumns(ITFSComponent *);
  176. virtual HRESULT SetVirtualLbSize(ITFSComponent * pComponent, LONG_PTR data);
  177. virtual HRESULT ClearVirtualLb(ITFSComponent * pComponent, LONG_PTR data);
  178. void SetColumnStringIDs(UINT * pStringIDs) { m_pColumnStringIDs = pStringIDs; }
  179. void SetColumnWidths(int * pWidths) { m_pColumnWidths = pWidths; }
  180. void SetColumnFormat(int nColumnFormat) { m_nColumnFormat = nColumnFormat; }
  181. HRESULT ShowMessage(ITFSNode * pNode, LPCTSTR pszTitle, LPCTSTR pszBody, IconIdentifier lIcon);
  182. HRESULT ClearMessage(ITFSNode * pNode);
  183. virtual HRESULT FIsTaskpadPreferred(ITFSComponent *pComponent);
  184. virtual HRESULT DoTaskpadResultSelect(ITFSComponent *pComponent, LPDATAOBJECT pDataObject, MMC_COOKIE cookie, LPARAM arg, LPARAM lParam, BOOL bTaskPadView);
  185. protected:
  186. HRESULT ChangeResultPaneItem(ITFSComponent *, ITFSNode *, LONG_PTR);
  187. HRESULT AddResultPaneItem(ITFSComponent *, ITFSNode *);
  188. HRESULT DeleteResultPaneItem(ITFSComponent *, ITFSNode *);
  189. HRESULT ShowResultMessage(ITFSComponent * pComponent, MMC_COOKIE cookie, LPARAM arg, LPARAM lParam);
  190. BOOL IsMessageView() {return m_fMessageView;}
  191. protected:
  192. SPITFSComponentData m_spTFSComponentData;
  193. SPITFSNodeMgr m_spResultNodeMgr;
  194. private:
  195. UINT * m_pColumnStringIDs;
  196. int * m_pColumnWidths;
  197. int m_nColumnFormat;
  198. LONG m_cRef;
  199. // result message view stuff
  200. BOOL m_fMessageView;
  201. CString m_strMessageTitle;
  202. CString m_strMessageBody;
  203. IconIdentifier m_lMessageIcon;
  204. };
  205. #endif _BASEHAND_H