ResizableFormView.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #if !defined(AFX_RESIZABLEFORMVIEW_H__INCLUDED_)
  2. #define AFX_RESIZABLEFORMVIEW_H__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // ResizableFormView.h : header file
  7. //
  8. /////////////////////////////////////////////////////////////////////////////
  9. //
  10. // This file is part of ResizableLib
  11. // https://github.com/ppescher/resizablelib
  12. //
  13. // Copyright (C) 2000-2015 by Paolo Messina
  14. // mailto:ppescher@hotmail.com
  15. //
  16. // The contents of this file are subject to the Artistic License 2.0
  17. // http://opensource.org/licenses/Artistic-2.0
  18. //
  19. // If you find this code useful, credits would be nice!
  20. //
  21. /////////////////////////////////////////////////////////////////////////////
  22. #include "ResizableLayout.h"
  23. #include "ResizableGrip.h"
  24. #include "ResizableMinMax.h"
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CResizableFormView form view
  27. #include <afxext.h>
  28. class CResizableFormView : public CFormView, public CResizableLayout,
  29. public CResizableGrip, public CResizableMinMax
  30. {
  31. DECLARE_DYNAMIC(CResizableFormView)
  32. // Construction
  33. protected: // must derive your own class
  34. CResizableFormView(UINT nIDTemplate);
  35. CResizableFormView(LPCTSTR lpszTemplateName);
  36. virtual ~CResizableFormView();
  37. private:
  38. void PrivateConstruct();
  39. // support for temporarily hiding the grip
  40. DWORD m_dwGripTempState;
  41. enum GripHideReason // bitmask
  42. {
  43. GHR_MAXIMIZED = 0x01,
  44. GHR_SCROLLBAR = 0x02,
  45. GHR_ALIGNMENT = 0x04,
  46. };
  47. // called from base class
  48. protected:
  49. virtual void GetTotalClientRect(LPRECT lpRect) const;
  50. virtual CWnd* GetResizableWnd() const
  51. {
  52. // make the layout know its parent window
  53. return CWnd::FromHandle(m_hWnd);
  54. };
  55. // Attributes
  56. public:
  57. // Operations
  58. public:
  59. // Overrides
  60. public:
  61. // ClassWizard generated virtual function overrides
  62. //{{AFX_VIRTUAL(CResizableFormView)
  63. protected:
  64. virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  65. //}}AFX_VIRTUAL
  66. // Implementation
  67. protected:
  68. #ifdef _DEBUG
  69. virtual void AssertValid() const;
  70. virtual void Dump(CDumpContext& dc) const;
  71. #endif
  72. // Generated message map functions
  73. //{{AFX_MSG(CResizableFormView)
  74. afx_msg void OnSize(UINT nType, int cx, int cy);
  75. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  76. afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
  77. afx_msg void OnDestroy();
  78. virtual BOOL OnInitDialog();
  79. afx_msg BOOL OnNcCreate(LPCREATESTRUCT lpCreateStruct);
  80. //}}AFX_MSG
  81. DECLARE_MESSAGE_MAP()
  82. };
  83. /////////////////////////////////////////////////////////////////////////////
  84. //{{AFX_INSERT_LOCATION}}
  85. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  86. #endif // !defined(AFX_RESIZABLEFORMVIEW_H__INCLUDED_)