ResizablePageEx.cpp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // ResizablePageEx.cpp : implementation file
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4. //
  5. // Copyright (C) 2000-2002 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. #define _WIN32_IE 0x0400 // for CPropertyPageEx, CPropertySheetEx
  17. #define _WIN32_WINNT 0x0500 // for CPropertyPageEx, CPropertySheetEx
  18. #include <afxwin.h> // MFC core and standard components
  19. #include <afxext.h> // MFC extensions
  20. #include <afxcmn.h> // MFC support for Windows Common Controls
  21. #include "ResizablePageEx.h"
  22. #ifdef _DEBUG
  23. #define new DEBUG_NEW
  24. #undef THIS_FILE
  25. static char THIS_FILE[] = __FILE__;
  26. #endif
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CResizablePageEx
  29. IMPLEMENT_DYNCREATE(CResizablePageEx, CPropertyPageEx)
  30. CResizablePageEx::CResizablePageEx()
  31. {
  32. }
  33. CResizablePageEx::CResizablePageEx(UINT nIDTemplate, UINT nIDCaption, UINT nIDHeaderTitle, UINT nIDHeaderSubTitle)
  34. : CPropertyPageEx(nIDTemplate, nIDCaption, nIDHeaderTitle, nIDHeaderSubTitle)
  35. {
  36. }
  37. CResizablePageEx::CResizablePageEx(LPCTSTR lpszTemplateName, UINT nIDCaption, UINT nIDHeaderTitle, UINT nIDHeaderSubTitle)
  38. : CPropertyPageEx(lpszTemplateName, nIDCaption, nIDHeaderTitle, nIDHeaderSubTitle)
  39. {
  40. }
  41. CResizablePageEx::~CResizablePageEx()
  42. {
  43. }
  44. BEGIN_MESSAGE_MAP(CResizablePageEx, CPropertyPageEx)
  45. //{{AFX_MSG_MAP(CResizablePageEx)
  46. ON_WM_SIZE()
  47. ON_WM_ERASEBKGND()
  48. //}}AFX_MSG_MAP
  49. END_MESSAGE_MAP()
  50. /////////////////////////////////////////////////////////////////////////////
  51. // CResizablePageEx message handlers
  52. void CResizablePageEx::OnSize(UINT nType, int cx, int cy)
  53. {
  54. CWnd::OnSize(nType, cx, cy);
  55. ArrangeLayout();
  56. }
  57. BOOL CResizablePageEx::OnEraseBkgnd(CDC* pDC)
  58. {
  59. // Windows XP doesn't like clipping regions ...try this!
  60. EraseBackground(pDC);
  61. return TRUE;
  62. /* ClipChildren(pDC); // old-method (for safety)
  63. return CPropertyPageEx::OnEraseBkgnd(pDC);
  64. */
  65. }
  66. BOOL CResizablePageEx::NeedsRefresh(const CResizableLayout::LayoutInfo& layout,
  67. const CRect& rectOld, const CRect& rectNew)
  68. {
  69. if (m_psp.dwFlags | PSP_HIDEHEADER)
  70. return TRUE;
  71. return CResizableLayout::NeedsRefresh(layout, rectOld, rectNew);
  72. }