cmake/Tests/MFC/mfc1/MainFrm.cpp

95 lines
2.0 KiB
C++
Raw Normal View History

2012-02-18 12:40:36 +02:00
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
2016-07-09 11:21:54 +02:00
2012-02-18 12:40:36 +02:00
#include "mfc1.h"
#include "MainFrm.h"
#ifdef _DEBUG
2018-08-09 18:06:22 +02:00
# define new DEBUG_NEW
2012-02-18 12:40:36 +02:00
#endif
// CMainFrame
IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
2016-07-09 11:21:54 +02:00
ON_WM_CREATE()
2012-02-18 12:40:36 +02:00
END_MESSAGE_MAP()
2016-07-09 11:21:54 +02:00
static UINT indicators[] = {
ID_SEPARATOR, // status line indicator
2018-08-09 18:06:22 +02:00
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
2012-02-18 12:40:36 +02:00
};
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
2016-07-09 11:21:54 +02:00
// TODO: add member initialization code here
2012-02-18 12:40:36 +02:00
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
2016-07-09 11:21:54 +02:00
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
2018-08-09 18:06:22 +02:00
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT,
WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER |
CBRS_TOOLTIPS | CBRS_FLYBY |
CBRS_SIZE_DYNAMIC) ||
2016-07-09 11:21:54 +02:00
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) {
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators) / sizeof(UINT))) {
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Delete these three lines if you don't want the toolbar to be
// dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return 0;
2012-02-18 12:40:36 +02:00
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
2016-07-09 11:21:54 +02:00
if (!CMDIFrameWnd::PreCreateWindow(cs))
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
2012-02-18 12:40:36 +02:00
2016-07-09 11:21:54 +02:00
return TRUE;
2012-02-18 12:40:36 +02:00
}
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
2016-07-09 11:21:54 +02:00
CMDIFrameWnd::AssertValid();
2012-02-18 12:40:36 +02:00
}
void CMainFrame::Dump(CDumpContext& dc) const
{
2016-07-09 11:21:54 +02:00
CMDIFrameWnd::Dump(dc);
2012-02-18 12:40:36 +02:00
}
#endif //_DEBUG
// CMainFrame message handlers