1 | // MainFrm.cpp : implementation of the CMainFrame class
|
---|
2 | //
|
---|
3 |
|
---|
4 | #include "stdafx.h"
|
---|
5 | #include "TestProg.h"
|
---|
6 |
|
---|
7 | #include "MainFrm.h"
|
---|
8 |
|
---|
9 | #ifdef _DEBUG
|
---|
10 | #define new DEBUG_NEW
|
---|
11 | #endif
|
---|
12 |
|
---|
13 |
|
---|
14 | // CMainFrame
|
---|
15 |
|
---|
16 | IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
|
---|
17 |
|
---|
18 | BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
|
---|
19 | ON_WM_CREATE()
|
---|
20 | END_MESSAGE_MAP()
|
---|
21 |
|
---|
22 | static UINT indicators[] =
|
---|
23 | {
|
---|
24 | ID_SEPARATOR, // status line indicator
|
---|
25 | ID_INDICATOR_CAPS,
|
---|
26 | ID_INDICATOR_NUM,
|
---|
27 | ID_INDICATOR_SCRL,
|
---|
28 | };
|
---|
29 |
|
---|
30 |
|
---|
31 | // CMainFrame construction/destruction
|
---|
32 |
|
---|
33 | CMainFrame::CMainFrame()
|
---|
34 | {
|
---|
35 | // TODO: add member initialization code here
|
---|
36 | }
|
---|
37 |
|
---|
38 | CMainFrame::~CMainFrame()
|
---|
39 | {
|
---|
40 | }
|
---|
41 |
|
---|
42 |
|
---|
43 | int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
---|
44 | {
|
---|
45 | if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
|
---|
46 | return -1;
|
---|
47 |
|
---|
48 | if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
|
---|
49 | | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
|
---|
50 | !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
|
---|
51 | {
|
---|
52 | TRACE0("Failed to create toolbar\n");
|
---|
53 | return -1; // fail to create
|
---|
54 | }
|
---|
55 |
|
---|
56 | if (!m_wndStatusBar.Create(this) ||
|
---|
57 | !m_wndStatusBar.SetIndicators(indicators,
|
---|
58 | sizeof(indicators)/sizeof(UINT)))
|
---|
59 | {
|
---|
60 | TRACE0("Failed to create status bar\n");
|
---|
61 | return -1; // fail to create
|
---|
62 | }
|
---|
63 |
|
---|
64 | // TODO: Delete these three lines if you don't want the toolbar to be dockable
|
---|
65 | m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
|
---|
66 | EnableDocking(CBRS_ALIGN_ANY);
|
---|
67 | DockControlBar(&m_wndToolBar);
|
---|
68 |
|
---|
69 | return 0;
|
---|
70 | }
|
---|
71 |
|
---|
72 | BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
|
---|
73 | {
|
---|
74 | if( !CMDIFrameWnd::PreCreateWindow(cs) )
|
---|
75 | return FALSE;
|
---|
76 | // TODO: Modify the Window class or styles here by modifying
|
---|
77 | // the CREATESTRUCT cs
|
---|
78 |
|
---|
79 | return TRUE;
|
---|
80 | }
|
---|
81 |
|
---|
82 |
|
---|
83 | // CMainFrame diagnostics
|
---|
84 |
|
---|
85 | #ifdef _DEBUG
|
---|
86 | void CMainFrame::AssertValid() const
|
---|
87 | {
|
---|
88 | CMDIFrameWnd::AssertValid();
|
---|
89 | }
|
---|
90 |
|
---|
91 | void CMainFrame::Dump(CDumpContext& dc) const
|
---|
92 | {
|
---|
93 | CMDIFrameWnd::Dump(dc);
|
---|
94 | }
|
---|
95 |
|
---|
96 | #endif //_DEBUG
|
---|
97 |
|
---|
98 |
|
---|
99 | // CMainFrame message handlers
|
---|
100 |
|
---|
101 |
|
---|
102 |
|
---|