Integration of OCCT 6.5.0 from SVN
[occt.git] / samples / mfc / standard / 01_Geometry / src / MainFrm.cpp
1 // MainFrm.cpp : implementation of the CMainFrame class
2 //
3
4 #include "stdafx.h"
5 #include "GeometryApp.h"
6
7 #include "MainFrm.h"
8
9 #ifdef _DEBUG
10 #define new DEBUG_NEW
11 #undef THIS_FILE
12 static char THIS_FILE[] = __FILE__;
13 #endif
14
15 /////////////////////////////////////////////////////////////////////////////
16 // CMainFrame
17
18 IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
19
20 BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
21         //{{AFX_MSG_MAP(CMainFrame)
22         ON_WM_CREATE()
23         //}}AFX_MSG_MAP
24 END_MESSAGE_MAP()
25
26 static UINT indicators[] =
27 {
28         ID_SEPARATOR,           // status line indicator
29         ID_INDICATOR_CAPS,
30         ID_INDICATOR_NUM,
31         ID_INDICATOR_SCRL,
32 };
33
34 /////////////////////////////////////////////////////////////////////////////
35 // CMainFrame construction/destruction
36
37 CMainFrame::CMainFrame()
38 {
39         // TODO: add member initialization code here
40         
41 }
42
43 CMainFrame::~CMainFrame()
44 {
45 }
46
47 int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
48 {
49         if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
50                 return -1;
51         
52         if (!m_wndToolBar.Create(this) ||
53                 !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
54         {
55                 TRACE0("Failed to create toolbar\n");
56                 return -1;      // fail to create
57         }
58         if (!m_wndToolBar2.Create(this) ||
59                 !m_wndToolBar2.LoadToolBar(IDR_MAINFRAME2))
60         {
61                 TRACE0("Failed to create toolbar\n");
62                 return -1;      // fail to create
63         }
64
65         if (!m_wndStatusBar.Create(this) ||
66                 !m_wndStatusBar.SetIndicators(indicators,
67                   sizeof(indicators)/sizeof(UINT)))
68         {
69                 TRACE0("Failed to create status bar\n");
70                 return -1;      // fail to create
71         }
72
73         // TODO: Remove this if you don't want tool tips or a resizeable toolbar
74         m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
75                 CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
76
77         // TODO: Delete these three lines if you don't want the toolbar to
78         //  be dockable
79         m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
80         EnableDocking(CBRS_ALIGN_ANY);
81         DockControlBar(&m_wndToolBar);
82
83         // TODO: Remove this if you don't want tool tips or a resizeable toolbar
84         m_wndToolBar2.SetBarStyle(m_wndToolBar2.GetBarStyle() |
85                 CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
86
87         // TODO: Delete these three lines if you don't want the toolbar to
88         //  be dockable
89         m_wndToolBar2.EnableDocking(CBRS_ALIGN_ANY);
90         EnableDocking(CBRS_ALIGN_ANY);
91         DockControlBar(&m_wndToolBar2);
92         return 0;
93 }
94
95 BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
96 {
97         // TODO: Modify the Window class or styles here by modifying
98         //  the CREATESTRUCT cs
99
100         return CMDIFrameWnd::PreCreateWindow(cs);
101 }
102
103 /////////////////////////////////////////////////////////////////////////////
104 // CMainFrame diagnostics
105
106 #ifdef _DEBUG
107 void CMainFrame::AssertValid() const
108 {
109         CMDIFrameWnd::AssertValid();
110 }
111
112 void CMainFrame::Dump(CDumpContext& dc) const
113 {
114         CMDIFrameWnd::Dump(dc);
115 }
116
117 #endif //_DEBUG
118
119 /////////////////////////////////////////////////////////////////////////////
120 // CMainFrame message handlers
121