home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / general / propdlg / propsht2.cpp < prev    next >
C/C++ Source or Header  |  1998-03-26  |  2KB  |  62 lines

  1. // shapesht.cpp : implementation of the CModelessShapePropSheet class
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1998 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "stdafx.h"
  14. #include "propdlg.h"
  15. #include "resource.h"
  16. #include "shapeobj.h"
  17. #include "colorpge.h"
  18. #include "stylepge.h"
  19. #include "propsht2.h"
  20.  
  21. IMPLEMENT_DYNAMIC(CModelessShapePropSheet, CPropertySheet)
  22.  
  23. BEGIN_MESSAGE_MAP(CModelessShapePropSheet, CPropertySheet)
  24.     //{{AFX_MSG_MAP(CModelessShapePropSheet)
  25.     //}}AFX_MSG_MAP
  26. END_MESSAGE_MAP()
  27.  
  28. CModelessShapePropSheet::CModelessShapePropSheet(CWnd* pWndParent)
  29.     : CPropertySheet(AFX_IDS_APP_TITLE, pWndParent)
  30. {
  31.     AddPage(&m_stylePage);
  32.     AddPage(&m_colorPage);
  33. }
  34.  
  35. void CModelessShapePropSheet::PostNcDestroy()
  36. {
  37.     CPropertySheet::PostNcDestroy();
  38.     delete this;
  39. }
  40.  
  41. void CModelessShapePropSheet::SetSheetPropsFromShape(CShape* pShape)
  42. {
  43.     m_stylePage.m_nShapeStyle = pShape->m_shapestyle;
  44.     m_stylePage.SetModified(FALSE);
  45.  
  46.     m_colorPage.m_nColor = pShape->m_shapecolor;
  47.     m_colorPage.SetModified(FALSE);
  48.  
  49.     // Reflect the new shape properties in the controls of the
  50.     // currently active property page.
  51.     GetActivePage()->UpdateData(FALSE);
  52. }
  53.  
  54. void CModelessShapePropSheet::SetShapePropsFromSheet(CShape* pShape)
  55. {
  56.     pShape->m_shapecolor = m_colorPage.m_nColor;
  57.     pShape->m_shapestyle = (SHAPE_STYLE)m_stylePage.m_nShapeStyle;
  58.  
  59.     m_colorPage.SetModified(FALSE);
  60.     m_stylePage.SetModified(FALSE);
  61. }
  62.