ResizablePageEx.cpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. // ResizablePageEx.cpp : implementation file
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4. //
  5. // Copyright (C) 2000-2001 by Paolo Messina
  6. // (http://www.geocities.com/ppescher - ppescher@yahoo.com)
  7. //
  8. // The contents of this file are subject to the Artistic License (the "License").
  9. // You may not use this file except in compliance with the License.
  10. // You may obtain a copy of the License at:
  11. // http://www.opensource.org/licenses/artistic-license.html
  12. //
  13. // If you find this code useful, credits would be nice!
  14. //
  15. /////////////////////////////////////////////////////////////////////////////
  16. #include "stdafx.h"
  17. #include "ResizablePageEx.h"
  18. #ifdef _DEBUG
  19. #define new DEBUG_NEW
  20. #undef THIS_FILE
  21. static char THIS_FILE[] = __FILE__;
  22. #endif
  23. /////////////////////////////////////////////////////////////////////////////
  24. // CResizablePageEx
  25. IMPLEMENT_DYNCREATE(CResizablePageEx, CPropertyPageEx)
  26. inline void CResizablePageEx::Construct()
  27. {
  28. m_bInitDone = FALSE;
  29. }
  30. CResizablePageEx::CResizablePageEx()
  31. {
  32. Construct();
  33. }
  34. CResizablePageEx::CResizablePageEx(UINT nIDTemplate, UINT nIDCaption, UINT nIDHeaderTitle, UINT nIDHeaderSubTitle)
  35. : CPropertyPageEx(nIDTemplate, nIDCaption, nIDHeaderTitle, nIDHeaderSubTitle)
  36. {
  37. Construct();
  38. }
  39. CResizablePageEx::CResizablePageEx(LPCTSTR lpszTemplateName, UINT nIDCaption, UINT nIDHeaderTitle, UINT nIDHeaderSubTitle)
  40. : CPropertyPageEx(lpszTemplateName, nIDCaption, nIDHeaderTitle, nIDHeaderSubTitle)
  41. {
  42. Construct();
  43. }
  44. CResizablePageEx::~CResizablePageEx()
  45. {
  46. }
  47. BEGIN_MESSAGE_MAP(CResizablePageEx, CPropertyPageEx)
  48. //{{AFX_MSG_MAP(CResizablePageEx)
  49. ON_WM_SIZE()
  50. ON_WM_ERASEBKGND()
  51. //}}AFX_MSG_MAP
  52. END_MESSAGE_MAP()
  53. /////////////////////////////////////////////////////////////////////////////
  54. // CResizablePageEx message handlers
  55. BOOL CResizablePageEx::OnInitDialog()
  56. {
  57. CPropertyPageEx::OnInitDialog();
  58. /* // gets the initial size as the min track size
  59. CRect rc;
  60. GetWindowRect(&rc);
  61. */
  62. m_bInitDone = TRUE;
  63. return TRUE; // return TRUE unless you set the focus to a control
  64. // EXCEPTION: OCX Property Pages should return FALSE
  65. }
  66. void CResizablePageEx::OnSize(UINT nType, int cx, int cy)
  67. {
  68. CWnd::OnSize(nType, cx, cy);
  69. if (m_bInitDone)
  70. ArrangeLayout();
  71. }
  72. BOOL CResizablePageEx::OnEraseBkgnd(CDC* pDC)
  73. {
  74. ClipChildren(pDC);
  75. return CPropertyPageEx::OnEraseBkgnd(pDC);
  76. }
  77. BOOL CResizablePageEx::NeedsRefresh(HWND hWnd)
  78. {
  79. if (m_psp.dwFlags | PSP_HIDEHEADER)
  80. return TRUE;
  81. return CResizableLayout::NeedsRefresh(hWnd);
  82. }