home *** CD-ROM | disk | FTP | other *** search
/ Mastering Microsoft Visual C++ 4 (2nd Edition) / VisualC4.ISO / wingreet / wingrvw.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-30  |  2.1 KB  |  91 lines

  1. // WinGrVw.cpp : implementation of the CWinGreetView class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "WinGreet.h"
  6.  
  7. #include "WinGrDoc.h"
  8. #include "WinGrVw.h"
  9.  
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CWinGreetView
  18.  
  19. IMPLEMENT_DYNCREATE(CWinGreetView, CView)
  20.  
  21. BEGIN_MESSAGE_MAP(CWinGreetView, CView)
  22.    //{{AFX_MSG_MAP(CWinGreetView)
  23.       // NOTE - the ClassWizard will add and remove mapping macros here.
  24.       //    DO NOT EDIT what you see in these blocks of generated code!
  25.    //}}AFX_MSG_MAP
  26. END_MESSAGE_MAP()
  27.  
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CWinGreetView construction/destruction
  30.  
  31. CWinGreetView::CWinGreetView()
  32. {
  33.    // TODO: add construction code here
  34.  
  35. }
  36.  
  37. CWinGreetView::~CWinGreetView()
  38. {
  39. }
  40.  
  41. BOOL CWinGreetView::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. // CWinGreetView drawing
  51.  
  52. void CWinGreetView::OnDraw(CDC* pDC)
  53. {
  54.    CWinGreetDoc* pDoc = GetDocument();
  55.    ASSERT_VALID(pDoc);
  56.  
  57.    // TODO: add draw code for native data here
  58.  
  59.    RECT ClientRect;
  60.    GetClientRect (&ClientRect);
  61.    pDC->DrawText 
  62.       (pDoc->GetMessage (),  // obtain the string
  63.       -1,
  64.       &ClientRect,
  65.       DT_CENTER | DT_VCENTER | DT_SINGLELINE);
  66. }
  67.  
  68. /////////////////////////////////////////////////////////////////////////////
  69. // CWinGreetView diagnostics
  70.  
  71. #ifdef _DEBUG
  72. void CWinGreetView::AssertValid() const
  73. {
  74.    CView::AssertValid();
  75. }
  76.  
  77. void CWinGreetView::Dump(CDumpContext& dc) const
  78. {
  79.    CView::Dump(dc);
  80. }
  81.  
  82. CWinGreetDoc* CWinGreetView::GetDocument() // non-debug version is inline
  83. {
  84.    ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CWinGreetDoc)));
  85.    return (CWinGreetDoc*)m_pDocument;
  86. }
  87. #endif //_DEBUG
  88.  
  89. /////////////////////////////////////////////////////////////////////////////
  90. // CWinGreetView message handlers
  91.