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.

254 lines
6.8 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. /*++
  3. Copyright (C) Microsoft Corporation, 1997 - 1999
  4. Module Name:
  5. NodeWithScopeChildrenList.h
  6. Abstract:
  7. This is the header file for CNodeWithScopeChildrenList, a class which
  8. implements a node that has a list of scope pane children.
  9. This is an inline template class.
  10. Include NodeWithScopeChildrenList.cpp in the .cpp files
  11. of the classes in which you use this template.
  12. Author:
  13. Michael A. Maguire 12/01/97
  14. Revision History:
  15. mmaguire 12/01/97 - abstracted from CRootNode, which will be changed to subclass this class
  16. --*/
  17. //////////////////////////////////////////////////////////////////////////////
  18. #if !defined(_NODE_WITH_SCOPE_CHILDREN_LIST_H_)
  19. #define _NODE_WITH_SCOPE_CHILDREN_LIST_H_
  20. //////////////////////////////////////////////////////////////////////////////
  21. // BEGIN INCLUDES
  22. //
  23. // where we can find what this class derives from:
  24. //
  25. #include "SnapinNode.h"
  26. //
  27. //
  28. // where we can find what this class has or uses:
  29. //
  30. #include <atlapp.h> // for CSimpleArray
  31. //
  32. // END INCLUDES
  33. //////////////////////////////////////////////////////////////////////////////
  34. template <class T, class CChildNode >
  35. class CNodeWithScopeChildrenList : public CSnapinNode< T >
  36. {
  37. public:
  38. //////////////////////////////////////////////////////////////////////////////
  39. /*++
  40. CNodeWithScopeChildrenList::AddChild
  41. Adds a child to the list of children.
  42. This has to be public as it must be accessible even from a separate dialog
  43. (e.g. a Connect to Server dialog) that may want to add a child.
  44. Here we add the child item to the list of children and call InsertItem
  45. to add the child to the scope pane.
  46. This is one difference between adding nodes into the scope
  47. pane and the result pane. When we were inserting a child into
  48. the result pane, we didn't call InsertItem in the AddChild methods(s)
  49. because we needed to worry about sending an UpdataAllViews
  50. notification and repopulating the result pane in each view.
  51. Because MMC takes care of replicating scope pane changes to all views,
  52. we don't need to worry about this. Instead, we just do InsertItem once here.
  53. --*/
  54. //////////////////////////////////////////////////////////////////////////////
  55. virtual HRESULT AddChild( CChildNode * pChildNode );
  56. //////////////////////////////////////////////////////////////////////////////
  57. /*++
  58. CNodeWithScopeChildrenList::RemoveChild
  59. Removes a child from the list of children.
  60. This has to be public so that child nodes can ask their parent to be deleted
  61. from the list of children when they receive the MMCN_DELETE notification.
  62. --*/
  63. //////////////////////////////////////////////////////////////////////////////
  64. virtual HRESULT RemoveChild( CChildNode * pChildNode );
  65. //////////////////////////////////////////////////////////////////////////////
  66. /*++
  67. CNodeWithScopeChildrenList::OnShow
  68. Don't override this in your derived class. Instead, override methods
  69. which it calls: InsertColumns
  70. This method is an override of CSnapinNode::OnShow. When MMC passes the
  71. MMCN_SHOW method for this node.
  72. For more information, see CSnapinNode::OnShow.
  73. --*/
  74. //////////////////////////////////////////////////////////////////////////////
  75. virtual HRESULT OnShow(
  76. LPARAM arg
  77. , LPARAM param
  78. , IComponentData * pComponentData
  79. , IComponent * pComponent
  80. , DATA_OBJECT_TYPES type
  81. );
  82. protected:
  83. // Array of pointers to children nodes
  84. CSimpleArray<CChildNode*> m_ScopeChildrenList;
  85. // Flag indicating whether list has been initially populated
  86. BOOL m_bScopeChildrenListPopulated;
  87. /////////////////////////////////////////////////////////////////////////////
  88. /*++
  89. CNodeWithScopeChildrenList::CNodeWithScopeChildrenList
  90. Constructor
  91. This is an base class which we don't want instantiated on its own,
  92. so the contructor is protected
  93. --*/
  94. //////////////////////////////////////////////////////////////////////////////
  95. CNodeWithScopeChildrenList( CSnapInItem * pParentNode );
  96. /////////////////////////////////////////////////////////////////////////////
  97. /*++
  98. CNodeWithScopeChildrenList::~CNodeWithScopeChildrenList
  99. Destructor
  100. --*/
  101. //////////////////////////////////////////////////////////////////////////////
  102. ~CNodeWithScopeChildrenList();
  103. /////////////////////////////////////////////////////////////////////////////
  104. /*++
  105. CNodeWithScopeChildrenList::PopulateScopeChildrenList
  106. Override this in your derived class to populate the list of children nodes.
  107. --*/
  108. //////////////////////////////////////////////////////////////////////////////
  109. virtual HRESULT PopulateScopeChildrenList( void );
  110. // override in your derived class and do something like:
  111. /*
  112. virtual HRESULT PopulateScopeChildrenList( void )
  113. {
  114. CSomeChildNode *myChild1 = new CSomeChildNode();
  115. AddChild(myChild1);
  116. CSomeChildNode *myChild2 = new CSomeChildNode();
  117. AddChild(myChild2);
  118. CSomeChildNode *myChild3 = new CSomeChildNode();
  119. AddChild(myChild3);
  120. return S_OK;
  121. }
  122. */
  123. //////////////////////////////////////////////////////////////////////////////
  124. /*++
  125. CNodeWithScopeChildrenList::InsertColumns
  126. Override this in your derived class.
  127. This method is called by OnShow when it needs you to set the appropriate
  128. column headers to be displayed in the result pane for this node.
  129. --*/
  130. //////////////////////////////////////////////////////////////////////////////
  131. virtual HRESULT InsertColumns( IHeaderCtrl* pHeaderCtrl );
  132. //////////////////////////////////////////////////////////////////////////////
  133. /*++
  134. CNodeWithScopeChildren::OnExpand
  135. Don't override this in your derived class. Instead, override methods
  136. which it calls: PopulateScopeChildrenList
  137. This method is an override of CSnapinNode::OnExpand. When MMC passes the
  138. MMCN_EXPAND method for this node, we are to add children into the
  139. scope pane. In this class we add them from a list we maintain.
  140. For more information, see CSnapinNode::OnExpand.
  141. --*/
  142. //////////////////////////////////////////////////////////////////////////////
  143. virtual HRESULT OnExpand(
  144. LPARAM arg
  145. , LPARAM param
  146. , IComponentData * pComponentData
  147. , IComponent * pComponent
  148. , DATA_OBJECT_TYPES type
  149. );
  150. /////////////////////////////////////////////////////////////////////////////
  151. /*++
  152. CNodeWithScopeChildrenList::EnumerateScopeChildren
  153. Don't override this in your derived class. Instead, override the method
  154. it calls, PopulateScopeChildrenList.
  155. --*/
  156. //////////////////////////////////////////////////////////////////////////////
  157. virtual HRESULT EnumerateScopeChildren( IConsoleNameSpace* pConsoleNameSpace );
  158. };
  159. #endif // _NODE_WITH_SCOPE_CHILDREN_LIST_H_