Merge pull request #2303 from jwillemsen/jwi-803
[ACE_TAO.git] / TAO / examples / mfc / MainFrm.cpp
blob650259e3b712007f96fa4d74d7a4dd7f78b85e36
1 // MainFrm.cpp : implementation of the CMainFrame class
2 //
4 #include "stdafx.h"
5 #include "server.h"
7 #include "MainFrm.h"
9 #ifdef _DEBUG
10 #define new DEBUG_NEW
11 #undef THIS_FILE
12 static char THIS_FILE[] = __FILE__;
13 #endif
15 /////////////////////////////////////////////////////////////////////////////
16 // CMainFrame
18 IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
20 BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
21 //{{AFX_MSG_MAP(CMainFrame)
22 // NOTE - the ClassWizard will add and remove mapping macros here.
23 // DO NOT EDIT what you see in these blocks of generated code !
24 ON_WM_CREATE()
25 //}}AFX_MSG_MAP
26 END_MESSAGE_MAP()
28 static UINT indicators[] =
30 ID_SEPARATOR, // status line indicator
31 ID_INDICATOR_CAPS,
32 ID_INDICATOR_NUM,
33 ID_INDICATOR_SCRL,
36 /////////////////////////////////////////////////////////////////////////////
37 // CMainFrame construction/destruction
39 CMainFrame::CMainFrame()
41 // TODO: add member initialization code here
44 CMainFrame::~CMainFrame()
48 int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
50 if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
51 return -1;
53 if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE |
54 CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS |
55 CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
56 !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
58 TRACE0("Failed to create toolbar\n");
59 return -1; // fail to create
62 if (!m_wndStatusBar.Create(this) ||
63 !m_wndStatusBar.SetIndicators(indicators,
64 sizeof(indicators)/sizeof(UINT)))
66 TRACE0("Failed to create status bar\n");
67 return -1; // fail to create
70 // TODO: Delete these three lines if you don't want the toolbar to
71 // be dockable
72 m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
73 EnableDocking(CBRS_ALIGN_ANY);
74 DockControlBar(&m_wndToolBar);
76 return 0;
79 BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
81 if( !CFrameWnd::PreCreateWindow(cs) )
82 return FALSE;
83 // TODO: Modify the Window class or styles here by modifying
84 // the CREATESTRUCT cs
86 return TRUE;
89 /////////////////////////////////////////////////////////////////////////////
90 // CMainFrame diagnostics
92 #ifdef _DEBUG
93 void CMainFrame::AssertValid() const
95 CFrameWnd::AssertValid();
98 void CMainFrame::Dump(CDumpContext& dc) const
100 CFrameWnd::Dump(dc);
103 #endif //_DEBUG
105 /////////////////////////////////////////////////////////////////////////////
106 // CMainFrame message handlers