ResizableSheetEx.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #if !defined(AFX_RESIZABLESHEETEX_H__INCLUDED_)
  2. #define AFX_RESIZABLESHEETEX_H__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. /////////////////////////////////////////////////////////////////////////////
  7. //
  8. // Copyright (C) 2000-2001 by Paolo Messina
  9. // (http://www.geocities.com/ppescher - ppescher@yahoo.com)
  10. //
  11. // The contents of this file are subject to the Artistic License (the "License").
  12. // You may not use this file except in compliance with the License.
  13. // You may obtain a copy of the License at:
  14. // http://www.opensource.org/licenses/artistic-license.html
  15. //
  16. // If you find this code useful, credits would be nice!
  17. //
  18. /////////////////////////////////////////////////////////////////////////////
  19. #include "ResizableLayout.h"
  20. #include "ResizableGrip.h"
  21. #include "ResizableMinMax.h"
  22. #include "ResizableState.h"
  23. /////////////////////////////////////////////////////////////////////////////
  24. // ResizableSheetEx.h : header file
  25. //
  26. class CResizableSheetEx : public CPropertySheetEx, public CResizableLayout,
  27. public CResizableGrip, public CResizableMinMax,
  28. public CResizableState
  29. {
  30. DECLARE_DYNAMIC(CResizableSheetEx)
  31. // Construction
  32. public:
  33. CResizableSheetEx();
  34. CResizableSheetEx(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0,
  35. HBITMAP hbmWatermark = NULL, HPALETTE hpalWatermark = NULL, HBITMAP hbmHeader = NULL);
  36. CResizableSheetEx(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0,
  37. HBITMAP hbmWatermark = NULL, HPALETTE hpalWatermark = NULL, HBITMAP hbmHeader = NULL);
  38. // Attributes
  39. private:
  40. // flags
  41. BOOL m_bEnableSaveRestore;
  42. BOOL m_bRectOnly;
  43. BOOL m_bSavePage;
  44. // layout vars
  45. CSize m_sizePageTL, m_sizePageBR;
  46. // internal status
  47. CString m_sSection; // section name (identifies a parent window)
  48. BOOL m_bInitDone; // if all internal vars initialized
  49. // Operations
  50. public:
  51. // Overrides
  52. // ClassWizard generated virtual function overrides
  53. //{{AFX_VIRTUAL(CResizableSheetEx)
  54. public:
  55. virtual BOOL OnInitDialog();
  56. protected:
  57. //}}AFX_VIRTUAL
  58. // Implementation
  59. public:
  60. virtual ~CResizableSheetEx();
  61. // used internally
  62. private:
  63. void PresetLayout();
  64. void Construct();
  65. void SavePage();
  66. void LoadPage();
  67. BOOL IsWizard() { return (m_psh.dwFlags & PSH_WIZARD); }
  68. BOOL IsWizard97() { return (m_psh.dwFlags & PSH_WIZARD97); }
  69. // callable from derived classes
  70. protected:
  71. // section to use in app's profile
  72. void EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE,
  73. BOOL bWithPage = FALSE);
  74. int GetMinWidth(); // minimum width to display all buttons
  75. virtual CWnd* GetResizableWnd()
  76. {
  77. // make the layout know its parent window
  78. return this;
  79. };
  80. // Generated message map functions
  81. protected:
  82. virtual BOOL ArrangeLayoutCallback(LayoutInfo& layout);
  83. //{{AFX_MSG(CResizableSheetEx)
  84. afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
  85. afx_msg void OnSize(UINT nType, int cx, int cy);
  86. afx_msg void OnDestroy();
  87. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  88. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  89. //}}AFX_MSG
  90. afx_msg BOOL OnPageChanging(NMHDR* pNotifyStruct, LRESULT* pResult);
  91. DECLARE_MESSAGE_MAP()
  92. };
  93. /////////////////////////////////////////////////////////////////////////////
  94. #endif // AFX_RESIZABLESHEETEX_H__INCLUDED_