home *** CD-ROM | disk | FTP | other *** search
/ Popular Software Hundred Flowers Garden / POPSOFT_BHW.iso / SOFTWARE / AUDIO / DUTTY++ / DUTTY / DATA.Z / Demoview.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-09-08  |  3.8 KB  |  156 lines

  1. // demoView.cpp : implementation of the CDemoView class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "demo.h"
  6.  
  7. #include "demoDoc.h"
  8. #include "demoView.h"
  9. #include "mainfrm.h"
  10.  
  11. #ifdef _DEBUG
  12. #define new DEBUG_NEW
  13. #undef THIS_FILE
  14. static char THIS_FILE[] = __FILE__;
  15. #endif
  16.  
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CDemoView
  19.  
  20. IMPLEMENT_DYNCREATE(CDemoView, CView)
  21.  
  22. BEGIN_MESSAGE_MAP(CDemoView, CView)
  23.     //{{AFX_MSG_MAP(CDemoView)
  24.     ON_WM_LBUTTONDOWN()
  25.     //}}AFX_MSG_MAP
  26. END_MESSAGE_MAP()
  27.  
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CDemoView construction/destruction
  30.  
  31. CDemoView::CDemoView()
  32. {
  33.     // TODO: add construction code here
  34.  
  35. }
  36.  
  37. CDemoView::~CDemoView()
  38. {
  39. }
  40.  
  41. BOOL CDemoView::PreCreateWindow(CREATESTRUCT& cs)
  42. {
  43.     // TODO: Modify the Window class or styles here by modifying
  44.     //  the CREATESTRUCT cs
  45.  
  46.     return CView::PreCreateWindow(cs);
  47. }
  48.  
  49. /////////////////////////////////////////////////////////////////////////////
  50. // CDemoView drawing
  51.  
  52. void CDemoView::OnDraw(CDC* pdc)
  53. {
  54.     CDemoDoc* pDoc = GetDocument();
  55.     ASSERT_VALID(pDoc);
  56.  
  57.     CString L0("┐╔╥╘╩╣╙├├ⁿ┴ε╙╨");
  58.     CString L1("╡τ╗░,┐┤╙░╡·,╠²╥⌠└╓,═µ╙╬╧╖,╔╧═°┴─╠∞,┤≥╫╓");
  59.     CString L2("▓╗╓¬╡└╧δ╕╔╩▓├┤,╬╥╧δ╤º╡τ─╘");
  60.  
  61.     CFont font;
  62.     font.CreateFont(18, 8, 5, 5, FW_THIN, 0, 0, 0, ANSI_CHARSET, OUT_CHARACTER_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "DuttyFont" );
  63.     CFont * oldFont;
  64.     oldFont = pdc->SelectObject(&font);
  65.  
  66.     pdc->SetBkMode(TRANSPARENT);                      
  67.     pdc->SetTextColor(RGB(0, 0, 0));
  68. //    pdc->SetTextJustification(1, 1);
  69.  
  70.     ///////////////////////////////////////////////////////////////////////
  71.  
  72.     pdc->TextOut(40, 20, L0);
  73.     pdc->TextOut(60, 50, L1);
  74.     pdc->TextOut(60, 70, L2);
  75.  
  76.     pdc->SelectObject(oldFont);
  77.  
  78.   // Do not call CFrameWnd::OnPaint() for painting messages
  79.  
  80.     // TODO: add draw code for native data here
  81. }
  82.  
  83. /////////////////////////////////////////////////////////////////////////////
  84. // CDemoView diagnostics
  85.  
  86. #ifdef _DEBUG
  87. void CDemoView::AssertValid() const
  88. {
  89.     CView::AssertValid();
  90. }
  91.  
  92. void CDemoView::Dump(CDumpContext& dc) const
  93. {
  94.     CView::Dump(dc);
  95. }
  96.  
  97. CDemoDoc* CDemoView::GetDocument() // non-debug version is inline
  98. {
  99.     ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDemoDoc)));
  100.     return (CDemoDoc*)m_pDocument;
  101. }
  102. #endif //_DEBUG
  103.  
  104. /////////////////////////////////////////////////////////////////////////////
  105. // CDemoView message handlers
  106.  
  107. void CDemoView::OnPrint(CDC* pDC, CPrintInfo* pInfo) 
  108. {
  109.     // TODO: Add your specialized code here and/or call the base class
  110.     
  111.     CView::OnPrint(pDC, pInfo);
  112. }
  113.  
  114. void CDemoView::OnLButtonDown(UINT nFlags, CPoint point) 
  115. {
  116.     // TODO: Add your message handler code here and/or call default
  117.     //char tmp[100];
  118.     //sprintf(tmp, "%d, %d", point.x, point.y);
  119.     //MessageBox(tmp);
  120.     CRect rect;
  121.  
  122.     rect = CRect(60, 50, 90, 63);
  123.     if(rect.PtInRect(point))
  124.         ((CMainFrame*)GetParent())->ProcessMessage(0, 0);
  125.     
  126.     rect = CRect(97, 50, 143, 63);
  127.     if(rect.PtInRect(point))
  128.         ((CMainFrame*)GetParent())->ProcessMessage(1, 0);
  129.     
  130.     rect = CRect(151, 50, 195, 63);
  131.     if(rect.PtInRect(point))
  132.         ((CMainFrame*)GetParent())->ProcessMessage(2, 0);
  133.     
  134.     rect = CRect(203, 50, 250, 63);
  135.     if(rect.PtInRect(point))
  136.         ((CMainFrame*)GetParent())->ProcessMessage(3, 0);
  137.     
  138.     rect = CRect(256, 50, 318, 63);
  139.     if(rect.PtInRect(point))
  140.         ((CMainFrame*)GetParent())->ProcessMessage(4, 0);
  141.     
  142.     rect = CRect(324, 50, 356, 63);
  143.     if(rect.PtInRect(point))
  144.         ((CMainFrame*)GetParent())->ProcessMessage(5, 0);
  145.     
  146.     rect = CRect(60, 69, 169, 84);
  147.     if(rect.PtInRect(point))
  148.         ((CMainFrame*)GetParent())->ProcessMessage(6, 0);
  149.     
  150.     rect = CRect(178, 69, 256, 84);
  151.     if(rect.PtInRect(point))
  152.         ((CMainFrame*)GetParent())->ProcessMessage(7, 0);
  153.     
  154.     CView::OnLButtonDown(nFlags, point);
  155. }
  156.