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.

172 lines
5.9 KiB

  1. /*++
  2. 1998 Seagate Software, Inc. All rights reserved.
  3. Module Name:
  4. CSakSnap.h
  5. Abstract:
  6. Implementation of IComponent for Snapin.
  7. Author:
  8. Rohde Wakefield [rohde] 12-Aug-1997
  9. Revision History:
  10. --*/
  11. #ifndef CSAKSNAP_H
  12. #define CSAKSNAP_H
  13. #define RS_RESULT_IMAGE_ARRAY_MAX 100
  14. typedef struct {
  15. GUID nodeTypeId;
  16. USHORT colCount;
  17. USHORT columnWidths[BHSM_MAX_CHILD_PROPS];
  18. } COLUMN_WIDTH_SET;
  19. class CSakData;
  20. /////////////////////////////////////////////////////////////////////////////
  21. // COM class representing the SakSnap snapin object
  22. class ATL_NO_VTABLE CSakSnap :
  23. public IComponent, // interface that console calls into
  24. public IExtendPropertySheet,// add pages to the property sheet of an item.
  25. public IExtendContextMenu, // add items to context menu of an item
  26. public IExtendControlbar, // add items to control bar of an item
  27. public IResultDataCompare, // So we can custom sort
  28. public IPersistStream,
  29. public CComObjectRoot, // handle object reference counts for objects
  30. public CComCoClass<CSakSnap,&CLSID_HsmAdmin>
  31. {
  32. public:
  33. CSakSnap( ) {};
  34. BEGIN_COM_MAP(CSakSnap)
  35. COM_INTERFACE_ENTRY(IComponent)
  36. COM_INTERFACE_ENTRY(IExtendPropertySheet)
  37. COM_INTERFACE_ENTRY(IExtendContextMenu)
  38. COM_INTERFACE_ENTRY(IExtendControlbar)
  39. COM_INTERFACE_ENTRY(IPersistStream)
  40. COM_INTERFACE_ENTRY(IResultDataCompare)
  41. END_COM_MAP()
  42. DECLARE_REGISTRY_RESOURCEID(IDR_HsmAdmin)
  43. // IComponent interface members
  44. public:
  45. STDMETHOD( Initialize ) ( IConsole* pConsole);
  46. STDMETHOD( Notify ) ( IDataObject* pDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param );
  47. STDMETHOD( Destroy ) ( MMC_COOKIE cookie );
  48. STDMETHOD( GetResultViewType )(MMC_COOKIE cookie, BSTR* ppViewType, long * pViewOptions );
  49. STDMETHOD( QueryDataObject ) ( MMC_COOKIE cookie, DATA_OBJECT_TYPES type, IDataObject** ppDataObject );
  50. STDMETHOD( GetDisplayInfo ) ( LPRESULTDATAITEM pScopeItem );
  51. STDMETHOD( CompareObjects ) ( IDataObject* pDataObjectA, IDataObject* pDataObjectB );
  52. // IExtendPropertySheet interface
  53. public:
  54. STDMETHOD( CreatePropertyPages )( LPPROPERTYSHEETCALLBACK lpProvider, RS_NOTIFY_HANDLE handle, LPDATAOBJECT lpIDataObject );
  55. STDMETHOD( QueryPagesFor ) ( LPDATAOBJECT lpDataObject );
  56. // IExtendContextMenu
  57. public:
  58. STDMETHOD( AddMenuItems ) ( IDataObject* pDataObject, LPCONTEXTMENUCALLBACK pCallbackUnknown, LONG* pInsertionAllowed );
  59. STDMETHOD( Command ) ( long nCommandID, IDataObject* pDataObject );
  60. // IExtendControlbar
  61. STDMETHOD( SetControlbar ) ( LPCONTROLBAR pControlbar );
  62. STDMETHOD( ControlbarNotify )( MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param );
  63. // IResultDataCompare
  64. STDMETHOD( Compare ) ( IN LPARAM lUserParam, IN MMC_COOKIE CookieA, IN MMC_COOKIE CookieB, IN OUT int* pnResult );
  65. // IPersistStream methods
  66. STDMETHOD( Save )( IStream *pStm, BOOL fClearDirty );
  67. STDMETHOD( Load )( IStream *pStm );
  68. STDMETHOD( IsDirty )(void);
  69. STDMETHOD( GetSizeMax )( ULARGE_INTEGER *pcbSize );
  70. STDMETHOD( GetClassID )( CLSID *pClassID );
  71. public:
  72. // Notify event handlers
  73. protected:
  74. HRESULT OnFolder (IDataObject * pNode, LPARAM arg, LPARAM param);
  75. HRESULT OnShow (IDataObject * pNode, LPARAM arg, LPARAM param);
  76. HRESULT OnSelect (IDataObject * pNode, LPARAM arg, LPARAM param);
  77. HRESULT OnMinimize (IDataObject * pNode, LPARAM arg, LPARAM param);
  78. HRESULT OnChange (IDataObject * pNode, LPARAM arg, LPARAM param);
  79. HRESULT OnRefresh (IDataObject * pNode, LPARAM arg, LPARAM param);
  80. HRESULT OnDelete (IDataObject * pNode, LPARAM arg, LPARAM param);
  81. // Toolbar event handler
  82. void CSakSnap::OnSelectToolbars(LPARAM arg, LPARAM param);
  83. // Pseudo Constructor / Destructor
  84. public:
  85. HRESULT FinalConstruct();
  86. void FinalRelease();
  87. // Methods to work with the image lists
  88. private:
  89. // Given an HICON, return "virtual index" from result pane's image list
  90. CComPtr<IImageList> m_pImageResult; // SakSnap interface pointer to result pane image list
  91. HRESULT OnAddImages();
  92. HRESULT OnToolbarButtonClick(LPARAM arg, LPARAM param);
  93. protected:
  94. // Enumerate the children of a node in result pane.
  95. HRESULT EnumResultPane( ISakNode* pNode );
  96. // functions to initialize headers in result view
  97. HRESULT InitResultPaneHeaders( ISakNode* pNode );
  98. // function to clear all icons of the node's children
  99. HRESULT ClearResultIcons( ISakNode* pNode );
  100. // Interface pointers
  101. protected:
  102. friend class CSakData;
  103. CComPtr<IConsole> m_pConsole; // Console's IFrame interface
  104. CComPtr<IResultData> m_pResultData;
  105. CComPtr<IHeaderCtrl> m_pHeader; // Result pane's header control interface
  106. CComPtr<IControlbar> m_pControlbar; // control bar to hold my tool bars
  107. CComPtr<IConsoleVerb> m_pConsoleVerb;
  108. CComPtr<IToolbar> m_pToolbar; // Toolbar for view
  109. CSakData * m_pSakData; // Pointer to owning SakData
  110. private:
  111. CComPtr<ISakNode> m_pEnumeratedNode;
  112. MMC_COOKIE m_ActiveNodeCookie; // ISakNode of active node in scope pane
  113. HRESULT ClearResultPane();
  114. HRESULT EnumRootDisplayProps( IEnumString ** ppEnum );
  115. // Contains column widths for a given node type COLUMN_WIDTH_SET
  116. COLUMN_WIDTH_SET m_ChildPropWidths[ BHSM_MAX_NODE_TYPES ];
  117. USHORT m_cChildPropWidths;
  118. HRESULT GetSavedColumnWidths( ISakNode *pNode, INT *pColCount, INT *pColumnWidths );
  119. HRESULT SaveColumnWidths( ISakNode *pNode );
  120. // Image Array
  121. public:
  122. static UINT m_nImageArray[RS_RESULT_IMAGE_ARRAY_MAX];
  123. static INT m_nImageCount;
  124. // Static functions
  125. public:
  126. static INT AddImage( UINT rId );
  127. };
  128. #endif