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.

173 lines
5.5 KiB

  1. #ifndef __COMPONET_H_
  2. #define __COMPONET_H_
  3. /*++
  4. Copyright (C) Microsoft Corporation
  5. Module Name:
  6. componet.h
  7. Abstract:
  8. header file defines CComponent class
  9. Author:
  10. William Hsieh (williamh) created
  11. Revision History:
  12. --*/
  13. class CComponent :
  14. public IComponent,
  15. public IResultDataCompare,
  16. public IExtendContextMenu,
  17. public IExtendControlbar,
  18. public IExtendPropertySheet,
  19. public IPersistStream,
  20. public ISnapinCallback {
  21. public:
  22. CComponent(CComponentData* pComponentData);
  23. ~CComponent();
  24. //
  25. // IUNKNOWN
  26. //
  27. STDMETHOD_(ULONG, AddRef)();
  28. STDMETHOD_(ULONG, Release)();
  29. STDMETHOD(QueryInterface)(REFIID riid, void** ppv);
  30. public:
  31. //
  32. // IComponent interface members
  33. //
  34. STDMETHOD(Initialize)(LPCONSOLE pConsole);
  35. STDMETHOD(Notify)(LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, MMC_COOKIE param);
  36. STDMETHOD(Destroy)(MMC_COOKIE cookie);
  37. STDMETHOD(GetResultViewType)(MMC_COOKIE cookie, LPOLESTR* ppViewType, long* pViewOptions);
  38. STDMETHOD(QueryDataObject)(MMC_COOKIE cookie, DATA_OBJECT_TYPES type,
  39. LPDATAOBJECT* ppDataObject);
  40. STDMETHOD(GetDisplayInfo)(RESULTDATAITEM* pResultDataItem);
  41. STDMETHOD(CompareObjects)(LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB);
  42. //
  43. // IResultDataCompare interface member
  44. //
  45. STDMETHOD(Compare)(LPARAM lUserParam, MMC_COOKIE cookieA, MMC_COOKIE cookieB, int* pnResult);
  46. //
  47. // IExtendContextMenu
  48. //
  49. STDMETHOD(AddMenuItems)(LPDATAOBJECT pDataObject,
  50. LPCONTEXTMENUCALLBACK pCallbackUnknown,
  51. long* pInsertionAllowed
  52. );
  53. STDMETHOD(Command)(long nCommandID, LPDATAOBJECT pDataObject);
  54. //
  55. // IExtendControlbar
  56. //
  57. STDMETHOD(SetControlbar)(LPCONTROLBAR pControlbar);
  58. STDMETHOD(ControlbarNotify)(MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param);
  59. //
  60. // IExtendPropertySheet
  61. //
  62. STDMETHOD(CreatePropertyPages)(LPPROPERTYSHEETCALLBACK lpProvider, LONG_PTR handle, LPDATAOBJECT lpDataObject);
  63. STDMETHOD(QueryPagesFor)(LPDATAOBJECT lpDataObject);
  64. //
  65. // IPersistStream
  66. //
  67. STDMETHOD(GetClassID)(CLSID* pClassId);
  68. STDMETHOD(IsDirty)();
  69. STDMETHOD(Load)(IStream* pStm);
  70. STDMETHOD(Save)(IStream* pStm, BOOL fClearDirty);
  71. STDMETHOD(GetSizeMax)(ULARGE_INTEGER *pcbSize);
  72. //
  73. // ISnapinCallback
  74. //
  75. STDMETHOD(tvNotify)(HWND hwndTV, MMC_COOKIE cookie, TV_NOTIFY_CODE Code, LPARAM arg, LPARAM param);
  76. protected:
  77. HRESULT OnShow(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  78. HRESULT OnMinimize(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  79. HRESULT OnResultItemClick(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  80. HRESULT OnResultItemDblClick(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  81. HRESULT OnProperties(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  82. HRESULT OnViewChange(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  83. HRESULT OnBtnClick(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  84. HRESULT OnSelect(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  85. HRESULT OnActivate(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  86. HRESULT OnAddImages(MMC_COOKIE cookie, IImageList* pIImageList, HSCOPEITEM hScopeItem);
  87. HRESULT OnOcxNotify(MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param);
  88. HRESULT OnRestoreView(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  89. HRESULT OnContextHelp(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  90. //
  91. // Helper functions
  92. //
  93. HRESULT DoPropertySheet(MMC_COOKIE cookie);
  94. public:
  95. void SetDirty()
  96. {
  97. m_Dirty = TRUE;
  98. }
  99. HRESULT UpdateToolbar(CCookie* pCookie);
  100. HRESULT CreateFolderList(CCookie* pCookie);
  101. CScopeItem* FindScopeItem(MMC_COOKIE cookie)
  102. {
  103. return m_pComponentData->FindScopeItem(cookie);
  104. }
  105. CCookie* GetActiveCookie(MMC_COOKIE cookie)
  106. {
  107. return m_pComponentData->GetActiveCookie(cookie);
  108. }
  109. CMachine* GetMachine()
  110. {
  111. return m_pComponentData->m_pMachine;
  112. }
  113. LPCTSTR GetStartupDeviceId()
  114. {
  115. return m_pComponentData->m_strStartupDeviceId;
  116. }
  117. LPCTSTR GetStartupCommand()
  118. {
  119. return m_pComponentData->m_strStartupCommand;
  120. }
  121. HRESULT LoadScopeIconsForResultPane(IImageList* pIImageList);
  122. int MessageBox(LPCTSTR Msg, LPCTSTR Caption, DWORD Flags);
  123. BOOL AttachFolderToMachine(CFolder* pFolder, CMachine** ppMachine);
  124. LPCONSOLE m_pConsole; // Console's Interface
  125. LPHEADERCTRL m_pHeader; // Result pane's header control interface
  126. LPRESULTDATA m_pResult; // Interface pointer to the result pane
  127. LPCONSOLEVERB m_pConsoleVerb;
  128. LPPROPERTYSHEETPROVIDER m_pPropSheetProvider;
  129. LPDISPLAYHELP m_pDisplayHelp;
  130. LPTOOLBAR m_pToolbar; // Toolbar for view
  131. LPCONTROLBAR m_pControlbar; // Control bar to hold toolbar
  132. private:
  133. CFolder* FindFolder(MMC_COOKIE cookie);
  134. BOOL DestroyFolderList(MMC_COOKIE cookie);
  135. HRESULT SaveFolderPersistData(CFolder* pFolder, IStream* pStm, BOOL fClearDirty);
  136. HRESULT LoadFolderPersistData(CFolder* pFolder, IStream* pStm);
  137. void DetachAllFoldersFromMachine();
  138. CComponentData* m_pComponentData;
  139. CFolder* m_pCurFolder;
  140. CList<CFolder*, CFolder*> m_listFolder;
  141. BOOL m_Dirty;
  142. LONG m_Ref;
  143. };
  144. #endif // __COMPONET_H_