ResizableSheetEx.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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-2002 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. // support for temporarily hiding the grip
  41. DWORD m_dwGripTempState;
  42. // flags
  43. BOOL m_bEnableSaveRestore;
  44. BOOL m_bRectOnly;
  45. BOOL m_bSavePage;
  46. // layout vars
  47. CSize m_sizePageTL, m_sizePageBR;
  48. // internal status
  49. CString m_sSection; // section name (identifies a parent window)
  50. // Operations
  51. public:
  52. // Overrides
  53. // ClassWizard generated virtual function overrides
  54. //{{AFX_VIRTUAL(CResizableSheetEx)
  55. public:
  56. virtual BOOL OnInitDialog();
  57. protected:
  58. //}}AFX_VIRTUAL
  59. // Implementation
  60. public:
  61. void RefreshLayout();
  62. virtual ~CResizableSheetEx();
  63. // used internally
  64. private:
  65. void PresetLayout();
  66. void PrivateConstruct();
  67. void SavePage();
  68. void LoadPage();
  69. BOOL IsWizard() { return (m_psh.dwFlags & PSH_WIZARD); }
  70. BOOL IsWizard97() { return (m_psh.dwFlags & PSH_WIZARD97); }
  71. // callable from derived classes
  72. protected:
  73. // section to use in app's profile
  74. void EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE,
  75. BOOL bWithPage = FALSE);
  76. int GetMinWidth(); // minimum width to display all buttons
  77. virtual CWnd* GetResizableWnd()
  78. {
  79. // make the layout know its parent window
  80. return this;
  81. };
  82. // Generated message map functions
  83. protected:
  84. virtual BOOL ArrangeLayoutCallback(LayoutInfo& layout);
  85. //{{AFX_MSG(CResizableSheetEx)
  86. afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
  87. afx_msg void OnSize(UINT nType, int cx, int cy);
  88. afx_msg void OnDestroy();
  89. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  90. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  91. //}}AFX_MSG
  92. afx_msg BOOL OnPageChanging(NMHDR* pNotifyStruct, LRESULT* pResult);
  93. DECLARE_MESSAGE_MAP()
  94. };
  95. /////////////////////////////////////////////////////////////////////////////
  96. #endif // AFX_RESIZABLESHEETEX_H__INCLUDED_