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.

220 lines
5.1 KiB

  1. //
  2. // cmponent.h : Declaration of Component.
  3. //
  4. // This COM object is primarily concerned with
  5. // the result pane items.
  6. //
  7. // Cory West <[email protected]>
  8. // Copyright (c) Microsoft Corporation 1997
  9. //
  10. #ifndef __CMPONENT_H_INCLUDED__
  11. #define __CMPONENT_H_INCLUDED__
  12. #include "stdcmpnt.h" // CComponent
  13. #include "cookie.h" // Cookie
  14. class ComponentData;
  15. class AttributeGeneralPage;
  16. class Component
  17. :
  18. public CComponent,
  19. public IExtendPropertySheet,
  20. public IExtendContextMenu,
  21. public IResultDataCompare
  22. {
  23. public:
  24. friend class AttributeGeneralPage;
  25. Component();
  26. virtual ~Component();
  27. BEGIN_COM_MAP(Component)
  28. COM_INTERFACE_ENTRY(IExtendContextMenu)
  29. COM_INTERFACE_ENTRY(IExtendPropertySheet)
  30. COM_INTERFACE_ENTRY(IResultDataCompare)
  31. COM_INTERFACE_ENTRY_CHAIN(CComponent)
  32. END_COM_MAP()
  33. #if DBG==1
  34. ULONG InternalAddRef( ) {
  35. return CComObjectRoot::InternalAddRef();
  36. }
  37. ULONG InternalRelease( ) {
  38. return CComObjectRoot::InternalRelease();
  39. }
  40. int dbg_InstID;
  41. #endif
  42. inline
  43. Cookie* ActiveCookie( CCookie* pBaseCookie ) {
  44. return ( Cookie*)ActiveBaseCookie( pBaseCookie );
  45. }
  46. //
  47. // Support methods for IComponent.
  48. //
  49. // For Error handling, overide GetResultViewType()
  50. STDMETHOD(GetResultViewType)(MMC_COOKIE cookie, LPOLESTR* ppViewType, long* pViewOptions);
  51. virtual HRESULT ReleaseAll();
  52. virtual HRESULT OnViewChange( LPDATAOBJECT lpDataObject, LPARAM data, LPARAM hint );
  53. virtual HRESULT OnNotifySelect( LPDATAOBJECT lpDataObject, BOOL fSelected );
  54. virtual HRESULT Show( CCookie* pcookie,
  55. LPARAM arg,
  56. HSCOPEITEM hScopeItem);
  57. virtual HRESULT OnNotifyAddImages( LPDATAOBJECT lpDataObject,
  58. LPIMAGELIST lpImageList,
  59. HSCOPEITEM hSelectedItem );
  60. virtual HRESULT OnNotifyDelete(LPDATAOBJECT lpDataObject);
  61. HRESULT PopulateListbox( Cookie* pcookie );
  62. HRESULT EnumerateScopeChildren( Cookie* pParentCookie,
  63. HSCOPEITEM hParent );
  64. HRESULT LoadColumns( Cookie* pcookie );
  65. ComponentData& QueryComponentDataRef( ) {
  66. return ( ComponentData& )QueryBaseComponentDataRef();
  67. }
  68. //
  69. // IExtendPropertySheet
  70. //
  71. STDMETHOD(CreatePropertyPages)( LPPROPERTYSHEETCALLBACK pCall,
  72. LONG_PTR handle,
  73. LPDATAOBJECT pDataObject );
  74. STDMETHOD(QueryPagesFor)( LPDATAOBJECT pDataObject );
  75. //
  76. // IExtendContextMenu
  77. //
  78. STDMETHOD(AddMenuItems)( LPDATAOBJECT piDataObject,
  79. LPCONTEXTMENUCALLBACK piCallback,
  80. long *pInsertionAllowed );
  81. STDMETHOD(Command)( long lCommandID,
  82. LPDATAOBJECT piDataObject );
  83. //
  84. // IResultDataCompare
  85. //
  86. virtual
  87. HRESULT __stdcall
  88. Compare(
  89. LPARAM userParam,
  90. MMC_COOKIE cookieA,
  91. MMC_COOKIE cookieB,
  92. int* result);
  93. //
  94. // Creates result items for the Attributes folder.
  95. //
  96. HRESULT
  97. FastInsertAttributeResultCookies(
  98. Cookie* pParentCookie
  99. );
  100. //
  101. // Creates result items for a particular class.
  102. //
  103. HRESULT
  104. Component::FastInsertClassAttributesResults(
  105. Cookie* pClassCookie
  106. );
  107. HRESULT
  108. Component::RecursiveDisplayClassAttributesResults(
  109. Cookie *pParentCookie,
  110. SchemaObject* pObject,
  111. CStringList& szProcessedList
  112. );
  113. HRESULT
  114. Component::ProcessResultList(
  115. Cookie *pParentCookie,
  116. ListEntry *pList,
  117. BOOLEAN fOptional,
  118. BOOLEAN fSystem,
  119. SchemaObject* pSrcObject
  120. );
  121. virtual HRESULT OnNotifySnapinHelp (LPDATAOBJECT pDataObject);
  122. virtual HRESULT OnNotifyContextHelp (LPDATAOBJECT pDataObject);
  123. private:
  124. HRESULT DeleteAttribute(Cookie* pcookie);
  125. //
  126. // These should use smart pointers.
  127. //
  128. LPCONTROLBAR m_pControlbar;
  129. LPTOOLBAR m_pSvcMgmtToolbar;
  130. LPTOOLBAR m_pSchmMgmtToolbar;
  131. Cookie* m_pViewedCookie;
  132. static const GUID m_ObjectTypeGUIDs[SCHMMGMT_NUMTYPES];
  133. static const BSTR m_ObjectTypeStrings[SCHMMGMT_NUMTYPES];
  134. };
  135. //
  136. // Enumeration for the icons used. The icons are loaded into
  137. // MMC via ComponentData::LoadIcons.
  138. //
  139. enum {
  140. iIconGeneric = 0,
  141. iIconFolder,
  142. iIconClass,
  143. iIconAttribute,
  144. iIconDisplaySpecifier,
  145. iIconLast
  146. };
  147. //
  148. // These enums give us readable names for the column ordinals
  149. // of the columns in various result views.
  150. //
  151. typedef enum _COLNUM_CLASS {
  152. COLNUM_CLASS_NAME=0,
  153. COLNUM_CLASS_TYPE,
  154. COLNUM_CLASS_STATUS,
  155. COLNUM_CLASS_DESCRIPTION
  156. } COLNUM_CLASS;
  157. typedef enum _COLNUM_ATTRIBUTE {
  158. COLNUM_ATTRIBUTE_NAME=0,
  159. COLNUM_ATTRIBUTE_TYPE,
  160. COLNUM_ATTRIBUTE_STATUS,
  161. COLNUM_ATTRIBUTE_SYSTEM,
  162. COLNUM_ATTRIBUTE_DESCRIPTION,
  163. COLNUM_ATTRIBUTE_PARENT
  164. } COLNUM_ATTRIBUTE;
  165. typedef enum _COLNUM_ROOT {
  166. COLNUM_SCHEMA_NAME = 0
  167. } COLNUM_ROOT;
  168. HRESULT LoadIconsIntoImageList(LPIMAGELIST pImageList, BOOL fLoadLargeIcons);
  169. #endif