MainFrm.cpp
Upload User: szkelitina
Upload Date: 2022-05-21
Package Size: 6797k
Code Size: 3k
Category:

Special Effects

Development Platform:

Visual C++

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3. #include "stdafx.h"
  4. #include "DSplit.h"
  5. #include "MainFrm.h"
  6. #include "DynSplitView2.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CMainFrame
  14. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  15. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  16. //{{AFX_MSG_MAP(CMainFrame)
  17. ON_WM_CREATE()
  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. /////////////////////////////////////////////////////////////////////////////
  28. // CMainFrame construction/destruction
  29. CMainFrame::CMainFrame()
  30. {
  31. // TODO: add member initialization code here
  32. }
  33. CMainFrame::~CMainFrame()
  34. {
  35. }
  36. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  37. {
  38. if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  39. return -1;
  40. if (!m_wndToolBar.Create(this) ||
  41. !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  42. {
  43. TRACE0("Failed to create toolbarn");
  44. return -1;      // fail to create
  45. }
  46. if (!m_wndStatusBar.Create(this) ||
  47. !m_wndStatusBar.SetIndicators(indicators,
  48.   sizeof(indicators)/sizeof(UINT)))
  49. {
  50. TRACE0("Failed to create status barn");
  51. return -1;      // fail to create
  52. }
  53. // TODO: Remove this if you don't want tool tips or a resizeable toolbar
  54. m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
  55. CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
  56. // TODO: Delete these three lines if you don't want the toolbar to
  57. //  be dockable
  58. m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  59. EnableDocking(CBRS_ALIGN_ANY);
  60. DockControlBar(&m_wndToolBar);
  61. return 0;
  62. }
  63. BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/,
  64. CCreateContext* pContext)
  65. {
  66. // create a splitter with 1 row, 2 columns
  67. if (!m_wndSplitter.CreateStatic(this, 1, 2))
  68. {
  69. TRACE0("Failed to Splitter windown");
  70. return FALSE;
  71. }
  72. // add the first splitter pane - the default view in column 0
  73. if (!m_wndSplitter.CreateView(0, 0,
  74. pContext->m_pNewViewClass, CSize(275, 150), pContext))
  75. {
  76. TRACE0("Failed to create first panen");
  77. return FALSE;
  78. }
  79. // add the second splitter pane - an input view in column 1
  80. if (!m_wndSplitter.CreateView(0, 1,
  81. RUNTIME_CLASS(CDynSplitView2), CSize(0, 0), pContext))
  82. {
  83. TRACE0("Failed to create second panen");
  84. return FALSE;
  85. }
  86. // activate the input view
  87. SetActiveView((CView*)m_wndSplitter.GetPane(0,1));
  88. return TRUE;
  89. }
  90. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  91. {
  92. // TODO: Modify the Window class or styles here by modifying
  93. //  the CREATESTRUCT cs
  94. return CFrameWnd::PreCreateWindow(cs);
  95. }
  96. /////////////////////////////////////////////////////////////////////////////
  97. // CMainFrame diagnostics
  98. #ifdef _DEBUG
  99. void CMainFrame::AssertValid() const
  100. {
  101. CFrameWnd::AssertValid();
  102. }
  103. void CMainFrame::Dump(CDumpContext& dc) const
  104. {
  105. CFrameWnd::Dump(dc);
  106. }
  107. #endif //_DEBUG
  108. /////////////////////////////////////////////////////////////////////////////
  109. // CMainFrame message handlers
  110. /*void CMainFrame::OnDynSplit() 
  111. {
  112. m_wndSplitter.SetDynamic(!m_wndSplitter.IsDynamic());
  113. }
  114. void CMainFrame::OnUpdateDynSplit(CCmdUI* pCmdUI) 
  115. {
  116. pCmdUI->SetCheck(m_wndSplitter.IsDynamic());
  117. }
  118. */