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.

556 lines
13 KiB

  1. /*++
  2. Copyright (c) 1994-1998 Microsoft Corporation
  3. Module Name :
  4. wizard.h
  5. Abstract:
  6. Enhanced dialog and IIS MMC Wizards definitions
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Project:
  10. Internet Services Manager
  11. Revision History:
  12. --*/
  13. #ifndef __IISUI_WIZARD_H__
  14. #define __IISUI_WIZARD_H__
  15. //
  16. // CIISWizardPage parameters
  17. //
  18. #define HEADER_PAGE (TRUE)
  19. #define WELCOME_PAGE (FALSE)
  20. #define USE_DEFAULT_CAPTION (0)
  21. #if (_WIN32_IE < 0x0400)
  22. //
  23. // Defined in comctrl.h. Defined here because NT 5 MFC42.dll are
  24. // defined with _WIN32_IE 0x300
  25. //
  26. #pragma message("Warning: privately defining _WIN32_IE definitions")
  27. #define PSH_WIZARD97 0x00002000
  28. #define ICC_INTERNET_CLASSES 0x00000800
  29. #define PSP_HIDEHEADER 0x00000800
  30. #define PSP_USEHEADERTITLE 0x00001000
  31. #define PSP_USEHEADERSUBTITLE 0x00002000
  32. #define PSH_WIZARD_LITE 0x00400000
  33. #endif // _WIN32_IE
  34. //
  35. // Using dialog font as a basis, create a new special effects font
  36. //
  37. BOOL COMDLL CreateSpecialDialogFont(
  38. IN CWnd * pdlg, // Source dialog
  39. IN OUT CFont * pfontSpecial, // Font to be used must be allocated already
  40. IN LONG lfOffsetWeight = +300, // Assuming boldification
  41. IN LONG lfOffsetHeight = +0, // Assuming no change in height
  42. IN LONG lfOffsetWidth = +0, // Assuming no change in width (or true type)
  43. IN BOOL fItalic = FALSE, // Do not invert italic state
  44. IN BOOL fUnderline = FALSE // Do not invert underline state
  45. );
  46. //
  47. // Apply fonts to child controls of a dialog
  48. //
  49. void COMDLL ApplyFontToControls(
  50. IN CWnd * pdlg, // Parent dialog
  51. IN CFont * pfont, // Font to be applied
  52. IN UINT nFirst, // First control ID in the series
  53. IN UINT nLast // Last control ID in the series
  54. );
  55. class COMDLL CEmphasizedDialog : public CDialog
  56. /*++
  57. Class Description:
  58. A standard CDialog that allows use of emphasized fonts as follows:
  59. control ID Meaning
  60. --------------------------------------------------------------------------
  61. IDC_ED_BOLD1 Dialog font, bold-faced.
  62. IDC_ED_BOLD2 Dialog font, bold-faced.
  63. IDC_ED_BOLD3 Dialog font, bold-faced.
  64. IDC_ED_BOLD4 Dialog font, bold-faced.
  65. IDC_ED_BOLD5 Dialog font, bold-faced.
  66. Note: others might be added as needed.
  67. Public Interface:
  68. CEmphasizedDialog : Constructor
  69. --*/
  70. {
  71. DECLARE_DYNCREATE(CEmphasizedDialog)
  72. //
  73. // Constructors
  74. //
  75. public:
  76. CEmphasizedDialog(LPCTSTR lpszTemplateName, CWnd * pParentWnd = NULL);
  77. CEmphasizedDialog(UINT nIDTemplate, CWnd * pParentWnd = NULL);
  78. CEmphasizedDialog();
  79. protected:
  80. virtual BOOL OnInitDialog();
  81. afx_msg void OnDestroy();
  82. DECLARE_MESSAGE_MAP()
  83. private:
  84. CFont m_fontBold;
  85. };
  86. class COMDLL CIISWizardSheet : public CPropertySheet
  87. /*++
  88. Class Description:
  89. IIS Wizard sheet base class
  90. Public Interface:
  91. CIISWizardSheet : Constructor
  92. IsWizard97 : TRUE if the wizard is in '97 mode
  93. GetSpecialFont : Get pointer to special font
  94. GetBitmapMemDC : Get memory DC where bitmap resides.
  95. GetBackgroundBrush : Get background brush
  96. QueryBitmapWidth : Get bitmap width
  97. QueryBitmapHeight : Get bitmap height
  98. Notes:
  99. The sheets will be shown in wizard '97 format
  100. if a welcome bitmap ID is specified. In that
  101. case, a header bitmap ID must also be specified.
  102. Additionally, the same control IDs as used in CEmphasizedDialog
  103. above have special meaning.
  104. --*/
  105. {
  106. DECLARE_DYNCREATE(CIISWizardSheet)
  107. //
  108. // Construction
  109. //
  110. public:
  111. //
  112. // Specifying a welcome bitmap make the wizard
  113. // wizard '97, otherwise it's a plain-old wizard
  114. // page.
  115. //
  116. CIISWizardSheet(
  117. IN UINT nWelcomeBitmap = 0,
  118. IN UINT nHeaderBitmap = 0,
  119. IN COLORREF rgbForeColor = RGB(0,0,0), // Black
  120. IN COLORREF rgbBkColor = RGB(255,255,255) // White
  121. );
  122. //
  123. // Access
  124. //
  125. public:
  126. BOOL IsWizard97() const;
  127. CFont * GetSpecialFont(BOOL fHeader);
  128. CFont * GetBoldFont() { return &m_fontTitle; }
  129. CFont * GetBigFont() { return &m_fontWelcome; }
  130. CDC * GetBitmapMemDC(BOOL fHeader);
  131. HBRUSH GetBackgroundBrush() const { return m_brBkgnd; }
  132. CBrush * GetWindowBrush() { return &m_brWindow; }
  133. LONG QueryBitmapWidth(BOOL fHeader) const;
  134. LONG QueryBitmapHeight(BOOL fHeader) const;
  135. COLORREF QueryWindowColor() const { return m_rgbWindow; }
  136. COLORREF QueryWindowTextColor() const { return m_rgbWindowText; }
  137. void EnableButton(int nID, BOOL fEnable = TRUE);
  138. protected:
  139. virtual BOOL OnInitDialog();
  140. virtual void WinHelp(DWORD dwData, UINT nCmd = HELP_CONTEXT);
  141. afx_msg void OnDestroy();
  142. DECLARE_MESSAGE_MAP()
  143. protected:
  144. static const int s_cnBoldDeltaFont;
  145. static const int s_cnBoldDeltaHeight;
  146. static const int s_cnBoldDeltaWidth;
  147. protected:
  148. COLORREF m_rgbWindow;
  149. COLORREF m_rgbWindowText;
  150. private:
  151. CFont m_fontWelcome;
  152. CFont m_fontTitle;
  153. HBRUSH m_brBkgnd;
  154. CBrush m_brWindow;
  155. CBitmap m_bmpWelcome;
  156. CBitmap m_bmpHeader;
  157. BITMAP m_bmWelcomeInfo;
  158. BITMAP m_bmHeaderInfo;
  159. CDC m_dcMemWelcome;
  160. CDC m_dcMemHeader;
  161. HBITMAP m_hbmpOldWelcome;
  162. HBITMAP m_hbmpOldHeader;
  163. };
  164. class COMDLL CIISWizardPage : public CPropertyPage
  165. /*++
  166. Class Description:
  167. IIS Wizard page base class
  168. Public Interface:
  169. CIISWizardPage : Constructor
  170. ValidateString : DDX/DDV Helper
  171. Notes:
  172. If the sheet is constructed with bitmap IDs, the
  173. pages will be displayed in wizard '97 format.
  174. Wizard '97 pages will be displayed in either welcome
  175. page or header page format. The welcome page will
  176. be displayed on a welcome bitmap background, with
  177. the welcome text (IDC_STATIC_WZ_WELCOME) displayed
  178. in large bold. Header pages (ordinary pages), display
  179. IDC_STATIC_WZ_TITLE in bold, and use the header bitmap
  180. at the top of the page.
  181. Special control IDs:
  182. --------------------
  183. IDC_STATIC_WZ_WELCOME - Welcome text displayed in bold
  184. IDC_STATIC_WZ_TITLE - Title text displayed in bold
  185. IDC_STATIC_WZ_SUBTITLE - Subtitle text
  186. --*/
  187. {
  188. DECLARE_DYNCREATE(CIISWizardPage)
  189. //
  190. // Construction
  191. //
  192. public:
  193. CIISWizardPage(
  194. IN UINT nIDTemplate = 0,
  195. IN UINT nIDCaption = USE_DEFAULT_CAPTION,
  196. IN BOOL fHeaderPage = FALSE,
  197. IN UINT nIDHeaderTitle = USE_DEFAULT_CAPTION,
  198. IN UINT nIDSubHeaderTitle = USE_DEFAULT_CAPTION
  199. );
  200. public:
  201. //
  202. // DDX/DDV Helper
  203. //
  204. BOOL ValidateString(
  205. IN CEdit & edit,
  206. OUT CString & str,
  207. IN int nMin,
  208. IN int nMax
  209. );
  210. //
  211. // Interface
  212. //
  213. protected:
  214. virtual BOOL OnInitDialog();
  215. afx_msg HBRUSH OnCtlColor(CDC * pDC, CWnd * pWnd, UINT nCtlColor);
  216. afx_msg BOOL OnEraseBkgnd(CDC * pDC);
  217. DECLARE_MESSAGE_MAP()
  218. //
  219. // Sheet Access
  220. //
  221. protected:
  222. CIISWizardSheet * GetSheet() const;
  223. void SetWizardButtons(DWORD dwFlags);
  224. void EnableSheetButton(int nID, BOOL fEnable = TRUE);
  225. BOOL IsWizard97() const;
  226. BOOL IsHeaderPage() const { return m_fUseHeader; }
  227. CFont * GetSpecialFont();
  228. CFont * GetBoldFont();
  229. CFont * GetBigFont();
  230. CDC * GetBitmapMemDC();
  231. HBRUSH GetBackgroundBrush() const;
  232. CBrush * GetWindowBrush();
  233. LONG QueryBitmapWidth() const;
  234. LONG QueryBitmapHeight() const;
  235. COLORREF QueryWindowColor() const;
  236. COLORREF QueryWindowTextColor() const;
  237. protected:
  238. static const int s_cnHeaderOffset;
  239. private:
  240. BOOL m_fUseHeader; // TRUE to use header
  241. CRect m_rcFillArea; // Fill area
  242. CPoint m_ptOrigin; // Bitmap origin
  243. CString m_strTitle; // Title text
  244. CString m_strSubTitle; // Subtitle text
  245. };
  246. class COMDLL CIISWizardBookEnd : public CIISWizardPage
  247. /*++
  248. Class Description:
  249. Welcome / Completion Page
  250. Public Interface:
  251. CIISWizardBookEnd : Constructor
  252. Notes:
  253. The resource template is not required. If not provided,
  254. a default template will be used.
  255. Special control IDs (on the dialog template):
  256. ---------------------------------------------
  257. IDC_STATIC_WZ_WELCOME - Welcome text displayed in bold
  258. IDC_STATIC_WZ_BODY - Body text will be placed here
  259. IDC_STATIC_WZ_CLICK - Click instructions.
  260. The click instructions default to something sensible, and body text
  261. will default to the error text on a failure page and to nothing on
  262. success and welcome page. The body text may include the %h/%H
  263. escape sequences for CError on a success/failure page.
  264. --*/
  265. {
  266. DECLARE_DYNCREATE(CIISWizardBookEnd)
  267. public:
  268. //
  269. // Constructor for success/failure completion page
  270. //
  271. CIISWizardBookEnd(
  272. IN HRESULT * phResult,
  273. IN UINT nIDWelcomeTxtSuccess ,
  274. IN UINT nIDWelcomeTxtFailure,
  275. IN UINT nIDCaption = USE_DEFAULT_CAPTION,
  276. IN UINT nIDBodyTxtSuccess = USE_DEFAULT_CAPTION,
  277. IN UINT nIDBodyTxtFailure = USE_DEFAULT_CAPTION,
  278. IN UINT nIDClickTxt = USE_DEFAULT_CAPTION,
  279. IN UINT nIDTemplate = 0
  280. );
  281. //
  282. // Constructor for a welcome page
  283. //
  284. CIISWizardBookEnd(
  285. IN UINT nIDWelcomeTxt = 0,
  286. IN UINT nIDCaption = USE_DEFAULT_CAPTION,
  287. IN UINT nIDBodyTxt = USE_DEFAULT_CAPTION,
  288. IN UINT nIDClickTxt = USE_DEFAULT_CAPTION,
  289. IN UINT nIDTemplate = 0
  290. );
  291. //
  292. // Dialog Data
  293. //
  294. protected:
  295. //{{AFX_DATA(CPWWelcome)
  296. enum { IDD = IDD_WIZARD_BOOKEND };
  297. //}}AFX_DATA
  298. //
  299. // Overrides
  300. //
  301. protected:
  302. //{{AFX_VIRTUAL(CIISWizardBookEnd)
  303. public:
  304. virtual BOOL OnSetActive();
  305. //}}AFX_VIRTUAL
  306. //
  307. // Implementation
  308. //
  309. protected:
  310. // Generated message map functions
  311. //{{AFX_MSG(CPWTemplate)
  312. virtual BOOL OnInitDialog();
  313. //}}AFX_MSG
  314. DECLARE_MESSAGE_MAP()
  315. BOOL IsWelcomePage() const { return m_phResult == NULL; }
  316. private:
  317. HRESULT * m_phResult;
  318. CString m_strWelcomeSuccess;
  319. CString m_strWelcomeFailure;
  320. CString m_strBodySuccess;
  321. CString m_strBodyFailure;
  322. CString m_strClick;
  323. };
  324. //
  325. // Inline Expansion
  326. //
  327. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  328. inline CEmphasizedDialog::CEmphasizedDialog(
  329. IN LPCTSTR lpszTemplateName,
  330. IN CWnd * pParentWnd
  331. )
  332. : CDialog(lpszTemplateName, pParentWnd)
  333. {
  334. }
  335. inline CEmphasizedDialog::CEmphasizedDialog(
  336. IN UINT nIDTemplate,
  337. IN CWnd * pParentWnd
  338. )
  339. : CDialog(nIDTemplate, pParentWnd)
  340. {
  341. }
  342. inline CEmphasizedDialog::CEmphasizedDialog()
  343. : CDialog()
  344. {
  345. }
  346. inline BOOL CIISWizardSheet::IsWizard97() const
  347. {
  348. return ((HBITMAP)m_bmpWelcome != NULL);
  349. }
  350. inline CFont * CIISWizardSheet::GetSpecialFont(BOOL fHeader)
  351. {
  352. return fHeader ? &m_fontTitle : &m_fontWelcome;
  353. }
  354. inline CDC * CIISWizardSheet::GetBitmapMemDC(BOOL fHeader)
  355. {
  356. return fHeader ? &m_dcMemHeader : &m_dcMemWelcome;
  357. }
  358. inline LONG CIISWizardSheet::QueryBitmapWidth(BOOL fHeader) const
  359. {
  360. return fHeader ? m_bmHeaderInfo.bmWidth : m_bmWelcomeInfo.bmWidth;
  361. }
  362. inline LONG CIISWizardSheet::QueryBitmapHeight(BOOL fHeader) const
  363. {
  364. return fHeader ? m_bmHeaderInfo.bmHeight : m_bmWelcomeInfo.bmHeight;
  365. }
  366. inline CIISWizardSheet * CIISWizardPage::GetSheet() const
  367. {
  368. return (CIISWizardSheet *)GetParent();
  369. }
  370. inline void CIISWizardPage::SetWizardButtons(DWORD dwFlags)
  371. {
  372. GetSheet()->SetWizardButtons(dwFlags);
  373. }
  374. inline void CIISWizardPage::EnableSheetButton(int nID, BOOL fEnable)
  375. {
  376. GetSheet()->EnableButton(nID, fEnable);
  377. }
  378. inline BOOL CIISWizardPage::IsWizard97() const
  379. {
  380. return GetSheet()->IsWizard97();
  381. }
  382. inline CFont * CIISWizardPage::GetSpecialFont()
  383. {
  384. ASSERT(IsWizard97());
  385. return GetSheet()->GetSpecialFont(m_fUseHeader);
  386. }
  387. inline CFont * CIISWizardPage::GetBoldFont()
  388. {
  389. ASSERT(IsWizard97());
  390. return GetSheet()->GetBoldFont();
  391. }
  392. inline CFont * CIISWizardPage::GetBigFont()
  393. {
  394. ASSERT(IsWizard97());
  395. return GetSheet()->GetBigFont();
  396. }
  397. inline CDC * CIISWizardPage::GetBitmapMemDC()
  398. {
  399. ASSERT(IsWizard97());
  400. return GetSheet()->GetBitmapMemDC(m_fUseHeader);
  401. }
  402. inline LONG CIISWizardPage::QueryBitmapWidth() const
  403. {
  404. ASSERT(IsWizard97());
  405. return GetSheet()->QueryBitmapWidth(m_fUseHeader);
  406. }
  407. inline LONG CIISWizardPage::QueryBitmapHeight() const
  408. {
  409. ASSERT(IsWizard97());
  410. return GetSheet()->QueryBitmapHeight(m_fUseHeader);
  411. }
  412. inline HBRUSH CIISWizardPage::GetBackgroundBrush() const
  413. {
  414. ASSERT(IsWizard97());
  415. return GetSheet()->GetBackgroundBrush();
  416. }
  417. inline CBrush * CIISWizardPage::GetWindowBrush()
  418. {
  419. ASSERT(IsWizard97());
  420. return GetSheet()->GetWindowBrush();
  421. }
  422. inline COLORREF CIISWizardPage::QueryWindowColor() const
  423. {
  424. ASSERT(IsWizard97());
  425. return GetSheet()->QueryWindowColor();
  426. }
  427. inline COLORREF CIISWizardPage::QueryWindowTextColor() const
  428. {
  429. ASSERT(IsWizard97());
  430. return GetSheet()->QueryWindowTextColor();
  431. }
  432. #endif // __IISUI_WIZARD_H__