ResizableSheet.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. // This file is part of ResizableLib
  9. // https://github.com/ppescher/resizablelib
  10. //
  11. // Copyright (C) 2000-2015 by Paolo Messina
  12. // mailto:ppescher@hotmail.com
  13. //
  14. // The contents of this file are subject to the Artistic License 2.0
  15. // http://opensource.org/licenses/Artistic-2.0
  16. //
  17. // If you find this code useful, credits would be nice!
  18. //
  19. /////////////////////////////////////////////////////////////////////////////
  20. #include "ResizableLayout.h"
  21. #include "ResizableGrip.h"
  22. #include "ResizableMinMax.h"
  23. #include "ResizableSheetState.h"
  24. /////////////////////////////////////////////////////////////////////////////
  25. // ResizableSheet.h : header file
  26. //
  27. class CResizableSheet : public CPropertySheet, public CResizableLayout,
  28. public CResizableGrip, public CResizableMinMax,
  29. public CResizableSheetState
  30. {
  31. DECLARE_DYNAMIC(CResizableSheet)
  32. // Construction
  33. public:
  34. CResizableSheet();
  35. CResizableSheet(UINT nIDCaption, CWnd *pParentWnd = NULL, UINT iSelectPage = 0);
  36. CResizableSheet(LPCTSTR pszCaption, CWnd *pParentWnd = NULL, UINT iSelectPage = 0);
  37. // Attributes
  38. private:
  39. // support for temporarily hiding the grip
  40. DWORD m_dwGripTempState;
  41. // flags
  42. BOOL m_bEnableSaveRestore;
  43. BOOL m_bRectOnly;
  44. BOOL m_bSavePage;
  45. // layout vars
  46. UINT m_nCallbackID;
  47. CSize m_sizePageTL, m_sizePageBR;
  48. BOOL m_bLayoutDone;
  49. // internal status
  50. CString m_sSection; // section name (identifies a parent window)
  51. // Operations
  52. public:
  53. // Overrides
  54. // ClassWizard generated virtual function overrides
  55. //{{AFX_VIRTUAL(CResizableSheet)
  56. public:
  57. virtual BOOL OnInitDialog();
  58. protected:
  59. virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  60. //}}AFX_VIRTUAL
  61. protected:
  62. // Implementation
  63. public:
  64. virtual ~CResizableSheet();
  65. // used internally
  66. private:
  67. void PrivateConstruct();
  68. BOOL IsWizard() const;
  69. // callable from derived classes
  70. protected:
  71. void PresetLayout();
  72. void RefreshLayout();
  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() const
  78. {
  79. // make the layout know its parent window
  80. return CWnd::FromHandle(m_hWnd);
  81. };
  82. // Generated message map functions
  83. protected:
  84. virtual BOOL CalcSizeExtra(HWND hWndChild, CSize sizeChild, CSize& sizeExtra);
  85. virtual BOOL ArrangeLayoutCallback(LAYOUTINFO& layout) const;
  86. //{{AFX_MSG(CResizableSheet)
  87. afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
  88. afx_msg void OnSize(UINT nType, int cx, int cy);
  89. afx_msg void OnDestroy();
  90. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  91. afx_msg BOOL OnNcCreate(LPCREATESTRUCT lpCreateStruct);
  92. //}}AFX_MSG
  93. afx_msg BOOL OnPageChanging(NMHDR* pNotifyStruct, LRESULT* pResult);
  94. DECLARE_MESSAGE_MAP()
  95. };
  96. /////////////////////////////////////////////////////////////////////////////
  97. #endif // AFX_RESIZABLESHEET_H__INCLUDED_