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.

234 lines
5.7 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1998 **/
  4. /**********************************************************************/
  5. /*
  6. statmap.cpp
  7. WINS static mappings node information.
  8. FILE HISTORY:
  9. */
  10. #include "stdafx.h"
  11. #include "statmap.h"
  12. /*---------------------------------------------------------------------------
  13. CStaticMappingsHandler::CStaticMappingsHandler
  14. Description
  15. Author: EricDav
  16. ---------------------------------------------------------------------------*/
  17. CStaticMappingsHandler::CStaticMappingsHandler(ITFSComponentData *pCompData) : CWinsHandler(pCompData)
  18. {
  19. }
  20. /*!--------------------------------------------------------------------------
  21. CStaticMappingsHandler::InitializeNode
  22. Initializes node specific data
  23. Author: EricDav
  24. ---------------------------------------------------------------------------*/
  25. HRESULT
  26. CStaticMappingsHandler::InitializeNode
  27. (
  28. ITFSNode * pNode
  29. )
  30. {
  31. AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
  32. CString strTemp;
  33. strTemp.LoadString(IDS_ROOT_NODENAME);
  34. SetDisplayName(strTemp);
  35. // Make the node immediately visible
  36. //pNode->SetVisibilityState(TFS_VIS_SHOW);
  37. pNode->SetData(TFS_DATA_COOKIE, (LPARAM) pNode);
  38. pNode->SetData(TFS_DATA_IMAGEINDEX, ICON_IDX_SERVER);
  39. pNode->SetData(TFS_DATA_OPENIMAGEINDEX, ICON_IDX_SERVER);
  40. pNode->SetData(TFS_DATA_USER, (LPARAM) this);
  41. SetColumnStringIDs(&aColumns[WINSSNAP_ROOT][0]);
  42. SetColumnWidths(&aColumnWidths[WINSSNAP_ROOT][0]);
  43. return hrOK;
  44. }
  45. /*---------------------------------------------------------------------------
  46. Overridden base handler functions
  47. ---------------------------------------------------------------------------*/
  48. /*!--------------------------------------------------------------------------
  49. CStaticMappingsHandler::GetString
  50. Implementation of ITFSNodeHandler::GetString
  51. Author: KennT
  52. ---------------------------------------------------------------------------*/
  53. STDMETHODIMP_(LPCTSTR)
  54. CStaticMappingsHandler::GetString
  55. (
  56. ITFSNode * pNode,
  57. int nCol
  58. )
  59. {
  60. if (nCol == 0 || nCol == -1)
  61. return GetDisplayName();
  62. else
  63. return NULL;
  64. }
  65. /*---------------------------------------------------------------------------
  66. CStaticMappingsHandler::OnAddMenuItems
  67. Description
  68. Author: EricDav
  69. ---------------------------------------------------------------------------*/
  70. STDMETHODIMP
  71. CStaticMappingsHandler::OnAddMenuItems
  72. (
  73. ITFSNode * pNode,
  74. LPCONTEXTMENUCALLBACK pContextMenuCallback,
  75. LPDATAOBJECT lpDataObject,
  76. DATA_OBJECT_TYPES type,
  77. DWORD dwType
  78. )
  79. {
  80. AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
  81. HRESULT hr = S_OK;
  82. CString strMenuItem;
  83. strMenuItem.LoadString(IDS_ADD_SERVER);
  84. if (type == CCT_SCOPE)
  85. {
  86. // these menu items go in the new menu,
  87. // only visible from scope pane
  88. ASSERT( SUCCEEDED(hr) );
  89. }
  90. return hr;
  91. }
  92. /*---------------------------------------------------------------------------
  93. CStaticMappingsHandler::OnCommand
  94. Description
  95. Author: EricDav
  96. ---------------------------------------------------------------------------*/
  97. STDMETHODIMP
  98. CStaticMappingsHandler::OnCommand
  99. (
  100. ITFSNode * pNode,
  101. long nCommandId,
  102. DATA_OBJECT_TYPES type,
  103. LPDATAOBJECT pDataObject,
  104. DWORD dwType
  105. )
  106. {
  107. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  108. HRESULT hr = S_OK;
  109. return hr;
  110. }
  111. /*!--------------------------------------------------------------------------
  112. CStaticMappingsHandler::HasPropertyPages
  113. Implementation of ITFSNodeHandler::HasPropertyPages
  114. NOTE: the root node handler has to over-ride this function to
  115. handle the snapin manager property page (wizard) case!!!
  116. Author: KennT
  117. ---------------------------------------------------------------------------*/
  118. STDMETHODIMP
  119. CStaticMappingsHandler::HasPropertyPages
  120. (
  121. ITFSNode * pNode,
  122. LPDATAOBJECT pDataObject,
  123. DATA_OBJECT_TYPES type,
  124. DWORD dwType
  125. )
  126. {
  127. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  128. HRESULT hr = hrOK;
  129. if (dwType & TFS_COMPDATA_CREATE)
  130. {
  131. // This is the case where we are asked to bring up property
  132. // pages when the user is adding a new snapin. These calls
  133. // are forwarded to the root node to handle.
  134. hr = hrFalse;
  135. }
  136. else
  137. {
  138. // we have property pages in the normal case
  139. hr = hrFalse;
  140. }
  141. return hr;
  142. }
  143. /*---------------------------------------------------------------------------
  144. CStaticMappingsHandler::CreatePropertyPages
  145. Description
  146. Author: EricDav
  147. ---------------------------------------------------------------------------*/
  148. STDMETHODIMP
  149. CStaticMappingsHandler::CreatePropertyPages
  150. (
  151. ITFSNode * pNode,
  152. LPPROPERTYSHEETCALLBACK lpProvider,
  153. LPDATAOBJECT pDataObject,
  154. LONG_PTR handle,
  155. DWORD dwType
  156. )
  157. {
  158. AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
  159. HRESULT hr = hrOK;
  160. HPROPSHEETPAGE hPage;
  161. Assert(pNode->GetData(TFS_DATA_COOKIE) == 0);
  162. if (dwType & TFS_COMPDATA_CREATE)
  163. {
  164. //
  165. // We are loading this snapin for the first time, put up a property
  166. // page to allow them to name this thing.
  167. //
  168. }
  169. else
  170. {
  171. //
  172. // Object gets deleted when the page is destroyed
  173. //
  174. }
  175. Error:
  176. return hr;
  177. }
  178. /*---------------------------------------------------------------------------
  179. CStaticMappingsHandler::OnPropertyChange
  180. Description
  181. Author: EricDav
  182. ---------------------------------------------------------------------------*/
  183. HRESULT
  184. CStaticMappingsHandler::OnPropertyChange
  185. (
  186. ITFSNode * pNode,
  187. LPDATAOBJECT pDataobject,
  188. DWORD dwType,
  189. LPARAM arg,
  190. LPARAM lParam
  191. )
  192. {
  193. AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
  194. return hrOK;
  195. }
  196. /*---------------------------------------------------------------------------
  197. Command handlers
  198. ---------------------------------------------------------------------------*/