MainFrm.cpp
资源名称:QGIS.rar [点击查看]
上传用户:oybseng
上传日期:2015-04-27
资源大小:7831k
文件大小:4k
源码类别:
GDI/图象编程
开发平台:
Visual C++
- // MainFrm.cpp : implementation of the CMainFrame class
- //
- #include "stdafx.h"
- #include "QGIS.h"
- #include "MainFrm.h"
- #include "QGISDoc.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- extern CQMapObj * g_pCurMap;
- /////////////////////////////////////////////////`////////////////////////////
- // CMainFrame
- IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
- BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
- //{{AFX_MSG_MAP(CMainFrame)
- ON_WM_CREATE()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- static UINT indicators[] =
- {
- ID_SEPARATOR, // status line indicator
- ID_SEPARATOR, // 用于显示鼠标的坐标值
- ID_SEPARATOR, // 用于显示地图比例尺
- ID_INDICATOR_CAPS,
- ID_INDICATOR_NUM,
- ID_INDICATOR_SCRL,
- };
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame construction/destruction
- CMainFrame::CMainFrame()
- {
- // TODO: add member initialization code here
- }
- CMainFrame::~CMainFrame()
- {
- }
- int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
- {
- if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
- return -1;
- CRect rectBound(0,0,0,0);
- if (!m_wndToolBar.CreateEx(this,TBSTYLE_FLAT,
- WS_CHILD | WS_VISIBLE | CBRS_SIZE_DYNAMIC |
- CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY|CBRS_GRIPPER,
- rectBound,IDR_MAINFRAME) ||
- !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
- {
- TRACE0("Failed to create the mainframe toolbarn");
- return -1; // fail to create
- }
- m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
- CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
- if (!m_wndStatusBar.Create(this) ||
- !m_wndStatusBar.SetIndicators(indicators,
- sizeof(indicators)/sizeof(UINT)))
- {
- TRACE0("Failed to create status barn");
- return -1; // fail to create
- }
- // TODO: Delete these three lines if you don't want the toolbar to
- // be dockable
- m_wndToolBar.SetWindowText("标准工具栏");
- m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
- EnableDocking(CBRS_ALIGN_ANY);
- DockControlBar(&m_wndToolBar);
- if (!m_MyDrawToolBar.CreateEx(this,TBSTYLE_FLAT,
- WS_CHILD | WS_VISIBLE | CBRS_SIZE_DYNAMIC |
- CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY|CBRS_GRIPPER,
- rectBound, IDR_TOOLBAR_DRAW_QGIS) ||
- !m_MyDrawToolBar.LoadToolBar(IDR_TOOLBAR_DRAW_QGIS))
- {
- TRACE0("Failed to create the m_wndCadModifyToolBar toolbar.n");
- return -1; // fail to create
- }
- m_MyDrawToolBar.SetWindowText(_T("修改工具"));
- m_MyDrawToolBar.EnableDocking(CBRS_ALIGN_ANY);
- EnableDocking(CBRS_ALIGN_ANY);
- DockControlBar(&m_MyDrawToolBar);
- if (!m_MyEditToolBar.CreateEx(this,TBSTYLE_FLAT,
- WS_CHILD | WS_VISIBLE | CBRS_SIZE_DYNAMIC |
- CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY|CBRS_GRIPPER,
- rectBound, IDR_TOOLBAR_EDIT_QGIS) ||
- !m_MyEditToolBar.LoadToolBar(IDR_TOOLBAR_EDIT_QGIS))
- {
- TRACE0("Failed to create the m_wndCadModifyToolBar toolbar.n");
- return -1; // fail to create
- }
- m_MyEditToolBar.SetWindowText(_T("修改工具"));
- m_MyEditToolBar.EnableDocking(CBRS_ALIGN_ANY);
- EnableDocking(CBRS_ALIGN_ANY);
- DockControlBar(&m_MyEditToolBar);
- return 0;
- }
- BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
- {
- if( !CMDIFrameWnd::PreCreateWindow(cs) )
- return FALSE;
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- return TRUE;
- }
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame diagnostics
- #ifdef _DEBUG
- void CMainFrame::AssertValid() const
- {
- CMDIFrameWnd::AssertValid();
- }
- void CMainFrame::Dump(CDumpContext& dc) const
- {
- CMDIFrameWnd::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame message handlers
- void CMainFrame::OnFileNew()
- {
- }