MainFrm.cpp
上传用户:zbjingming
上传日期:2010-01-02
资源大小:2436k
文件大小:2k
源码类别:

OpenGL

开发平台:

Visual C++

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. #include "stdafx.h"
  3. #include "Tool.h"
  4. #include "MainFrm.h"
  5. #include "FormCommandView.h"
  6. #include "RenderView.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. // CMainFrame
  13. IMPLEMENT_DYNAMIC(CMainFrame, CFrameWnd)
  14. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  15. //{{AFX_MSG_MAP(CMainFrame)
  16. ON_WM_CREATE()
  17. ON_WM_PAINT()
  18. //}}AFX_MSG_MAP
  19. END_MESSAGE_MAP()
  20. static UINT indicators[] =
  21. {
  22. ID_SEPARATOR,           // status line indicator
  23. ID_INDICATOR_CAPS,
  24. ID_INDICATOR_NUM,
  25. ID_INDICATOR_SCRL,
  26. };
  27. // CMainFrame construction/destruction
  28. CMainFrame::CMainFrame()
  29. {
  30. }
  31. CMainFrame::~CMainFrame()
  32. {
  33. }
  34. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  35. {
  36. if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  37. return -1;
  38. if (!m_wndToolBar.Create(this) ||
  39. !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  40. {
  41. TRACE0("Failed to create toolbarn");
  42. return -1;      // fail to create
  43. }
  44. if (!m_wndStatusBar.Create(this) ||
  45. !m_wndStatusBar.SetIndicators(indicators,
  46.   sizeof(indicators)/sizeof(UINT)))
  47. {
  48. TRACE0("Failed to create status barn");
  49. return -1;      // fail to create
  50. }
  51. m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
  52. CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
  53. return 0;
  54. }
  55. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  56. {
  57. cs.cx = 600; cs.cy = 500;
  58. return CFrameWnd::PreCreateWindow(cs);
  59. }
  60. // CMainFrame diagnostics
  61. #ifdef _DEBUG
  62. void CMainFrame::AssertValid() const
  63. {
  64. CFrameWnd::AssertValid();
  65. }
  66. void CMainFrame::Dump(CDumpContext& dc) const
  67. {
  68. CFrameWnd::Dump(dc);
  69. }
  70. #endif //_DEBUG
  71. // CMainFrame message handlers
  72. void CMainFrame::OnPaint() 
  73. {
  74. CPaintDC dc(this); // device context for painting
  75. }
  76. BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
  77. {
  78. if (!m_wndSplitter.CreateStatic(this, 1, 2,WS_CHILD | WS_VISIBLE))
  79. {
  80. TRACE("Failed to CreateStaticSplittern");
  81. return FALSE;
  82. }
  83. // First splitter pane
  84. if (!m_wndSplitter.CreateView(0, 0,
  85. RUNTIME_CLASS(CRenderView), CSize(600,500), pContext))
  86. {
  87. TRACE("Failed to create command view panen");
  88. return FALSE;
  89. }
  90. if (!m_wndSplitter.CreateView(0, 1,
  91. RUNTIME_CLASS(CFormCommandView), CSize(0,0), pContext))
  92. {
  93. TRACE("Failed to create command view panen");
  94. return FALSE;
  95. }
  96. // Second splitter pane
  97. return TRUE;
  98. }