SplitterView.cpp
上传用户:weimei12
上传日期:2022-08-11
资源大小:185k
文件大小:2k
源码类别:

Email客户端

开发平台:

Visual C++

  1. // SplitterView.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "SimpleMail.h"
  5. #include "ListCtrlView.h"
  6. #include "EditCtrlView.h"
  7. #include "SplitterView.h"
  8. // CSplitterView
  9. IMPLEMENT_DYNCREATE(CSplitterView, CView)
  10. CSplitterView::CSplitterView()
  11. {
  12. m_pListCtrlView = NULL;
  13. m_pEditCtrlView = NULL;
  14. }
  15. CSplitterView::~CSplitterView()
  16. {
  17. }
  18. BEGIN_MESSAGE_MAP(CSplitterView, CView)
  19. ON_WM_CREATE()
  20. ON_WM_SIZE()
  21. END_MESSAGE_MAP()
  22. // CSplitterView drawing
  23. void CSplitterView::OnDraw(CDC* pDC)
  24. {
  25. CDocument* pDoc = GetDocument();
  26. // TODO: add draw code here
  27. }
  28. // CSplitterView diagnostics
  29. #ifdef _DEBUG
  30. void CSplitterView::AssertValid() const
  31. {
  32. CView::AssertValid();
  33. }
  34. #ifndef _WIN32_WCE
  35. void CSplitterView::Dump(CDumpContext& dc) const
  36. {
  37. CView::Dump(dc);
  38. }
  39. #endif
  40. #endif //_DEBUG
  41. // CSplitterView message handlers
  42. int CSplitterView::OnCreate(LPCREATESTRUCT lpCreateStruct)
  43. {
  44. if (CView::OnCreate(lpCreateStruct) == -1)
  45. return -1;
  46. // TODO:  Add your specialized creation code here
  47. m_wndSplitter.CreateStatic(this, 2, 1);
  48. CCreateContext *pContext = (CCreateContext*) lpCreateStruct->lpCreateParams;
  49. if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CListCtrlView), CSize(150,0), pContext))
  50. {
  51. TRACE0("Failed to create listctrl viewn");
  52. return -1;
  53. }
  54. if (!m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CEditCtrlView), CSize(0,0), pContext))
  55. {
  56. TRACE0("Failed to create editctrl viewn");
  57. return -1;
  58. }
  59. m_pListCtrlView = (CListCtrlView*)(m_wndSplitter.GetPane(0, 0));
  60. m_pEditCtrlView = (CEditCtrlView*)m_wndSplitter.GetPane(1, 0);
  61. return 0;
  62. }
  63. void CSplitterView::OnSize(UINT nType, int cx, int cy)
  64. {
  65. CView::OnSize(nType, cx, cy);
  66. // TODO: Add your message handler code here
  67. m_wndSplitter.MoveWindow(0, 0, cx + 4, cy + 4);
  68. m_wndSplitter.SetRowInfo(0, cy - (cy / 4), 0);
  69. m_wndSplitter.SetRowInfo(1, cy / 4, 20);
  70. m_wndSplitter.RecalcLayout();
  71. }