Source code of Windows XP (NT5)

198 lines
5.4 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // sdonode.h
  8. //
  9. // SYNOPSIS
  10. //
  11. // Declares the classes SdoResultItem and SdoScopeItem.
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 02/10/2000 Original version.
  16. // 04/19/2000 SdoScopeItem::getSelf returns by value, not reference.
  17. //
  18. ///////////////////////////////////////////////////////////////////////////////
  19. #ifndef SDONODE_H
  20. #define SDONODE_H
  21. #if _MSC_VER >= 1000
  22. #pragma once
  23. #endif
  24. class ProxyNode;
  25. class SdoScopeItem;
  26. ///////////////////////////////////////////////////////////////////////////////
  27. //
  28. // CLASS
  29. //
  30. // SdoResultItem
  31. //
  32. // DESCRIPTION
  33. //
  34. // Maps an SDO to MMC result pane data item
  35. //
  36. ///////////////////////////////////////////////////////////////////////////////
  37. class SdoResultItem : public SnapInDataItem
  38. {
  39. public:
  40. SdoResultItem(
  41. SdoScopeItem& owner,
  42. ISdo* sdo
  43. );
  44. UINT getImageIndex() const throw ()
  45. { return mapResourceId(IMAGE_INDEX); }
  46. Sdo& getSelf() throw ()
  47. { return self; }
  48. virtual HRESULT queryPagesFor() throw ();
  49. virtual HRESULT onDelete(
  50. SnapInView& view
  51. );
  52. virtual HRESULT onPropertyChange(
  53. SnapInView& view,
  54. BOOL scopeItem
  55. );
  56. virtual HRESULT onRename(
  57. SnapInView& view,
  58. LPCOLESTR newName
  59. );
  60. virtual HRESULT onSelect(
  61. SnapInView& view,
  62. BOOL scopeItem,
  63. BOOL selected
  64. );
  65. virtual HRESULT onViewChange(
  66. SnapInView& view,
  67. LPARAM data,
  68. LPARAM hint
  69. );
  70. protected:
  71. // Various resource IDs that the derived class must provide.
  72. enum ResourceId
  73. {
  74. IMAGE_INDEX,
  75. DELETE_TITLE,
  76. DELETE_LOCAL,
  77. DELETE_REMOTE,
  78. DELETE_LAST_LOCAL,
  79. DELETE_LAST_REMOTE,
  80. ERROR_CAPTION,
  81. ERROR_NOT_UNIQUE,
  82. ERROR_NAME_EMPTY
  83. };
  84. virtual UINT mapResourceId(ResourceId id) const throw () = 0;
  85. SdoScopeItem& parent; // Our scope pane node.
  86. Sdo self; // The SDO containing our properties.
  87. CComBSTR name; // Our name.
  88. };
  89. ///////////////////////////////////////////////////////////////////////////////
  90. //
  91. // CLASS
  92. //
  93. // SdoScopeItem
  94. //
  95. // DESCRIPTION
  96. //
  97. // Map an SDO collection to an MMC scope pane node.
  98. //
  99. ///////////////////////////////////////////////////////////////////////////////
  100. class SdoScopeItem : public SnapInPreNamedItem, public SdoConsumer
  101. {
  102. public:
  103. SdoScopeItem(
  104. SdoConnection& connection,
  105. int nameId,
  106. int errorTitleId,
  107. int topMenuItemId,
  108. int newMenuItemId
  109. );
  110. ~SdoScopeItem() throw ();
  111. // Returns the connection to the SDOs.
  112. SdoConnection& getCxn() throw ()
  113. { return cxn; }
  114. // Returns the number of result pane items.
  115. LONG getNumItems() const throw ()
  116. { return (LONG)items.size(); }
  117. HSCOPEITEM getScopeId() const throw ()
  118. { return scopeId; }
  119. void setScopeId(HSCOPEITEM newScopeId) throw ()
  120. { scopeId = newScopeId; }
  121. // Add a new result item to the node.
  122. void addResultItem(SnapInView& view, SdoResultItem& item);
  123. // Deletes an item from the result pane.
  124. void deleteResultItem(SnapInView& view, SdoResultItem& item);
  125. virtual HRESULT addMenuItems(
  126. SnapInView& view,
  127. LPCONTEXTMENUCALLBACK callback,
  128. long insertionAllowed
  129. );
  130. virtual HRESULT onRefresh(
  131. SnapInView& view
  132. );
  133. virtual HRESULT onSelect(
  134. SnapInView& view,
  135. BOOL scopeItem,
  136. BOOL selected
  137. );
  138. virtual HRESULT onShow(
  139. SnapInView& view,
  140. HSCOPEITEM itemId,
  141. BOOL selected
  142. );
  143. virtual HRESULT onViewChange(
  144. SnapInView& view,
  145. LPARAM data,
  146. LPARAM hint
  147. );
  148. protected:
  149. typedef ObjectVector<SdoResultItem> ResultItems;
  150. typedef ResultItems::iterator ResultIterator;
  151. // SdoConsumer.
  152. virtual bool queryRefresh(SnapInView& view);
  153. virtual void refreshComplete(SnapInView& view);
  154. // Insert the contents of 'items' into the result pane.
  155. void insertResultItems(SnapInView& view);
  156. // Return the collection corresponding to this node.
  157. virtual SdoCollection getSelf() = 0;
  158. // Populate dst with the SDOs from src.
  159. virtual void getResultItems(
  160. SdoEnum& src,
  161. ResultItems& dst
  162. ) = 0;
  163. // Set the result pane column headers.
  164. virtual void insertColumns(
  165. IHeaderCtrl2* headerCtrl
  166. ) = 0;
  167. SdoConnection& cxn; // Connection to the sdos.
  168. ResultItems items; // Our children.
  169. bool active; // 'true' if we're currently selected.
  170. bool loaded; // 'true' if we've loaded 'items'.
  171. private:
  172. int errorTitle; // Resource ID for error dialog titles.
  173. ResourceString topMenuItem; // Menu items.
  174. ResourceString newMenuItem;
  175. HSCOPEITEM scopeId;
  176. };
  177. #endif // SDONODE_H