0023097: MFC Samples do not compile after redesigning the TKOpenGl driver
[occt.git] / samples / mfc / standard / Common / OCC_ChildFrame.cpp
CommitLineData
7fd59977 1// OCC_BaseChildFrame.cpp: implementation of the OCC_BaseChildFrame class.
2//
3//////////////////////////////////////////////////////////////////////
4
5#include "stdafx.h"
6
7#include "OCC_BaseChildFrame.h"
8
9#include <res\OCC_Resource.h>
10
11/////////////////////////////////////////////////////////////////////////////
12// OCC_BaseChildFrame
13
14IMPLEMENT_DYNCREATE (OCC_BaseChildFrame, CMDIChildWnd)
15
16BEGIN_MESSAGE_MAP(OCC_BaseChildFrame, CMDIChildWnd)
17 //{{AFX_MSG_MAP(OCC_BaseChildFrame)
18 ON_WM_CREATE()
19 //}}AFX_MSG_MAP
20END_MESSAGE_MAP()
21
22/////////////////////////////////////////////////////////////////////////////
23// OCC_BaseChildFrame construction/destruction
24
25OCC_BaseChildFrame::OCC_BaseChildFrame()
26{
27}
28
29OCC_BaseChildFrame::~OCC_BaseChildFrame()
30{
31}
32
33BOOL OCC_BaseChildFrame::PreCreateWindow(CREATESTRUCT& cs)
34{
35 // TODO: Modify the Window class or styles here by modifying
36 // the CREATESTRUCT cs
37
38 return CMDIChildWnd::PreCreateWindow(cs);
39}
40
41/////////////////////////////////////////////////////////////////////////////
42// OCC_BaseChildFrame diagnostics
43
44#ifdef _DEBUG
45void OCC_BaseChildFrame::AssertValid() const
46{
47 CMDIChildWnd::AssertValid();
48}
49
50void OCC_BaseChildFrame::Dump(CDumpContext& dc) const
51{
52 CMDIChildWnd::Dump(dc);
53}
54
55#endif //_DEBUG
56
57/////////////////////////////////////////////////////////////////////////////
58// OCC_BaseChildFrame message handlers
59
60int OCC_BaseChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
61{
62 if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
63 return -1;
64
65 if (!m_wndToolBar.Create(this) || !m_wndToolBar.LoadToolBar(IDR_CHILDFRAME))
66 {
67 TRACE0("Failed to create toolbar\n");
68 return -1; // fail to create
69 }
70
71 m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
72 m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
73 EnableDocking(CBRS_ALIGN_ANY);
74 DockControlBar(&m_wndToolBar);
75
76 return 0;
77}
78
79
80void OCC_BaseChildFrame::ActivateFrame(int nCmdShow)
81{
82 POSITION pos=AfxGetApp()->GetFirstDocTemplatePosition();
83 CDocTemplate* DocT=AfxGetApp()->GetNextDocTemplate(pos);
84 POSITION p=DocT->GetFirstDocPosition();
85 DocT->GetNextDoc(p);
86 if(p==NULL)
87 nCmdShow = SW_SHOWMAXIMIZED;
88 CMDIChildWnd::ActivateFrame(nCmdShow);
89}