- // CaptionDemoView.cpp : implementation of the CCaptionDemoView class
- //
- #include "stdafx.h"
- #include "CaptionDemo.h"
- #include "CaptionDemoDoc.h"
- #include "CaptionDemoView.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CCaptionDemoView
- IMPLEMENT_DYNCREATE(CCaptionDemoView, CView)
- BEGIN_MESSAGE_MAP(CCaptionDemoView, CView)
- //{{AFX_MSG_MAP(CCaptionDemoView)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- // DO NOT EDIT what you see in these blocks of generated code!
- //}}AFX_MSG_MAP
- // Standard printing commands
- ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
- ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
- ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CCaptionDemoView construction/destruction
- CCaptionDemoView::CCaptionDemoView()
- {
- // TODO: add construction code here
- }
- CCaptionDemoView::~CCaptionDemoView()
- {
- }
- BOOL CCaptionDemoView::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- return CView::PreCreateWindow(cs);
- }
- /////////////////////////////////////////////////////////////////////////////
- // CCaptionDemoView drawing
- void CCaptionDemoView::OnDraw(CDC* pDC)
- {
- CCaptionDemoDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- // TODO: add draw code for native data here
- CRect rect;
- GetClientRect(&rect);
- pDC->DrawText("THIS IS A CView WINDOW", &rect, DT_CENTER|DT_TOP);
- }
- /////////////////////////////////////////////////////////////////////////////
- // CCaptionDemoView printing
- BOOL CCaptionDemoView::OnPreparePrinting(CPrintInfo* pInfo)
- {
- // default preparation
- return DoPreparePrinting(pInfo);
- }
- void CCaptionDemoView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add extra initialization before printing
- }
- void CCaptionDemoView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add cleanup after printing
- }
- /////////////////////////////////////////////////////////////////////////////
- // CCaptionDemoView diagnostics
- #ifdef _DEBUG
- void CCaptionDemoView::AssertValid() const
- {
- CView::AssertValid();
- }
- void CCaptionDemoView::Dump(CDumpContext& dc) const
- {
- CView::Dump(dc);
- }
- CCaptionDemoDoc* CCaptionDemoView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCaptionDemoDoc)));
- return (CCaptionDemoDoc*)m_pDocument;
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CCaptionDemoView message handlers