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.

811 lines
22 KiB

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10. #ifndef __AFXDLGS_H__
  11. #define __AFXDLGS_H__
  12. #ifndef __AFXWIN_H__
  13. #include <afxwin.h>
  14. #endif
  15. #ifndef _INC_COMMDLG
  16. #include <commdlg.h> // common dialog APIs
  17. #endif
  18. // Avoid mapping GetFileTitle to GetFileTitle[A/W]
  19. #ifdef GetFileTitle
  20. #undef GetFileTitle
  21. AFX_INLINE short APIENTRY GetFileTitle(LPCTSTR lpszFile, LPTSTR lpszTitle, WORD cbBuf)
  22. #ifdef UNICODE
  23. { return ::GetFileTitleW(lpszFile, lpszTitle, cbBuf); }
  24. #else
  25. { return ::GetFileTitleA(lpszFile, lpszTitle, cbBuf); }
  26. #endif
  27. #endif
  28. #ifndef _AFX_NO_RICHEDIT_SUPPORT
  29. #ifndef _RICHEDIT_
  30. #include <richedit.h>
  31. #endif
  32. #endif
  33. #ifdef _AFX_MINREBUILD
  34. #pragma component(minrebuild, off)
  35. #endif
  36. #ifndef _AFX_FULLTYPEINFO
  37. #pragma component(mintypeinfo, on)
  38. #endif
  39. #ifndef _AFX_NOFORCE_LIBS
  40. /////////////////////////////////////////////////////////////////////////////
  41. // Win32 libraries
  42. #endif //!_AFX_NOFORCE_LIBS
  43. /////////////////////////////////////////////////////////////////////////////
  44. #ifdef _AFX_PACKING
  45. #pragma pack(push, _AFX_PACKING)
  46. #endif
  47. /////////////////////////////////////////////////////////////////////////////
  48. // AFXDLGS - MFC Standard dialogs
  49. // Classes declared in this file
  50. // CDialog
  51. class CCommonDialog; // implementation base class
  52. // modeless dialogs
  53. class CFindReplaceDialog; // Find/FindReplace dialog
  54. // modal dialogs
  55. class CFileDialog; // FileOpen/FileSaveAs dialogs
  56. class CColorDialog; // Color picker dialog
  57. class CFontDialog; // Font chooser dialog
  58. class CPrintDialog; // Print/PrintSetup dialogs
  59. class CPageSetupDialog; // Page Setup dialog
  60. // CWnd
  61. class CPropertySheet; // implements tabbed dialogs
  62. #if _MFC_VER >= 0x0600
  63. class CPropertySheetEx;
  64. #endif
  65. // CDialog
  66. class CPropertyPage; // Used with CPropertySheet for tabbed dialogs
  67. #if _MFC_VER >= 0x0600
  68. class CPropertyPageEx;
  69. #endif
  70. /////////////////////////////////////////////////////////////////////////////
  71. #undef AFX_DATA
  72. #define AFX_DATA AFX_CORE_DATA
  73. /////////////////////////////////////////////////////////////////////////////
  74. // CCommonDialog - base class for all common dialogs
  75. #ifdef _AFXDLL
  76. class CCommonDialog : public CDialog
  77. #else
  78. class AFX_NOVTABLE CCommonDialog : public CDialog
  79. #endif
  80. {
  81. public:
  82. CCommonDialog(CWnd* pParentWnd);
  83. // Implementation
  84. protected:
  85. virtual void OnOK();
  86. virtual void OnCancel();
  87. //{{AFX_MSG(CCommonDialog)
  88. afx_msg BOOL OnHelpInfo(HELPINFO*);
  89. //}}AFX_MSG
  90. DECLARE_MESSAGE_MAP()
  91. };
  92. /////////////////////////////////////////////////////////////////////////////
  93. // CFileDialog - used for FileOpen... or FileSaveAs...
  94. class CFileDialog : public CCommonDialog
  95. {
  96. DECLARE_DYNAMIC(CFileDialog)
  97. public:
  98. // Attributes
  99. OPENFILENAME_NT4 m_ofn; // open file parameter block
  100. // Constructors
  101. CFileDialog(BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs
  102. LPCTSTR lpszDefExt = NULL,
  103. LPCTSTR lpszFileName = NULL,
  104. DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
  105. LPCTSTR lpszFilter = NULL,
  106. CWnd* pParentWnd = NULL);
  107. // Operations
  108. virtual INT_PTR DoModal();
  109. // Helpers for parsing file name after successful return
  110. // or during Overridable callbacks if OFN_EXPLORER is set
  111. CString GetPathName() const; // return full path and filename
  112. CString GetFileName() const; // return only filename
  113. CString GetFileExt() const; // return only ext
  114. CString GetFileTitle() const; // return file title
  115. BOOL GetReadOnlyPref() const; // return TRUE if readonly checked
  116. // Enumerating multiple file selections
  117. POSITION GetStartPosition() const;
  118. CString GetNextPathName(POSITION& pos) const;
  119. // Helpers for custom templates
  120. void SetTemplate(UINT nWin3ID, UINT nWin4ID);
  121. void SetTemplate(LPCTSTR lpWin3ID, LPCTSTR lpWin4ID);
  122. // Other operations available while the dialog is visible
  123. CString GetFolderPath() const; // return full path
  124. void SetControlText(int nID, LPCSTR lpsz);
  125. void HideControl(int nID);
  126. void SetDefExt(LPCSTR lpsz);
  127. // Overridable callbacks
  128. protected:
  129. friend UINT_PTR CALLBACK _AfxCommDlgProc(HWND, UINT, WPARAM, LPARAM);
  130. virtual UINT OnShareViolation(LPCTSTR lpszPathName);
  131. virtual BOOL OnFileNameOK();
  132. virtual void OnLBSelChangedNotify(UINT nIDBox, UINT iCurSel, UINT nCode);
  133. // only called back if OFN_EXPLORER is set
  134. virtual void OnInitDone();
  135. virtual void OnFileNameChange();
  136. virtual void OnFolderChange();
  137. virtual void OnTypeChange();
  138. // Implementation
  139. #ifdef _DEBUG
  140. public:
  141. virtual void Dump(CDumpContext& dc) const;
  142. #endif
  143. protected:
  144. BOOL m_bOpenFileDialog; // TRUE for file open, FALSE for file save
  145. CString m_strFilter; // filter string
  146. // separate fields with '|', terminate with '||\0'
  147. TCHAR m_szFileTitle[64]; // contains file title after return
  148. TCHAR m_szFileName[_MAX_PATH]; // contains full path name after return
  149. OPENFILENAME* m_pofnTemp;
  150. virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  151. };
  152. /////////////////////////////////////////////////////////////////////////////
  153. // CFontDialog - used to select a font
  154. class CFontDialog : public CCommonDialog
  155. {
  156. DECLARE_DYNAMIC(CFontDialog)
  157. public:
  158. // Attributes
  159. // font choosing parameter block
  160. CHOOSEFONT m_cf;
  161. // Constructors
  162. CFontDialog(LPLOGFONT lplfInitial = NULL,
  163. DWORD dwFlags = CF_EFFECTS | CF_SCREENFONTS,
  164. CDC* pdcPrinter = NULL,
  165. CWnd* pParentWnd = NULL);
  166. #ifndef _AFX_NO_RICHEDIT_SUPPORT
  167. CFontDialog(const CHARFORMAT& charformat,
  168. DWORD dwFlags = CF_SCREENFONTS,
  169. CDC* pdcPrinter = NULL,
  170. CWnd* pParentWnd = NULL);
  171. #endif
  172. // Operations
  173. virtual INT_PTR DoModal();
  174. // Get the selected font (works during DoModal displayed or after)
  175. void GetCurrentFont(LPLOGFONT lplf);
  176. // Helpers for parsing information after successful return
  177. CString GetFaceName() const; // return the face name of the font
  178. CString GetStyleName() const; // return the style name of the font
  179. int GetSize() const; // return the pt size of the font
  180. COLORREF GetColor() const; // return the color of the font
  181. int GetWeight() const; // return the chosen font weight
  182. BOOL IsStrikeOut() const; // return TRUE if strikeout
  183. BOOL IsUnderline() const; // return TRUE if underline
  184. BOOL IsBold() const; // return TRUE if bold font
  185. BOOL IsItalic() const; // return TRUE if italic font
  186. #ifndef _AFX_NO_RICHEDIT_SUPPORT
  187. void GetCharFormat(CHARFORMAT& cf) const;
  188. #endif
  189. // Implementation
  190. LOGFONT m_lf; // default LOGFONT to store the info
  191. #ifndef _AFX_NO_RICHEDIT_SUPPORT
  192. DWORD FillInLogFont(const CHARFORMAT& cf);
  193. #endif
  194. #ifdef _DEBUG
  195. public:
  196. virtual void Dump(CDumpContext& dc) const;
  197. #endif
  198. protected:
  199. TCHAR m_szStyleName[64]; // contains style name after return
  200. };
  201. /////////////////////////////////////////////////////////////////////////////
  202. // CColorDialog - used to select a color
  203. class CColorDialog : public CCommonDialog
  204. {
  205. DECLARE_DYNAMIC(CColorDialog)
  206. public:
  207. // Attributes
  208. // color chooser parameter block
  209. CHOOSECOLOR m_cc;
  210. // Constructors
  211. CColorDialog(COLORREF clrInit = 0, DWORD dwFlags = 0,
  212. CWnd* pParentWnd = NULL);
  213. // Operations
  214. virtual INT_PTR DoModal();
  215. // Set the current color while dialog is displayed
  216. void SetCurrentColor(COLORREF clr);
  217. // Helpers for parsing information after successful return
  218. COLORREF GetColor() const;
  219. static COLORREF* PASCAL GetSavedCustomColors();
  220. // Overridable callbacks
  221. protected:
  222. friend UINT_PTR CALLBACK _AfxCommDlgProc(HWND, UINT, WPARAM, LPARAM);
  223. virtual BOOL OnColorOK(); // validate color
  224. // Implementation
  225. #ifdef _DEBUG
  226. public:
  227. virtual void Dump(CDumpContext& dc) const;
  228. #endif
  229. #ifndef _AFX_NO_GRAYDLG_SUPPORT
  230. protected:
  231. //{{AFX_MSG(CColorDialog)
  232. afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
  233. //}}AFX_MSG
  234. DECLARE_MESSAGE_MAP()
  235. #endif //!_AFX_NO_GRAYDLG_SUPPORT
  236. };
  237. // for backward compatibility clrSavedCustom is defined as GetSavedCustomColors
  238. #define clrSavedCustom GetSavedCustomColors()
  239. /////////////////////////////////////////////////////////////////////////////
  240. // Page Setup dialog
  241. class CPageSetupDialog : public CCommonDialog
  242. {
  243. DECLARE_DYNAMIC(CPageSetupDialog)
  244. public:
  245. // Attributes
  246. PAGESETUPDLG m_psd;
  247. // Constructors
  248. CPageSetupDialog(DWORD dwFlags = PSD_MARGINS | PSD_INWININIINTLMEASURE,
  249. CWnd* pParentWnd = NULL);
  250. // Attributes
  251. LPDEVMODE GetDevMode() const; // return DEVMODE
  252. CString GetDriverName() const; // return driver name
  253. CString GetDeviceName() const; // return device name
  254. CString GetPortName() const; // return output port name
  255. HDC CreatePrinterDC();
  256. CSize GetPaperSize() const;
  257. void GetMargins(LPRECT lpRectMargins, LPRECT lpRectMinMargins) const;
  258. // Operations
  259. virtual INT_PTR DoModal();
  260. // Overridables
  261. virtual UINT PreDrawPage(WORD wPaper, WORD wFlags, LPPAGESETUPDLG pPSD);
  262. virtual UINT OnDrawPage(CDC* pDC, UINT nMessage, LPRECT lpRect);
  263. // Implementation
  264. protected:
  265. static UINT CALLBACK PaintHookProc(HWND hWnd, UINT message, WPARAM wParam,
  266. LPARAM lParam);
  267. #ifdef _DEBUG
  268. public:
  269. virtual void Dump(CDumpContext& dc) const;
  270. #endif
  271. };
  272. /////////////////////////////////////////////////////////////////////////////
  273. // CPrintDialog - used for Print... and PrintSetup...
  274. class CPrintDialog : public CCommonDialog
  275. {
  276. DECLARE_DYNAMIC(CPrintDialog)
  277. public:
  278. // Attributes
  279. // print dialog parameter block (note this is a reference)
  280. PRINTDLG& m_pd;
  281. // Constructors
  282. CPrintDialog(BOOL bPrintSetupOnly,
  283. // TRUE for Print Setup, FALSE for Print Dialog
  284. DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS
  285. | PD_HIDEPRINTTOFILE | PD_NOSELECTION,
  286. CWnd* pParentWnd = NULL);
  287. // Operations
  288. virtual INT_PTR DoModal();
  289. // GetDefaults will not display a dialog but will get
  290. // device defaults
  291. BOOL GetDefaults();
  292. // Helpers for parsing information after successful return
  293. int GetCopies() const; // num. copies requested
  294. BOOL PrintCollate() const; // TRUE if collate checked
  295. BOOL PrintSelection() const; // TRUE if printing selection
  296. BOOL PrintAll() const; // TRUE if printing all pages
  297. BOOL PrintRange() const; // TRUE if printing page range
  298. int GetFromPage() const; // starting page if valid
  299. int GetToPage() const; // starting page if valid
  300. LPDEVMODE GetDevMode() const; // return DEVMODE
  301. CString GetDriverName() const; // return driver name
  302. CString GetDeviceName() const; // return device name
  303. CString GetPortName() const; // return output port name
  304. HDC GetPrinterDC() const; // return HDC (caller must delete)
  305. // This helper creates a DC based on the DEVNAMES and DEVMODE structures.
  306. // This DC is returned, but also stored in m_pd.hDC as though it had been
  307. // returned by CommDlg. It is assumed that any previously obtained DC
  308. // has been/will be deleted by the user. This may be
  309. // used without ever invoking the print/print setup dialogs.
  310. HDC CreatePrinterDC();
  311. // Implementation
  312. #ifdef _DEBUG
  313. public:
  314. virtual void Dump(CDumpContext& dc) const;
  315. #endif
  316. private:
  317. PRINTDLG m_pdActual; // the Print/Print Setup need to share this
  318. protected:
  319. // The following handle the case of print setup... from the print dialog
  320. CPrintDialog(PRINTDLG& pdInit);
  321. virtual CPrintDialog* AttachOnSetup();
  322. //{{AFX_MSG(CPrintDialog)
  323. afx_msg void OnPrintSetup();
  324. //}}AFX_MSG
  325. DECLARE_MESSAGE_MAP()
  326. };
  327. /////////////////////////////////////////////////////////////////////////////
  328. // Find/FindReplace modeless dialogs
  329. class CFindReplaceDialog : public CCommonDialog
  330. {
  331. DECLARE_DYNAMIC(CFindReplaceDialog)
  332. public:
  333. // Attributes
  334. FINDREPLACE m_fr;
  335. // Constructors
  336. CFindReplaceDialog();
  337. // Note: you must allocate these on the heap.
  338. // If you do not, you must derive and override PostNcDestroy()
  339. BOOL Create(BOOL bFindDialogOnly, // TRUE for Find, FALSE for FindReplace
  340. LPCTSTR lpszFindWhat,
  341. LPCTSTR lpszReplaceWith = NULL,
  342. DWORD dwFlags = FR_DOWN,
  343. CWnd* pParentWnd = NULL);
  344. // find/replace parameter block
  345. static CFindReplaceDialog* PASCAL GetNotifier(LPARAM lParam);
  346. // Operations
  347. // Helpers for parsing information after successful return
  348. CString GetReplaceString() const;// get replacement string
  349. CString GetFindString() const; // get find string
  350. BOOL SearchDown() const; // TRUE if search down, FALSE is up
  351. BOOL FindNext() const; // TRUE if command is find next
  352. BOOL MatchCase() const; // TRUE if matching case
  353. BOOL MatchWholeWord() const; // TRUE if matching whole words only
  354. BOOL ReplaceCurrent() const; // TRUE if replacing current string
  355. BOOL ReplaceAll() const; // TRUE if replacing all occurrences
  356. BOOL IsTerminating() const; // TRUE if terminating dialog
  357. // Implementation
  358. protected:
  359. virtual void PostNcDestroy();
  360. #ifdef _DEBUG
  361. public:
  362. virtual void Dump(CDumpContext& dc) const;
  363. #endif
  364. protected:
  365. TCHAR m_szFindWhat[128];
  366. TCHAR m_szReplaceWith[128];
  367. };
  368. ////////////////////////////////////////////////////////////////////////////
  369. // CPropertyPage -- one page of a tabbed dialog
  370. // MFC needs to use the original Win95 version of the PROPSHEETPAGE structure.
  371. typedef struct _AFX_OLDPROPSHEETPAGE {
  372. DWORD dwSize;
  373. DWORD dwFlags;
  374. HINSTANCE hInstance;
  375. union {
  376. LPCTSTR pszTemplate;
  377. LPCDLGTEMPLATE pResource;
  378. } DUMMYUNIONNAME;
  379. union {
  380. HICON hIcon;
  381. LPCTSTR pszIcon;
  382. } DUMMYUNIONNAME2;
  383. LPCTSTR pszTitle;
  384. DLGPROC pfnDlgProc;
  385. LPARAM lParam;
  386. LPFNPSPCALLBACK pfnCallback;
  387. UINT FAR * pcRefParent;
  388. } AFX_OLDPROPSHEETPAGE;
  389. // same goes for PROPSHEETHEADER
  390. typedef struct _AFX_OLDPROPSHEETHEADER {
  391. DWORD dwSize;
  392. DWORD dwFlags;
  393. HWND hwndParent;
  394. HINSTANCE hInstance;
  395. union {
  396. HICON hIcon;
  397. LPCTSTR pszIcon;
  398. }DUMMYUNIONNAME;
  399. LPCTSTR pszCaption;
  400. UINT nPages;
  401. union {
  402. UINT nStartPage;
  403. LPCTSTR pStartPage;
  404. }DUMMYUNIONNAME2;
  405. union {
  406. LPCPROPSHEETPAGE ppsp;
  407. HPROPSHEETPAGE FAR *phpage;
  408. }DUMMYUNIONNAME3;
  409. PFNPROPSHEETCALLBACK pfnCallback;
  410. } AFX_OLDPROPSHEETHEADER;
  411. #if _MFC_VER >= 0x0600
  412. AFX_INLINE HPROPSHEETPAGE CreatePropertySheetPage(AFX_OLDPROPSHEETPAGE *psp) {
  413. return CreatePropertySheetPage((PROPSHEETPAGE *)psp);
  414. }
  415. #endif
  416. class CPropertyPage : public CDialog
  417. {
  418. DECLARE_DYNAMIC(CPropertyPage)
  419. // Construction
  420. public:
  421. CPropertyPage();
  422. CPropertyPage(UINT nIDTemplate, UINT nIDCaption = 0);
  423. CPropertyPage(LPCTSTR lpszTemplateName, UINT nIDCaption = 0);
  424. void Construct(UINT nIDTemplate, UINT nIDCaption = 0);
  425. void Construct(LPCTSTR lpszTemplateName, UINT nIDCaption = 0);
  426. // Attributes
  427. #if _MFC_VER >= 0x0600
  428. AFX_OLDPROPSHEETPAGE m_psp;
  429. #else
  430. PROPSHEETPAGE m_psp;
  431. #endif
  432. // Operations
  433. void CancelToClose();
  434. void SetModified(BOOL bChanged = TRUE);
  435. LRESULT QuerySiblings(WPARAM wParam, LPARAM lParam);
  436. // Overridables
  437. public:
  438. virtual BOOL OnApply();
  439. virtual void OnReset();
  440. virtual void OnOK();
  441. virtual void OnCancel();
  442. virtual BOOL OnSetActive();
  443. virtual BOOL OnKillActive();
  444. virtual BOOL OnQueryCancel();
  445. virtual LRESULT OnWizardBack();
  446. virtual LRESULT OnWizardNext();
  447. virtual BOOL OnWizardFinish();
  448. // Implementation
  449. public:
  450. virtual ~CPropertyPage();
  451. #ifdef _DEBUG
  452. virtual void AssertValid() const;
  453. virtual void Dump(CDumpContext& dc) const;
  454. #endif
  455. #if (_MFC_VER >= 0x0600) || defined(_DEBUG)
  456. void EndDialog(int nEndID); // called for error scenarios
  457. #endif
  458. protected:
  459. // private implementation data
  460. CString m_strCaption;
  461. BOOL m_bFirstSetActive;
  462. // implementation helpers
  463. void CommonConstruct(LPCTSTR lpszTemplateName, UINT nIDCaption);
  464. virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  465. virtual BOOL PreTranslateMessage(MSG*);
  466. LRESULT MapWizardResult(LRESULT lToMap);
  467. #if _MFC_VER >= 0x0600
  468. BOOL IsButtonEnabled(int iButton);
  469. #endif
  470. void PreProcessPageTemplate(PROPSHEETPAGE& psp, BOOL bWizard);
  471. #ifndef _AFX_NO_OCC_SUPPORT
  472. void Cleanup();
  473. const DLGTEMPLATE* InitDialogInfo(const DLGTEMPLATE* pTemplate);
  474. #endif
  475. // Generated message map functions
  476. //{{AFX_MSG(CPropertyPage)
  477. afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
  478. //}}AFX_MSG
  479. DECLARE_MESSAGE_MAP()
  480. friend class CPropertySheet;
  481. #if _MFC_VER >= 0x0600
  482. friend class CPropertySheetEx;
  483. #endif
  484. };
  485. #if _MFC_VER >= 0x0600
  486. class CPropertyPageEx : public CPropertyPage
  487. {
  488. DECLARE_DYNAMIC(CPropertyPageEx)
  489. // Construction
  490. public:
  491. CPropertyPageEx();
  492. CPropertyPageEx(UINT nIDTemplate, UINT nIDCaption = 0,
  493. UINT nIDHeaderTitle = 0, UINT nIDHeaderSubTitle = 0);
  494. CPropertyPageEx(LPCTSTR lpszTemplateName, UINT nIDCaption = 0,
  495. UINT nIDHeaderTitle = 0, UINT nIDHeaderSubTitle = 0);
  496. void Construct(UINT nIDTemplate, UINT nIDCaption = 0,
  497. UINT nIDHeaderTitle = 0, UINT nIDHeaderSubTitle = 0);
  498. void Construct(LPCTSTR lpszTemplateName, UINT nIDCaption = 0,
  499. UINT nIDHeaderTitle = 0, UINT nIDHeaderSubTitle = 0);
  500. // Implementation
  501. public:
  502. #ifdef _DEBUG
  503. virtual void AssertValid() const;
  504. virtual void Dump(CDumpContext& dc) const;
  505. #endif
  506. protected:
  507. // private implementation data
  508. CString m_strHeaderTitle; // this is displayed in the header
  509. CString m_strHeaderSubTitle; //
  510. // implementation helpers
  511. void CommonConstruct(LPCTSTR lpszTemplateName, UINT nIDCaption,
  512. UINT nIDHeaderTitle, UINT nIDHeaderSubTitle);
  513. friend class CPropertySheet;
  514. friend class CPropertySheetEx;
  515. };
  516. #endif
  517. ////////////////////////////////////////////////////////////////////////////
  518. // CPropertySheet -- a tabbed "dialog" (really a popup-window)
  519. class CTabCtrl; // forward reference (see afxcmn.h)
  520. class CPropertySheet : public CWnd
  521. {
  522. DECLARE_DYNAMIC(CPropertySheet)
  523. // Construction
  524. public:
  525. CPropertySheet();
  526. CPropertySheet(UINT nIDCaption, CWnd* pParentWnd = NULL,
  527. UINT iSelectPage = 0);
  528. CPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL,
  529. UINT iSelectPage = 0);
  530. void Construct(UINT nIDCaption, CWnd* pParentWnd = NULL,
  531. UINT iSelectPage = 0);
  532. void Construct(LPCTSTR pszCaption, CWnd* pParentWnd = NULL,
  533. UINT iSelectPage = 0);
  534. // for modeless creation
  535. BOOL Create(CWnd* pParentWnd = NULL, DWORD dwStyle = (DWORD)-1,
  536. DWORD dwExStyle = 0);
  537. // the default style, expressed by passing -1 as dwStyle, is actually:
  538. // WS_SYSMENU | WS_POPUP | WS_CAPTION | DS_MODALFRAME | DS_CONTEXT_HELP | WS_VISIBLE
  539. // Attributes
  540. public:
  541. #if _MFC_VER >= 0x0600
  542. AFX_OLDPROPSHEETHEADER m_psh;
  543. #else
  544. PROPSHEETHEADER m_psh;
  545. #endif
  546. int GetPageCount() const;
  547. CPropertyPage* GetActivePage() const;
  548. int GetActiveIndex() const;
  549. CPropertyPage* GetPage(int nPage) const;
  550. int GetPageIndex(CPropertyPage* pPage);
  551. BOOL SetActivePage(int nPage);
  552. BOOL SetActivePage(CPropertyPage* pPage);
  553. void SetTitle(LPCTSTR lpszText, UINT nStyle = 0);
  554. CTabCtrl* GetTabControl() const;
  555. void SetWizardMode();
  556. void SetFinishText(LPCTSTR lpszText);
  557. void SetWizardButtons(DWORD dwFlags);
  558. void EnableStackedTabs(BOOL bStacked);
  559. // Operations
  560. public:
  561. virtual INT_PTR DoModal();
  562. void AddPage(CPropertyPage* pPage);
  563. void RemovePage(CPropertyPage* pPage);
  564. void RemovePage(int nPage);
  565. void EndDialog(int nEndID); // used to terminate a modal dialog
  566. BOOL PressButton(int nButton);
  567. // Implementation
  568. public:
  569. virtual ~CPropertySheet();
  570. #ifdef _DEBUG
  571. virtual void AssertValid() const;
  572. virtual void Dump(CDumpContext& dc) const;
  573. #endif
  574. void CommonConstruct(CWnd* pParentWnd, UINT iSelectPage);
  575. virtual BOOL PreTranslateMessage(MSG* pMsg);
  576. virtual void BuildPropPageArray();
  577. virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
  578. virtual BOOL OnInitDialog();
  579. virtual BOOL ContinueModal();
  580. virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra,
  581. AFX_CMDHANDLERINFO* pHandlerInfo);
  582. #if _MFC_VER >= 0x0600
  583. AFX_OLDPROPSHEETHEADER* GetPropSheetHeader(); // should be virtual, but can't break binary compat yet
  584. BOOL IsWizard() const;
  585. #endif
  586. protected:
  587. CPtrArray m_pages; // array of CPropertyPage pointers
  588. CString m_strCaption; // caption of the pseudo-dialog
  589. CWnd* m_pParentWnd; // parent window of property sheet
  590. BOOL m_bStacked; // EnableStackedTabs sets this
  591. BOOL m_bModeless; // TRUE when Create called instead of DoModal
  592. // Generated message map functions
  593. //{{AFX_MSG(CPropertySheet)
  594. afx_msg BOOL OnNcCreate(LPCREATESTRUCT);
  595. afx_msg LRESULT HandleInitDialog(WPARAM, LPARAM);
  596. afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
  597. afx_msg LRESULT OnCommandHelp(WPARAM, LPARAM);
  598. afx_msg void OnClose();
  599. afx_msg void OnSysCommand(UINT nID, LPARAM);
  600. afx_msg LRESULT OnSetDefID(WPARAM, LPARAM);
  601. //}}AFX_MSG
  602. DECLARE_MESSAGE_MAP()
  603. friend class CPropertyPage;
  604. };
  605. #if _MFC_VER >= 0x0600
  606. ////////////////////////////////////////////////////////////////////////////
  607. // CPropertySheetEx -- a tabbed "dialog" (really a popup-window), extended
  608. // for IE4
  609. class CPropertySheetEx : public CPropertySheet
  610. {
  611. DECLARE_DYNAMIC(CPropertySheetEx)
  612. // Construction
  613. public:
  614. CPropertySheetEx();
  615. CPropertySheetEx(UINT nIDCaption, CWnd* pParentWnd = NULL,
  616. UINT iSelectPage = 0, HBITMAP hbmWatermark = NULL,
  617. HPALETTE hpalWatermark = NULL, HBITMAP hbmHeader = NULL);
  618. CPropertySheetEx(LPCTSTR pszCaption, CWnd* pParentWnd = NULL,
  619. UINT iSelectPage = 0, HBITMAP hbmWatermark = NULL,
  620. HPALETTE hpalWatermark = NULL, HBITMAP hbmHeader = NULL);
  621. void Construct(UINT nIDCaption, CWnd* pParentWnd = NULL,
  622. UINT iSelectPage = 0, HBITMAP hbmWatermark = NULL,
  623. HPALETTE hpalWatermark = NULL, HBITMAP hbmHeader = NULL);
  624. void Construct(LPCTSTR pszCaption, CWnd* pParentWnd = NULL,
  625. UINT iSelectPage = 0, HBITMAP hbmWatermark = NULL,
  626. HPALETTE hpalWatermark = NULL, HBITMAP hbmHeader = NULL);
  627. // Attributes
  628. public:
  629. PROPSHEETHEADER m_psh;
  630. // Operations
  631. public:
  632. void AddPage(CPropertyPageEx* pPage);
  633. // Implementation
  634. public:
  635. virtual ~CPropertySheetEx();
  636. #ifdef _DEBUG
  637. virtual void AssertValid() const;
  638. virtual void Dump(CDumpContext& dc) const;
  639. #endif
  640. void CommonConstruct(CWnd* pParentWnd, UINT iSelectPage,
  641. HBITMAP hbmWatermark, HPALETTE hpalWatermark, HBITMAP hbmHeader);
  642. virtual void BuildPropPageArray();
  643. void SetWizardMode();
  644. friend class CPropertyPage;
  645. friend class CPropertyPageEx;
  646. };
  647. #endif
  648. /////////////////////////////////////////////////////////////////////////////
  649. // Inline function declarations
  650. #ifdef _AFX_PACKING
  651. #pragma pack(pop)
  652. #endif
  653. #ifdef _AFX_ENABLE_INLINES
  654. #define _AFXDLGS_INLINE AFX_INLINE
  655. #include <afxdlgs.inl>
  656. #endif
  657. #undef AFX_DATA
  658. #define AFX_DATA
  659. #ifdef _AFX_MINREBUILD
  660. #pragma component(minrebuild, on)
  661. #endif
  662. #ifndef _AFX_FULLTYPEINFO
  663. #pragma component(mintypeinfo, off)
  664. #endif
  665. #endif //__AFXDLGS_H__
  666. /////////////////////////////////////////////////////////////////////////////