Integration of OCCT 6.5.0 from SVN
[occt.git] / samples / mfc / occtdemo / Common / WNT / MainFrm.cpp
1 // MainFrm.cpp : implementation of the CMainFrame class
2 //
3
4 #include "stdafx.h"
5 #include "OCCDemo.h"
6
7 #include "MainFrm.h"
8 #include "OCCDemoDoc.h"
9
10 #ifdef _DEBUG
11 #define new DEBUG_NEW
12 #undef THIS_FILE
13 static char THIS_FILE[] = __FILE__;
14 #endif
15
16 /////////////////////////////////////////////////////////////////////////////
17 // CMainFrame
18
19 IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
20
21 BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
22         //{{AFX_MSG_MAP(CMainFrame)
23                 // NOTE - the ClassWizard will add and remove mapping macros here.
24                 //    DO NOT EDIT what you see in these blocks of generated code !
25         ON_WM_CREATE()
26         //}}AFX_MSG_MAP
27 END_MESSAGE_MAP()
28
29 static UINT indicators[] =
30 {
31         ID_SEPARATOR           // status line indicator
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 (CFrameWnd::OnCreate(lpCreateStruct) == -1)
50                 return -1;
51
52         if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
53                 /* | CBRS_GRIPPER */| CBRS_TOOLTIPS | CBRS_FLYBY) ||
54                 !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
55         {
56                 TRACE0("Failed to create toolbar\n");
57                 return -1;      // fail to create
58         }
59         
60   if (!m_wndToolBar1.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
61     | CBRS_TOOLTIPS | CBRS_FLYBY) ||
62                 !m_wndToolBar1.LoadToolBar(IDR_TOOLBAR1))
63         {
64                 TRACE0("Failed to create toolbar\n");
65                 return -1;      // fail to create
66         }
67
68         if (!m_wndStatusBar.Create(this) ||
69     !m_wndStatusBar.SetIndicators(indicators,
70                   sizeof(indicators)/sizeof(UINT)))
71         {
72                 TRACE0("Failed to create status bar\n");
73                 return -1;      // fail to create
74         }
75
76         // TODO: Delete these three lines if you don't want the toolbar to
77         //  be dockable
78   //m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
79         //EnableDocking(CBRS_ALIGN_ANY);
80         //DockControlBar(&m_wndToolBar);
81   return 0;
82 }
83
84 BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
85 {
86         if( !CFrameWnd::PreCreateWindow(cs) )
87                 return FALSE;
88         // TODO: Modify the Window class or styles here by modifying
89         //  the CREATESTRUCT cs
90
91         return TRUE;
92 }
93
94 /////////////////////////////////////////////////////////////////////////////
95 // CMainFrame diagnostics
96
97 #ifdef _DEBUG
98 void CMainFrame::AssertValid() const
99 {
100         CFrameWnd::AssertValid();
101 }
102
103 void CMainFrame::Dump(CDumpContext& dc) const
104 {
105         CFrameWnd::Dump(dc);
106 }
107
108 #endif //_DEBUG
109
110 /////////////////////////////////////////////////////////////////////////////
111 // CMainFrame message handlers
112