Debian Codegraph @

Tests/MFC/mfc1/MainFrm.cpp

raw
1 // MainFrm.cpp : implementation of the CMainFrame class
2 //
3
4 // clang-format off
5 #include "stdafx.h"
6
7 #include "mfc1.h"
8
9 #include "MainFrm.h"
10 // clang-format on
11
12 #ifdef _DEBUG
13 # define new DEBUG_NEW
14 #endif
15
16 // CMainFrame
17
18 IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
19
20 BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
21 ON_WM_CREATE()
22 END_MESSAGE_MAP()
23
24 static UINT indicators[] = {
25 ID_SEPARATOR, // status line indicator
26 ID_INDICATOR_CAPS,
27 ID_INDICATOR_NUM,
28 ID_INDICATOR_SCRL,
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 int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
43 {
44 if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
45 return -1;
46
47 if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT,
48 WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER |
49 CBRS_TOOLTIPS | CBRS_FLYBY |
50 CBRS_SIZE_DYNAMIC) ||
51 !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) {
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 TRACE0("Failed to create status bar\n");
60 return -1; // fail to create
61 }
62 // TODO: Delete these three lines if you don't want the toolbar to be
63 // dockable
64 m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
65 EnableDocking(CBRS_ALIGN_ANY);
66 DockControlBar(&m_wndToolBar);
67
68 return 0;
69 }
70
71 BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
72 {
73 if (!CMDIFrameWnd::PreCreateWindow(cs))
74 return FALSE;
75 // TODO: Modify the Window class or styles here by modifying
76 // the CREATESTRUCT cs
77
78 return TRUE;
79 }
80
81 // CMainFrame diagnostics
82
83 #ifdef _DEBUG
84 void CMainFrame::AssertValid() const
85 {
86 CMDIFrameWnd::AssertValid();
87 }
88
89 void CMainFrame::Dump(CDumpContext& dc) const
90 {
91 CMDIFrameWnd::Dump(dc);
92 }
93
94 #endif //_DEBUG
95
96 // CMainFrame message handlers