home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 21 / IOPROG_21.ISO / SOFT / PROPVIEW.ZIP / DevStudio / MyProjects / MdLessPpsh / ChildFrm.cpp next >
Encoding:
C/C++ Source or Header  |  1998-05-21  |  2.4 KB  |  116 lines

  1. // ChildFrm.cpp : implementation of the CChildFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "MdLessPpsh.h"
  6.  
  7. #include "Pg1.h"
  8. #include "Pg2.h"
  9. #include "ModelessPpsh.h"
  10. #include "ChildFrm.h"
  11.  
  12. #ifdef _DEBUG
  13. #define new DEBUG_NEW
  14. #undef THIS_FILE
  15. static char THIS_FILE[] = __FILE__;
  16. #endif
  17.  
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CChildFrame
  20.  
  21. IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
  22.  
  23. BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
  24.     //{{AFX_MSG_MAP(CChildFrame)
  25.     ON_COMMAND(ID_VIEW_PPSH, OnViewPpsh)
  26.     ON_WM_SIZE()
  27.     //}}AFX_MSG_MAP
  28. END_MESSAGE_MAP()
  29.  
  30. /////////////////////////////////////////////////////////////////////////////
  31. // CChildFrame construction/destruction
  32.  
  33. CChildFrame::CChildFrame()
  34. {
  35.     // TODO: add member initialization code here
  36.     
  37. }
  38.  
  39. CChildFrame::~CChildFrame()
  40. {
  41.     delete m_pPg1;
  42.     delete m_pPg2;
  43. }
  44.  
  45. BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
  46. {
  47.     // TODO: Modify the Window class or styles here by modifying
  48.     //  the CREATESTRUCT cs
  49.  
  50.     return CMDIChildWnd::PreCreateWindow(cs);
  51. }
  52.  
  53. /////////////////////////////////////////////////////////////////////////////
  54. // CChildFrame diagnostics
  55.  
  56. #ifdef _DEBUG
  57. void CChildFrame::AssertValid() const
  58. {
  59.     CMDIChildWnd::AssertValid();
  60. }
  61.  
  62. void CChildFrame::Dump(CDumpContext& dc) const
  63. {
  64.     CMDIChildWnd::Dump(dc);
  65. }
  66.  
  67. #endif //_DEBUG
  68.  
  69. /////////////////////////////////////////////////////////////////////////////
  70. // CChildFrame message handlers
  71.  
  72. void CChildFrame::OnViewPpsh() 
  73. {
  74.     CModelessPpsh Ppsh;
  75.     CPg1 pPg1;
  76.     CPg2 pPg2;
  77.  
  78.     
  79.     Ppsh.AddPage(&pPg1);
  80.     Ppsh.AddPage(&pPg2);
  81.     Ppsh.DoModal();
  82.  
  83. }
  84.  
  85. BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
  86. {
  87.     // do not call base class!
  88.     //return CMDIChildWnd::OnCreateClient(lpcs, pContext);
  89.     m_pPg1 = new CPg1();
  90.     m_pPg2 = new CPg2();
  91.     
  92.     m_Ppsh.AddPage(m_pPg1);
  93.     m_Ppsh.AddPage(m_pPg2);
  94.     
  95.     m_Ppsh.Create(this, WS_CHILD);
  96.     m_Ppsh.ShowWindow(SW_SHOW);
  97.     
  98.     CRect clientRect;
  99.  
  100.     return TRUE;     
  101. }
  102.  
  103. void CChildFrame::OnSize(UINT nType, int cx, int cy) 
  104. {
  105.     CMDIChildWnd::OnSize(nType, cx, cy);
  106.     if(m_Ppsh.m_hWnd == 0)
  107.         return;
  108.     
  109.     //this will change only the size of property sheet.
  110.     //you will have to add code to resize property pages.
  111.     //use m_Ppsh.GetTabControl()->MoveWindow to do it
  112.     CRect clientRect;
  113.     GetClientRect(clientRect);
  114.     m_Ppsh.MoveWindow(clientRect);
  115. }
  116.