// mymfc12View.cpp : implementation of the CMymfc12View class

#include "stdafx.h"
#include "mymfc12.h"

#include "mymfc12Doc.h"
#include "mymfc12View.h"
#include "MainFrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMymfc12View

IMPLEMENT_DYNCREATE(CMymfc12View, CView)

BEGIN_MESSAGE_MAP(CMymfc12View, CView)
	//{{AFX_MSG_MAP(CMymfc12View)
	ON_WM_MOUSEMOVE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMymfc12View construction/destruction

CMymfc12View::CMymfc12View()
{
	// TODO: add construction code here

}

CMymfc12View::~CMymfc12View()
{
}

BOOL CMymfc12View::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CMymfc12View drawing

void CMymfc12View::OnDraw(CDC* pDC)
{
	// TODO: add draw code for native data here
	pDC->TextOut(30, 30, "Watch the status bar while you move and click the mouse.");
}

/////////////////////////////////////////////////////////////////////////////
// CMymfc12View diagnostics

#ifdef _DEBUG
void CMymfc12View::AssertValid() const
{
	CView::AssertValid();
}

void CMymfc12View::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CMymfc12Doc* CMymfc12View::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMymfc12Doc)));
	return (CMymfc12Doc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMymfc12View message handlers

void CMymfc12View::OnMouseMove(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
CString str;
    CMainFrame* pFrame = (CMainFrame*) AfxGetApp()->m_pMainWnd;
    CStatusBar* pStatus = &pFrame->m_wndStatusBar;
    if (pStatus) {
        str.Format("x = %d", point.x);
        pStatus->SetPaneText(0, str);
        str.Format("y = %d", point.y);
        pStatus->SetPaneText(1, str);
    }
}
