// Modeless_mfcView.cpp : implementation of the CModeless_mfcView class
//

#include "stdafx.h"
#include "Modeless_mfc.h"

#include "Modeless_mfcDoc.h"
#include "Modeless_mfcView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CModeless_mfcView

IMPLEMENT_DYNCREATE(CModeless_mfcView, CView)

BEGIN_MESSAGE_MAP(CModeless_mfcView, CView)
	//{{AFX_MSG_MAP(CModeless_mfcView)
	ON_WM_LBUTTONDOWN()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CModeless_mfcView construction/destruction

CModeless_mfcView::CModeless_mfcView()
{
	// TODO: add construction code here
}

CModeless_mfcView::~CModeless_mfcView()
{
}

BOOL CModeless_mfcView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CModeless_mfcView drawing

void CModeless_mfcView::OnDraw(CDC* pDC)
{
	CModeless_mfcDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	pDC->TextOut( 0, 0, m_MessageDlg.m_Message ); // Get text from dialog
}

/////////////////////////////////////////////////////////////////////////////
// CModeless_mfcView diagnostics

#ifdef _DEBUG
void CModeless_mfcView::AssertValid() const
{
	CView::AssertValid();
}

void CModeless_mfcView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CModeless_mfcDoc* CModeless_mfcView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CModeless_mfcDoc)));
	return (CModeless_mfcDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CModeless_mfcView message handlers

void CModeless_mfcView::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default

	if( !m_MessageDlg.GetSafeHwnd() ) // Have we created the dialog?
		m_MessageDlg.Create( IDD_DIALOG1, this );
	if( !m_MessageDlg.IsWindowVisible() ) // Is it visible?
		m_MessageDlg.ShowWindow( SW_SHOW );
	CView::OnLButtonDown(nFlags, point);
}
