dc640dbf8559782cb5e57ea0e7bd2f9456ab82dc
[occt.git] / samples / mfc / standard / 01_Geometry / src / ChildFrm.cpp
1 // ChildFrm.cpp : implementation of the CChildFrame class
2 //
3
4 #include "stdafx.h"
5 #include "GeometryApp.h"
6
7 #include "ChildFrm.h"
8
9 /////////////////////////////////////////////////////////////////////////////
10 // CChildFrame
11
12 IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
13
14 BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
15         //{{AFX_MSG_MAP(CChildFrame)
16         ON_WM_CREATE()
17         //}}AFX_MSG_MAP
18 END_MESSAGE_MAP()
19
20 /////////////////////////////////////////////////////////////////////////////
21 // CChildFrame construction/destruction
22
23 CChildFrame::CChildFrame()
24 {
25         // TODO: add member initialization code here
26         
27 }
28
29 CChildFrame::~CChildFrame()
30 {
31 }
32
33 /////////////////////////////////////////////////////////////////////////////
34 // CChildFrame diagnostics
35
36 #ifdef _DEBUG
37 void CChildFrame::AssertValid() const
38 {
39         CMDIChildWnd::AssertValid();
40 }
41
42 void CChildFrame::Dump(CDumpContext& dc) const
43 {
44         CMDIChildWnd::Dump(dc);
45 }
46
47 #endif //_DEBUG
48
49 void CChildFrame::ActivateFrame(int nCmdShow) 
50 {
51         // TODO: Add your specialized code here and/or call the base class
52         
53         static BOOL first=true;
54         if(first){
55                 first=false;
56                 CMDIChildWnd::ActivateFrame(SW_SHOWMAXIMIZED);
57                 return;
58         }
59 /*
60         POSITION pos=AfxGetApp()->GetFirstDocTemplatePosition();
61         CDocTemplate* DocT=AfxGetApp()->GetNextDocTemplate(pos);
62         POSITION p=DocT->GetFirstDocPosition();
63         DocT->GetNextDoc(p);
64         if(p==NULL)
65                 nCmdShow = SW_SHOWMAXIMIZED;      
66 */
67         CMDIChildWnd::ActivateFrame(nCmdShow);
68 }
69
70 int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 
71 {
72         if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
73                 return -1;
74         
75         if (!m_wndToolBar.Create(this) || !m_wndToolBar.LoadToolBar(IDR_3dCHILDFRAME))
76         {
77                 TRACE0("Failed to create toolbar\n");
78                 return -1; // fail to create
79         }
80
81         m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
82         m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
83         EnableDocking(CBRS_ALIGN_ANY);
84         DockControlBar(&m_wndToolBar);
85
86         return 0;
87 }
88
89
90
91 BOOL CChildFrame::DestroyWindow() 
92 {
93         // TODO: Add your specialized code here and/or call the base class
94         
95         return CMDIChildWnd::DestroyWindow();
96 }