MainFrm.cpp
上传用户:zbjingming
上传日期:2010-01-02
资源大小:2436k
文件大小:2k
- // MainFrm.cpp : implementation of the CMainFrame class
- #include "stdafx.h"
- #include "Tool.h"
- #include "MainFrm.h"
- #include "FormCommandView.h"
- #include "RenderView.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- // CMainFrame
- IMPLEMENT_DYNAMIC(CMainFrame, CFrameWnd)
- BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
- //{{AFX_MSG_MAP(CMainFrame)
- ON_WM_CREATE()
- ON_WM_PAINT()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- static UINT indicators[] =
- {
- ID_SEPARATOR, // status line indicator
- ID_INDICATOR_CAPS,
- ID_INDICATOR_NUM,
- ID_INDICATOR_SCRL,
- };
- // CMainFrame construction/destruction
- CMainFrame::CMainFrame()
- {
- }
- CMainFrame::~CMainFrame()
- {
- }
- int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
- {
- if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
- return -1;
- if (!m_wndToolBar.Create(this) ||
- !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
- {
- TRACE0("Failed to create toolbarn");
- return -1; // fail to create
- }
- if (!m_wndStatusBar.Create(this) ||
- !m_wndStatusBar.SetIndicators(indicators,
- sizeof(indicators)/sizeof(UINT)))
- {
- TRACE0("Failed to create status barn");
- return -1; // fail to create
- }
- m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
- CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
- return 0;
- }
- BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
- {
- cs.cx = 600; cs.cy = 500;
- return CFrameWnd::PreCreateWindow(cs);
- }
- // CMainFrame diagnostics
- #ifdef _DEBUG
- void CMainFrame::AssertValid() const
- {
- CFrameWnd::AssertValid();
- }
- void CMainFrame::Dump(CDumpContext& dc) const
- {
- CFrameWnd::Dump(dc);
- }
- #endif //_DEBUG
- // CMainFrame message handlers
- void CMainFrame::OnPaint()
- {
- CPaintDC dc(this); // device context for painting
- }
- BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
- {
- if (!m_wndSplitter.CreateStatic(this, 1, 2,WS_CHILD | WS_VISIBLE))
- {
- TRACE("Failed to CreateStaticSplittern");
- return FALSE;
- }
- // First splitter pane
- if (!m_wndSplitter.CreateView(0, 0,
- RUNTIME_CLASS(CRenderView), CSize(600,500), pContext))
- {
- TRACE("Failed to create command view panen");
- return FALSE;
- }
- if (!m_wndSplitter.CreateView(0, 1,
- RUNTIME_CLASS(CFormCommandView), CSize(0,0), pContext))
- {
- TRACE("Failed to create command view panen");
- return FALSE;
- }
- // Second splitter pane
- return TRUE;
- }