afxdlgs.h 23 KB

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