www.pudn.com > Lz_Text.rar > Lz_TextView.cpp


/*----------------------------------------------- 
* Copyright (c) 2003, Extreme Programming Team 
* All rights reserved. 
*  
* 文件名称:Lz_Text.cpp 
* 摘    要:Windows 程序开发BCG界面简单C++实现案例 
*  
* 当前版本:1.0 
* 作    者:L.Z.Jia / E P T. 
* 完成日期:22:29 2003-3-8 
------------------------------------------------*/ 
 
#include "stdafx.h" 
#include "Lz_Text.h" 
 
#include "Lz_TextDoc.h" 
#include "Lz_TextView.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CLz_TextView 
 
IMPLEMENT_DYNCREATE(CLz_TextView, CEditView) 
 
BEGIN_MESSAGE_MAP(CLz_TextView, CEditView) 
	//{{AFX_MSG_MAP(CLz_TextView) 
		// 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 
	ON_WM_CONTEXTMENU() 
	// Standard printing commands 
	ON_COMMAND(ID_FILE_PRINT, CEditView::OnFilePrint) 
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CEditView::OnFilePrint) 
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, OnFilePrintPreview) 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CLz_TextView construction/destruction 
 
CLz_TextView::CLz_TextView() 
{ 
	// TODO: add construction code here 
 
} 
 
CLz_TextView::~CLz_TextView() 
{ 
} 
 
BOOL CLz_TextView::PreCreateWindow(CREATESTRUCT& cs) 
{ 
	// TODO: Modify the Window class or styles here by modifying 
	//  the CREATESTRUCT cs 
 
	BOOL bPreCreated = CEditView::PreCreateWindow(cs); 
	cs.style &= ~(ES_AUTOHSCROLL|WS_HSCROLL);	// Enable word-wrapping 
 
	return bPreCreated; 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CLz_TextView drawing 
 
void CLz_TextView::OnDraw(CDC* pDC) 
{ 
	CLz_TextDoc* pDoc = GetDocument(); 
	ASSERT_VALID(pDoc); 
	// TODO: add draw code for native data here 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CLz_TextView printing 
 
void CLz_TextView::OnFilePrintPreview()  
{ 
	BCGPPrintPreview (this); 
} 
 
BOOL CLz_TextView::OnPreparePrinting(CPrintInfo* pInfo) 
{ 
	// default CEditView preparation 
	return CEditView::OnPreparePrinting(pInfo); 
} 
 
void CLz_TextView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo) 
{ 
	// Default CEditView begin printing. 
	CEditView::OnBeginPrinting(pDC, pInfo); 
} 
 
void CLz_TextView::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo) 
{ 
	// Default CEditView end printing 
	CEditView::OnEndPrinting(pDC, pInfo); 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CLz_TextView diagnostics 
 
#ifdef _DEBUG 
void CLz_TextView::AssertValid() const 
{ 
	CEditView::AssertValid(); 
} 
 
void CLz_TextView::Dump(CDumpContext& dc) const 
{ 
	CEditView::Dump(dc); 
} 
 
CLz_TextDoc* CLz_TextView::GetDocument() // non-debug version is inline 
{ 
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CLz_TextDoc))); 
	return (CLz_TextDoc*)m_pDocument; 
} 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
// CLz_TextView message handlers 
 
void CLz_TextView::OnContextMenu(CWnd*, CPoint point) 
{ 
	theApp.ShowPopupMenu (IDR_CONTEXT_MENU, point, this); 
}