DockingContainersView.cpp
上传用户:szled88
上传日期:2015-04-09
资源大小:43957k
文件大小:5k
源码类别:

对话框与窗口

开发平台:

Visual C++

  1. // DockingContainersView.cpp : implementation of the CDockingContainersView class
  2. //
  3. // This file is a part of the XTREME TOOLKIT PRO MFC class library.
  4. // (c)1998-2008 Codejock Software, All Rights Reserved.
  5. //
  6. // THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE
  7. // RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN
  8. // CONSENT OF CODEJOCK SOFTWARE.
  9. //
  10. // THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED
  11. // IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO
  12. // YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A
  13. // SINGLE COMPUTER.
  14. //
  15. // CONTACT INFORMATION:
  16. // support@codejock.com
  17. // http://www.codejock.com
  18. //
  19. /////////////////////////////////////////////////////////////////////////////
  20. #include "stdafx.h"
  21. #include "DockingContainers.h"
  22. #include "DockingContainersDoc.h"
  23. #include "DockingContainersView.h"
  24. #include "MainFrm.h"
  25. #ifdef _DEBUG
  26. #define new DEBUG_NEW
  27. #undef THIS_FILE
  28. static char THIS_FILE[] = __FILE__;
  29. #endif
  30. /////////////////////////////////////////////////////////////////////////////
  31. // CDockingContainersView
  32. IMPLEMENT_DYNCREATE(CDockingContainersView, CView)
  33. BEGIN_MESSAGE_MAP(CDockingContainersView, CView)
  34. //{{AFX_MSG_MAP(CDockingContainersView)
  35. ON_WM_LBUTTONDOWN()
  36. ON_WM_MOUSEMOVE()
  37. ON_WM_LBUTTONUP()
  38. //}}AFX_MSG_MAP
  39. // Standard printing commands
  40. ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
  41. ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
  42. ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
  43. END_MESSAGE_MAP()
  44. /////////////////////////////////////////////////////////////////////////////
  45. // CDockingContainersView construction/destruction
  46. CDockingContainersView::CDockingContainersView()
  47. {
  48. // TODO: add construction code here
  49. }
  50. CDockingContainersView::~CDockingContainersView()
  51. {
  52. }
  53. BOOL CDockingContainersView::PreCreateWindow(CREATESTRUCT& cs)
  54. {
  55. // TODO: Modify the Window class or styles here by modifying
  56. //  the CREATESTRUCT cs
  57. return CView::PreCreateWindow(cs);
  58. }
  59. /////////////////////////////////////////////////////////////////////////////
  60. // CDockingContainersView drawing
  61. void CDockingContainersView::OnDraw(CDC* pDC)
  62. {
  63. DrawLines(pDC, CXTPClientRect(this));
  64. }
  65. void CDockingContainersView::DrawLines(CDC* pDC, CRect rcView)
  66. {
  67. CXTPClientRect rc(this);
  68. if (m_pointArray.GetSize() > 1)
  69. {
  70. pDC->MoveTo(m_pointArray[0].x * rcView.Width() / rc.Width(), m_pointArray[0].y * rcView.Height() / rc.Height());
  71. for (int i = 1; i < m_pointArray.GetSize(); i++)
  72. {
  73. pDC->LineTo(m_pointArray[i].x * rcView.Width() / rc.Width(), m_pointArray[i].y * rcView.Height() / rc.Height());
  74. }
  75. }
  76. }
  77. /////////////////////////////////////////////////////////////////////////////
  78. // CDockingContainersView printing
  79. BOOL CDockingContainersView::OnPreparePrinting(CPrintInfo* pInfo)
  80. {
  81. // default preparation
  82. return DoPreparePrinting(pInfo);
  83. }
  84. void CDockingContainersView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  85. {
  86. // TODO: add extra initialization before printing
  87. }
  88. void CDockingContainersView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  89. {
  90. // TODO: add cleanup after printing
  91. }
  92. /////////////////////////////////////////////////////////////////////////////
  93. // CDockingContainersView diagnostics
  94. #ifdef _DEBUG
  95. void CDockingContainersView::AssertValid() const
  96. {
  97. CView::AssertValid();
  98. }
  99. void CDockingContainersView::Dump(CDumpContext& dc) const
  100. {
  101. CView::Dump(dc);
  102. }
  103. CDockingContainersDoc* CDockingContainersView::GetDocument() // non-debug version is inline
  104. {
  105. ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDockingContainersDoc)));
  106. return (CDockingContainersDoc*)m_pDocument;
  107. }
  108. #endif //_DEBUG
  109. /////////////////////////////////////////////////////////////////////////////
  110. // CDockingContainersView message handlers
  111. void CDockingContainersView::OnLButtonDown(UINT nFlags, CPoint point)
  112. {
  113. SetCapture();
  114. m_ptLast = point;
  115. m_pointArray.RemoveAll();
  116. m_pointArray.Add(m_ptLast);
  117. Invalidate(TRUE);
  118. CView::OnLButtonDown(nFlags, point);
  119. }
  120. void CDockingContainersView::OnMouseMove(UINT nFlags, CPoint point)
  121. {
  122. if (GetCapture() == this)
  123. {
  124. CClientDC dc(this);
  125. dc.MoveTo(m_ptLast);
  126. dc.LineTo(point);
  127. m_pointArray.Add(point);
  128. m_ptLast = point;
  129. RefreshPanes();
  130. }
  131. CView::OnMouseMove(nFlags, point);
  132. }
  133. void CDockingContainersView::OnLButtonUp(UINT nFlags, CPoint point)
  134. {
  135. ReleaseCapture();
  136. CView::OnLButtonUp(nFlags, point);
  137. }