DialogResize.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #if !defined(AFX_DIALOGRESIZE_H__7902A5BF_2C25_11D6_AB38_00D0B70C3D79__INCLUDED_)
  2. #define AFX_DIALOGRESIZE_H__7902A5BF_2C25_11D6_AB38_00D0B70C3D79__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // dialog resize map macros
  7. #define DECLARE_DLGRESIZE_MAP \
  8. virtual const AfxResizeMap* GetDlgResizeMap();
  9. #define BEGIN_DLGRESIZE_MAP(theClass) \
  10. const theClass::AfxResizeMap* theClass::GetDlgResizeMap() \
  11. { \
  12. static const AfxResizeMap theMap[] = \
  13. {
  14. #define END_DLGRESIZE_MAP() \
  15. { -1, 0 }, \
  16. }; \
  17. return theMap; \
  18. }
  19. #define DLGRESIZE_CONTROL(id, flags) \
  20. { id, flags },
  21. #define BEGIN_DLGRESIZE_GROUP() \
  22. { -1, _DLSZ_BEGIN_GROUP },
  23. #define END_DLGRESIZE_GROUP() \
  24. { -1, _DLSZ_END_GROUP },
  25. class CDialogResize : public CDialog
  26. {
  27. public:
  28. // Data declarations and members
  29. enum
  30. {
  31. DLSZ_SIZE_X = 0x00000001,
  32. DLSZ_SIZE_Y = 0x00000002,
  33. DLSZ_MOVE_X = 0x00000004,
  34. DLSZ_MOVE_Y = 0x00000008,
  35. DLSZ_REPAINT = 0x00000010,
  36. // internal use only
  37. _DLSZ_BEGIN_GROUP = 0x00001000,
  38. _DLSZ_END_GROUP = 0x00002000,
  39. _DLSZ_GRIPPER = 0x00004000
  40. };
  41. struct AfxResizeMap
  42. {
  43. int m_nCtlID;
  44. DWORD m_dwResizeFlags;
  45. };
  46. struct AfxResizeData
  47. {
  48. int m_nCtlID;
  49. DWORD m_dwResizeFlags;
  50. RECT m_rect;
  51. int GetGroupCount() const
  52. {
  53. return (int)LOBYTE(HIWORD(m_dwResizeFlags));
  54. }
  55. void SetGroupCount(int nCount)
  56. {
  57. ASSERT(nCount > 0 && nCount < 256);
  58. DWORD dwCount = (DWORD)MAKELONG(0, MAKEWORD(nCount, 0));
  59. m_dwResizeFlags &= 0xFF00FFFF;
  60. m_dwResizeFlags |= dwCount;
  61. }
  62. BOOL operator==(const AfxResizeData& r) const
  63. {
  64. return (m_nCtlID == r.m_nCtlID && m_dwResizeFlags == r.m_dwResizeFlags);
  65. }
  66. };
  67. CArray<AfxResizeData, AfxResizeData&> m_arrData;
  68. SIZE m_sizeDialog;
  69. POINT m_ptMinTrackSize;
  70. BOOL m_bGripper;
  71. void InitResizing(BOOL bAddGripper = TRUE, BOOL bUseMinTrackSize = TRUE, DWORD dwForceStyle = WS_THICKFRAME | WS_CLIPCHILDREN);
  72. void UpdateLayout(int cxWidth, int cyHeight);
  73. BOOL PositionControl(int cxWidth, int cyHeight, RECT& rectGroup, AfxResizeData& data, bool bGroup, int xyStartNext = -1);
  74. // Construction
  75. public:
  76. CDialogResize(UINT uResourceID, CWnd* pParent = NULL);
  77. CDialogResize(LPCTSTR pszResourceID, CWnd* pParent = NULL);
  78. CDialogResize();
  79. void CommonConstruct();
  80. // Dialog Data
  81. //{{AFX_DATA(CDialogResize)
  82. // NOTE: the ClassWizard will add data members here
  83. //}}AFX_DATA
  84. // Overrides
  85. // ClassWizard generated virtual function overrides
  86. //{{AFX_VIRTUAL(CDialogResize)
  87. protected:
  88. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  89. //}}AFX_VIRTUAL
  90. // Implementation
  91. protected:
  92. CWnd m_wndGripper;
  93. // Generated message map functions
  94. //{{AFX_MSG(CDialogResize)
  95. afx_msg void OnSize(UINT nType, int cx, int cy);
  96. afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
  97. //}}AFX_MSG
  98. DECLARE_MESSAGE_MAP()
  99. DECLARE_DLGRESIZE_MAP;
  100. };
  101. //{{AFX_INSERT_LOCATION}}
  102. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  103. #endif // !defined(AFX_DIALOGRESIZE_H__7902A5BF_2C25_11D6_AB38_00D0B70C3D79__INCLUDED_)