ResizableSheetEx.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. // 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. // ResizableSheetEx.h : header file
  26. //
  27. class CResizableSheetEx : public CPropertySheetEx, public CResizableLayout,
  28. public CResizableGrip, public CResizableMinMax,
  29. public CResizableSheetState
  30. {
  31. DECLARE_DYNAMIC(CResizableSheetEx)
  32. // Construction
  33. public:
  34. CResizableSheetEx();
  35. CResizableSheetEx(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0,
  36. HBITMAP hbmWatermark = NULL, HPALETTE hpalWatermark = NULL, HBITMAP hbmHeader = NULL);
  37. CResizableSheetEx(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0,
  38. HBITMAP hbmWatermark = NULL, HPALETTE hpalWatermark = NULL, HBITMAP hbmHeader = NULL);
  39. // Attributes
  40. private:
  41. // support for temporarily hiding the grip
  42. DWORD m_dwGripTempState;
  43. // flags
  44. BOOL m_bEnableSaveRestore;
  45. BOOL m_bRectOnly;
  46. BOOL m_bSavePage;
  47. // layout vars
  48. UINT m_nCallbackID;
  49. CSize m_sizePageTL, m_sizePageBR;
  50. BOOL m_bLayoutDone;
  51. // internal status
  52. CString m_sSection; // section name (identifies a parent window)
  53. // Operations
  54. public:
  55. enum
  56. {
  57. PSH_IE4WIZARD97 = 0x00002000,
  58. PSH_IE5WIZARD97 = 0x01000000,
  59. };
  60. // Overrides
  61. // ClassWizard generated virtual function overrides
  62. //{{AFX_VIRTUAL(CResizableSheetEx)
  63. public:
  64. virtual BOOL OnInitDialog();
  65. protected:
  66. virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  67. //}}AFX_VIRTUAL
  68. // Implementation
  69. public:
  70. virtual ~CResizableSheetEx();
  71. // used internally
  72. private:
  73. void PrivateConstruct();
  74. BOOL IsWizard() const;
  75. BOOL IsWizard97() const;
  76. // callable from derived classes
  77. protected:
  78. void RefreshLayout();
  79. void PresetLayout();
  80. // section to use in app's profile
  81. void EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE,
  82. BOOL bWithPage = FALSE);
  83. int GetMinWidth(); // minimum width to display all buttons
  84. virtual CWnd* GetResizableWnd() const
  85. {
  86. // make the layout know its parent window
  87. return CWnd::FromHandle(m_hWnd);
  88. };
  89. // Generated message map functions
  90. protected:
  91. void GetHeaderRect(LPRECT lpRect);
  92. virtual BOOL CalcSizeExtra(HWND hWndChild, CSize sizeChild, CSize& sizeExtra);
  93. virtual BOOL ArrangeLayoutCallback(LAYOUTINFO& layout) const;
  94. //{{AFX_MSG(CResizableSheetEx)
  95. afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
  96. afx_msg void OnSize(UINT nType, int cx, int cy);
  97. afx_msg void OnDestroy();
  98. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  99. afx_msg BOOL OnNcCreate(LPCREATESTRUCT lpCreateStruct);
  100. //}}AFX_MSG
  101. afx_msg BOOL OnPageChanging(NMHDR* pNotifyStruct, LRESULT* pResult);
  102. afx_msg LRESULT OnResizeSupport(WPARAM wParam, LPARAM lParam);
  103. DECLARE_MESSAGE_MAP()
  104. };
  105. /////////////////////////////////////////////////////////////////////////////
  106. #endif // AFX_RESIZABLESHEETEX_H__INCLUDED_