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.

360 lines
11 KiB

  1. //____________________________________________________________________________
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1999
  5. //
  6. // File: MMCData.h
  7. //
  8. // Contents:
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 2/27/1997 RaviR Created
  15. //____________________________________________________________________________
  16. //
  17. #ifndef __MMCDATA__H__
  18. #define __MMCDATA__H__
  19. #include "ndmgr.h"
  20. #include "mmcptrs.h"
  21. class CToolBarCtrlEx;
  22. class CMultiSelection;
  23. class CConsoleFrame;
  24. class CConsoleView;
  25. class CConsoleStatusBar;
  26. class CMenuButtonsMgr;
  27. class CAMCViewToolbarsMgr;
  28. class CNode;
  29. class CXMLObject;
  30. class CStdVerbButtons;
  31. class CConsoleDocument;
  32. //////////////////////////////////////////////////////////////////////////////
  33. //
  34. // SConsoleData structure.
  35. //
  36. enum ProgramMode
  37. {
  38. eMode_Author,
  39. eMode_User,
  40. eMode_User_MDI,
  41. eMode_User_SDI,
  42. eMode_Count,
  43. eMode_First = eMode_Author,
  44. eMode_Last = eMode_User_SDI,
  45. eMode_Error = -1
  46. };
  47. enum ConsoleFlags
  48. {
  49. eFlag_ShowStatusBar = 0x00000001,
  50. eFlag_HelpDocInvalid = 0x00000002,
  51. eFlag_LogicalReadOnly = 0x00000004,
  52. eFlag_PreventViewCustomization = 0x00000008,
  53. // DO NOT USE 0x00000010 - an obsolete flag that was used in MMC1.2 to disallow context menus on taskpads.
  54. eFlag_Default = eFlag_ShowStatusBar,
  55. eFlag_All = 0x0000000f,
  56. };
  57. // The current MMC version: 2.0
  58. #define MMC_VERSION_MAJOR 2
  59. #define MMC_VERSION_MINOR 0
  60. #define MakeConsoleFileVer(major_ver,minor_ver) \
  61. MakeConsoleFileVer_(major_ver, minor_ver, 0)
  62. #define MakeConsoleFileVer_(major_ver,minor_ver,minor_subver) \
  63. ((DWORD)(((DWORD)(BYTE)(major_ver)<<16)|((WORD)(BYTE)(minor_ver)<<8)|(BYTE)(minor_subver)))
  64. #define GetConsoleFileMajorVersion(eFileVer) ((BYTE)((eFileVer)>>16))
  65. #define GetConsoleFileMinorVersion(eFileVer) ((BYTE)(((WORD)(eFileVer)) >> 8))
  66. #define GetConsoleFileMinorSubversion(eFileVer) ((BYTE)(eFileVer))
  67. enum ConsoleFileVersion
  68. {
  69. FileVer_0100 = MakeConsoleFileVer (1, 0), // MMC v1.0
  70. FileVer_0110 = MakeConsoleFileVer (1, 1), // MMC v1.1
  71. FileVer_0120 = MakeConsoleFileVer (1, 2), // MMC v1.2
  72. FileVer_0200 = MakeConsoleFileVer (2, 0), // MMC v2.0
  73. FileVer_Current = FileVer_0200,
  74. FileVer_Invalid = -1,
  75. };
  76. inline bool IsValidProgramMode (ProgramMode eMode)
  77. {
  78. return ((eMode >= eMode_First) && (eMode <= eMode_Last));
  79. }
  80. inline bool IsValidFileVersion (ConsoleFileVersion eFileVer)
  81. {
  82. return ((eFileVer == FileVer_0100) ||
  83. (eFileVer == FileVer_0110) ||
  84. (eFileVer == FileVer_0120) ||
  85. (eFileVer == FileVer_0200));
  86. }
  87. inline bool IsCurrentFileVersion (ConsoleFileVersion eFileVer)
  88. {
  89. return (eFileVer == FileVer_Current);
  90. }
  91. #define NAVLIST_LEVELS 2
  92. struct SConsoleData
  93. {
  94. SConsoleData()
  95. :
  96. m_hwndMainFrame (NULL),
  97. m_pConsoleFrame (NULL),
  98. m_eAppMode (eMode_Author),
  99. m_eConsoleMode (eMode_Author),
  100. m_dwFlags (eFlag_Default),
  101. m_eFileVer (FileVer_Invalid),
  102. m_pXMLPersistColumnData(NULL),
  103. m_pConsoleDocument(NULL)
  104. {
  105. }
  106. ProgramMode GetMode() const
  107. {
  108. return (m_eAppMode);
  109. }
  110. ProgramMode GetConsoleMode() const
  111. {
  112. return (m_eConsoleMode);
  113. }
  114. ConsoleFileVersion GetFileVersion() const
  115. {
  116. return (m_eFileVer);
  117. }
  118. CConsoleFrame* GetConsoleFrame() const
  119. {
  120. return (m_pConsoleFrame);
  121. }
  122. void SetScopeTree (IScopeTree* pScopeTree)
  123. {
  124. // hook this console data to the scope tree
  125. m_spScopeTree = pScopeTree;
  126. // hook the scope tree to this console data
  127. m_spScopeTree->SetConsoleData (reinterpret_cast<LPARAM>(this));
  128. }
  129. IScopeTreePtr m_spScopeTree;
  130. HWND m_hwndMainFrame;
  131. CConsoleFrame* m_pConsoleFrame;
  132. ProgramMode m_eAppMode;
  133. ProgramMode m_eConsoleMode;
  134. ConsoleFileVersion m_eFileVer;
  135. DWORD m_dwFlags;
  136. // Console's column data
  137. IPersistStreamPtr m_spPersistStreamColumnData;
  138. CXMLObject* m_pXMLPersistColumnData;
  139. // access to document from node manager side
  140. CConsoleDocument* m_pConsoleDocument;
  141. }; // struct SConsoleData
  142. //////////////////////////////////////////////////////////////////////////////
  143. //
  144. // SViewData structure.
  145. //
  146. const DWORD STD_MENUS = 0x00000001;
  147. const DWORD STD_BUTTONS = 0x00000002;
  148. const DWORD SNAPIN_MENUS = 0x00000004;
  149. const DWORD SNAPIN_BUTTONS = 0x00000008;
  150. const DWORD STATUS_BAR = 0x80000000;
  151. // The status bar isn't really a "toolbar" per se, but it's visibility
  152. // status is stored with the rest of these bits so we don't have to change
  153. // the view data stream format to accomodate it.
  154. const DWORD ALL_TOOLBARS = 0x0000000f;
  155. inline DWORD ToolbarsOf (DWORD dwToolbars)
  156. { return (dwToolbars & ALL_TOOLBARS); }
  157. inline DWORD StatusBarOf (DWORD dwToolbars)
  158. { return (dwToolbars & STATUS_BAR); }
  159. struct SViewData
  160. {
  161. friend class CAMCView;
  162. private:
  163. enum eFlag
  164. {
  165. eFlag_ScopePaneVisible = 0x00000001, // Scope pane visible
  166. eFlag_DescBarVisible = 0x00000008,
  167. eFlag_VirtualList = 0x00000010,
  168. eFlag_TaskpadTabsAllowed = 0x00000040,
  169. // default for new views
  170. eFlag_Default = eFlag_ScopePaneVisible |
  171. eFlag_TaskpadTabsAllowed
  172. };
  173. public:
  174. SViewData() :
  175. m_dwFlags (eFlag_Default),
  176. m_pStatusBar (NULL),
  177. m_pConsoleView (NULL),
  178. m_pConsoleData (NULL),
  179. m_nViewID (0),
  180. m_hwndView (NULL),
  181. m_hwndChildFrame (NULL),
  182. m_hwndListCtrl (NULL),
  183. m_lWindowOptions (0),
  184. m_pMultiSelection (NULL),
  185. m_dwToolbarsDisplayed (ALL_TOOLBARS | STATUS_BAR), // enable all
  186. m_bSnapinChangingView (FALSE),
  187. m_pMenuButtonsMgr (NULL),
  188. m_pAMCViewToolbarsMgr (NULL),
  189. m_pStdVerbButtons (NULL)
  190. {
  191. }
  192. private:
  193. DWORD m_dwFlags; // manipulate with accessors
  194. void SetFlag (eFlag flag, bool fSet)
  195. {
  196. if (fSet)
  197. m_dwFlags |= flag;
  198. else
  199. m_dwFlags &= ~flag;
  200. }
  201. bool TestFlag (eFlag flag) const
  202. {
  203. return ((m_dwFlags & flag) ? true : false);
  204. }
  205. public:
  206. void SetScopePaneVisible (bool b = true) { SetFlag (eFlag_ScopePaneVisible, b); }
  207. void SetDescBarVisible (bool b = true) { SetFlag (eFlag_DescBarVisible, b); }
  208. void SetVirtualList (bool b = true) { SetFlag (eFlag_VirtualList, b); }
  209. void SetTaskpadTabsAllowed (bool b = true) { SetFlag (eFlag_TaskpadTabsAllowed, b); }
  210. public:
  211. bool IsScopePaneVisible () const { return (TestFlag (eFlag_ScopePaneVisible)); }
  212. bool IsDescBarVisible () const { return (TestFlag (eFlag_DescBarVisible)); }
  213. bool IsVirtualList () const { return (TestFlag (eFlag_VirtualList) & HasList()); }
  214. bool HasList () const { return m_rvt.HasList(); }
  215. bool HasOCX () const { return m_rvt.HasOCX(); }
  216. bool HasWebBrowser () const { return m_rvt.HasWebBrowser(); }
  217. bool HasListPad () const { return (HasWebBrowser() && (NULL != m_hwndListCtrl)); }
  218. bool AreTaskpadTabsAllowed () const { return (TestFlag (eFlag_TaskpadTabsAllowed)); }
  219. DWORD GetListOptions() const { return m_rvt.GetListOptions();}
  220. DWORD GetHTMLOptions() const { return m_rvt.GetHTMLOptions();}
  221. DWORD GetOCXOptions() const { return m_rvt.GetOCXOptions();}
  222. DWORD GetMiscOptions() const { return m_rvt.GetMiscOptions();}
  223. LPCOLESTR GetURL() const { return m_rvt.GetURL();}
  224. LPCOLESTR GetOCX() const { return m_rvt.GetOCX();}
  225. void SetResultViewType(CResultViewType &rvt) { m_rvt = rvt;}
  226. CConsoleStatusBar* GetStatusBar() const { return (m_pStatusBar); }
  227. CConsoleView* GetConsoleView() const { return (m_pConsoleView); }
  228. void SetStatusBar (CConsoleStatusBar* pStatusBar)
  229. { m_pStatusBar = pStatusBar; }
  230. void SetConsoleView (CConsoleView* pConsoleView)
  231. { m_pConsoleView = pConsoleView; }
  232. CMenuButtonsMgr* GetMenuButtonsMgr() const { return (m_pMenuButtonsMgr); }
  233. void SetMenuButtonsMgr (CMenuButtonsMgr* pMenuButtonsMgr) { m_pMenuButtonsMgr = pMenuButtonsMgr; }
  234. CAMCViewToolbarsMgr* GetAMCViewToolbarsMgr() const { return (m_pAMCViewToolbarsMgr); }
  235. void SetAMCViewToolbarsMgr (CAMCViewToolbarsMgr* pAMCViewToolbarsMgr) { m_pAMCViewToolbarsMgr = pAMCViewToolbarsMgr; }
  236. CStdVerbButtons* GetStdVerbButtons() const { return (m_pStdVerbButtons); }
  237. void SetStdVerbButtons (CStdVerbButtons* pStdVerbButtons) { m_pStdVerbButtons = pStdVerbButtons; }
  238. private:
  239. CConsoleStatusBar* m_pStatusBar;
  240. CConsoleView* m_pConsoleView;
  241. CMenuButtonsMgr* m_pMenuButtonsMgr;
  242. CAMCViewToolbarsMgr* m_pAMCViewToolbarsMgr;
  243. CStdVerbButtons* m_pStdVerbButtons;
  244. public:
  245. SConsoleData* m_pConsoleData;
  246. int m_nViewID;
  247. HWND m_hwndView;
  248. HWND m_hwndChildFrame;
  249. HWND m_hwndListCtrl;
  250. long m_lWindowOptions;
  251. IFramePrivatePtr m_spNodeManager;
  252. IResultDataPrivatePtr m_spResultData;
  253. IImageListPrivatePtr m_spRsltImageList;
  254. IConsoleVerbPtr m_spVerbSet;
  255. INodeCallbackPtr m_spNodeCallback;
  256. IControlbarsCachePtr m_spControlbarsCache;
  257. ITaskCallbackPtr m_spTaskCallback;
  258. CMultiSelection* m_pMultiSelection;
  259. DWORD m_dwToolbarsDisplayed;
  260. // Is snapin changing the view now.
  261. BOOL m_bSnapinChangingView;
  262. bool IsStandardMenusAllowed()
  263. {
  264. return (m_dwToolbarsDisplayed & STD_MENUS);
  265. }
  266. bool IsSnapinMenusAllowed()
  267. {
  268. return (m_dwToolbarsDisplayed & SNAPIN_MENUS);
  269. }
  270. protected:
  271. CResultViewType m_rvt;
  272. };
  273. #include <pshpack8.h> // for Win64
  274. struct CreateNewViewStruct
  275. {
  276. MTNODEID idRootNode; // in: ID of the root node of the view
  277. long lWindowOptions; // in: window creation options, MMC_NW_OPTION_*
  278. bool fVisible; // in: is the window visible?
  279. SViewData* pViewData; // out: view data for the new view
  280. HNODE hRootNode; // out: root node of the new view
  281. };
  282. #include <poppack.h>
  283. #endif // __MMCDATA__H__