ResizableSheet.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #if !defined(AFX_RESIZABLESHEET_H__INCLUDED_)
  2. #define AFX_RESIZABLESHEET_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. // ResizableSheet.h : header file
  25. //
  26. class CResizableSheet : public CPropertySheet, public CResizableLayout,
  27. public CResizableGrip, public CResizableMinMax,
  28. public CResizableState
  29. {
  30. DECLARE_DYNAMIC(CResizableSheet)
  31. // Construction
  32. public:
  33. CResizableSheet();
  34. CResizableSheet(UINT nIDCaption, CWnd *pParentWnd = NULL, UINT iSelectPage = 0);
  35. CResizableSheet(LPCTSTR pszCaption, CWnd *pParentWnd = NULL, UINT iSelectPage = 0);
  36. // Attributes
  37. private:
  38. // flags
  39. BOOL m_bEnableSaveRestore;
  40. BOOL m_bRectOnly;
  41. BOOL m_bSavePage;
  42. // layout vars
  43. CSize m_sizePageTL, m_sizePageBR;
  44. // internal status
  45. CString m_sSection; // section name (identifies a parent window)
  46. BOOL m_bInitDone; // if all internal vars initialized
  47. // Operations
  48. public:
  49. // Overrides
  50. // ClassWizard generated virtual function overrides
  51. //{{AFX_VIRTUAL(CResizableSheet)
  52. public:
  53. virtual BOOL OnInitDialog();
  54. //}}AFX_VIRTUAL
  55. protected:
  56. // Implementation
  57. public:
  58. virtual ~CResizableSheet();
  59. // used internally
  60. private:
  61. void PresetLayout();
  62. void Construct();
  63. void SavePage();
  64. void LoadPage();
  65. BOOL IsWizard() { return (m_psh.dwFlags & PSH_WIZARD); }
  66. // callable from derived classes
  67. protected:
  68. // section to use in app's profile
  69. void EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE,
  70. BOOL bWithPage = FALSE);
  71. int GetMinWidth(); // minimum width to display all buttons
  72. virtual CWnd* GetResizableWnd()
  73. {
  74. // make the layout know its parent window
  75. return this;
  76. };
  77. // Generated message map functions
  78. protected:
  79. virtual BOOL ArrangeLayoutCallback(LayoutInfo& layout);
  80. //{{AFX_MSG(CResizableSheet)
  81. afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
  82. afx_msg void OnSize(UINT nType, int cx, int cy);
  83. afx_msg void OnDestroy();
  84. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  85. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  86. //}}AFX_MSG
  87. afx_msg BOOL OnPageChanging(NMHDR* pNotifyStruct, LRESULT* pResult);
  88. DECLARE_MESSAGE_MAP()
  89. };
  90. /////////////////////////////////////////////////////////////////////////////
  91. #endif // AFX_RESIZABLESHEET_H__INCLUDED_