home *** CD-ROM | disk | FTP | other *** search
/ Using Visual C++ 4 (Special Edition) / Using_Visual_C_4_Special_Edition_QUE_1996.iso / ch09 / autocvw.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-13  |  2.3 KB  |  103 lines

  1. // autocvw.cpp : implementation of the CClikView class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "autoclik.h"
  6.  
  7. #include "autocdoc.h"
  8. #include "autocvw.h"
  9.  
  10. #ifdef _DEBUG
  11. #undef THIS_FILE
  12. static char BASED_CODE THIS_FILE[] = __FILE__;
  13. #endif
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CClikView
  17.  
  18. IMPLEMENT_DYNCREATE(CClikView, CView)
  19.  
  20. BEGIN_MESSAGE_MAP(CClikView, CView)
  21.     //{{AFX_MSG_MAP(CClikView)
  22.     ON_WM_LBUTTONDOWN()
  23.     //}}AFX_MSG_MAP
  24.     // Standard printing commands
  25.     ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
  26.     ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
  27. END_MESSAGE_MAP()
  28.  
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CClikView construction/destruction
  31.  
  32. CClikView::CClikView()
  33. {
  34.     // TODO: add construction code here
  35. }
  36.  
  37. CClikView::~CClikView()
  38. {
  39. }
  40.  
  41. /////////////////////////////////////////////////////////////////////////////
  42. // CClikView drawing
  43.  
  44. void CClikView::OnDraw(CDC* pDC)
  45. {
  46.     CClikDoc* pDoc = GetDocument();
  47.     ASSERT_VALID(pDoc);
  48.  
  49.     pDC->TextOut(pDoc->m_pt.x, pDoc->m_pt.y, pDoc->m_str);
  50. }
  51.  
  52. /////////////////////////////////////////////////////////////////////////////
  53. // CClikView printing
  54.  
  55. BOOL CClikView::OnPreparePrinting(CPrintInfo* pInfo)
  56. {
  57.     // default preparation
  58.     return DoPreparePrinting(pInfo);
  59. }
  60.  
  61. void CClikView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  62. {
  63.     // TODO: add extra initialization before printing
  64. }
  65.  
  66. void CClikView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  67. {
  68.     // TODO: add cleanup after printing
  69. }
  70.  
  71. /////////////////////////////////////////////////////////////////////////////
  72. // CClikView diagnostics
  73.  
  74. #ifdef _DEBUG
  75. void CClikView::AssertValid() const
  76. {
  77.     CView::AssertValid();
  78. }
  79.  
  80. void CClikView::Dump(CDumpContext& dc) const
  81. {
  82.     CView::Dump(dc);
  83. }
  84.  
  85. CClikDoc* CClikView::GetDocument() // non-debug version is inline
  86. {
  87.     ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CClikDoc)));
  88.     return (CClikDoc*)m_pDocument;
  89. }
  90. #endif //_DEBUG
  91.  
  92. /////////////////////////////////////////////////////////////////////////////
  93. // CClikView message handlers
  94.  
  95. void CClikView::OnLButtonDown(UINT nFlags, CPoint point)
  96. {
  97.     CClikDoc* pDoc = GetDocument();
  98.     pDoc->m_pt = point;
  99.     pDoc->Refresh();
  100.  
  101.     CView::OnLButtonDown(nFlags, point);
  102. }
  103.