www.pudn.com > GOS.rar > WhildView.cpp


// WhildView.cpp : implementation of the WChildView class 
// 
 
#include "wstdafx.h" 
#include "WGOS.h" 
#include "WhildView.h" 
#include "WBMP.h" 
#include "GOS_WIN.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
extern PBITMAPINFO m_pBmpInfo; 
extern CView* m_pView; 
extern USHORT m_aScreen[]; 
extern void	HAL_Unload(void); 
extern void HAL_Click(int x,int y,BOOL bDown); 
 
///////////////////////////////////////////////////////////////////////////// 
// WChildView 
 
WChildView::WChildView() 
{ 
} 
 
WChildView::~WChildView() 
{ 
} 
 
 
BEGIN_MESSAGE_MAP(WChildView,CWnd ) 
	//{{AFX_MSG_MAP(WChildView) 
	ON_WM_PAINT() 
	ON_WM_DESTROY() 
	ON_WM_LBUTTONUP() 
	ON_WM_LBUTTONDOWN() 
	ON_WM_CREATE() 
	ON_COMMAND(IDM_BMP_CODE, OnBmpCode) 
	ON_COMMAND(ID_EDIT_PASTE, OnEditPaste) 
	ON_UPDATE_COMMAND_UI(ID_EDIT_PASTE, OnUpdateEditPaste) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
 
///////////////////////////////////////////////////////////////////////////// 
// WChildView message handlers 
 
BOOL WChildView::PreCreateWindow(CREATESTRUCT& cs)  
{ 
	if (!CWnd::PreCreateWindow(cs)) 
		return FALSE; 
 
	cs.dwExStyle |= WS_EX_CLIENTEDGE; 
	cs.style &= ~WS_BORDER; 
	cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS,  
		::LoadCursor(NULL, IDC_ARROW), HBRUSH(COLOR_WINDOW+1), NULL); 
 
	return TRUE; 
} 
 
void WChildView::OnPaint()  
{ 
	CPaintDC dc(this); // device context for painting 
	 
	// TODO: Add your message handler code here 
	RECT rect; 
	GetClientRect(&rect); 
	StretchDIBits(dc.m_hDC,rect.left,rect.top, 
		rect.right-rect.left,rect.bottom-rect.top, 
		0,0,GUI_CXSCREEN,GUI_CYSCREEN, 
		m_aScreen,m_pBmpInfo,DIB_RGB_COLORS,SRCCOPY); 
	 
	// Do not call CWnd::OnPaint() for painting messages 
} 
 
 
void WChildView::OnDestroy()  
{ 
	CWnd ::OnDestroy(); 
	 
	// TODO: Add your message handler code here 
	HAL_Unload(); 
	PostQuitMessage(0); 
	 
} 
 
void WChildView::OnLButtonUp(UINT nFlags, CPoint point)  
{ 
	// TODO: Add your message handler code here and/or call default 
	RECT rect; 
	GetClientRect(&rect); 
	point.x=point.x*GUI_CXSCREEN/(rect.right-rect.left+1); 
	point.y=point.y*GUI_CYSCREEN/(rect.bottom-rect.top+1); 
	 
	 
	HAL_Click(point.x,point.y,FALSE); 
	 
	CWnd ::OnLButtonUp(nFlags, point); 
} 
 
void WChildView::OnLButtonDown(UINT nFlags, CPoint point)  
{ 
	// TODO: Add your message handler code here and/or call default 
	RECT rect; 
	GetClientRect(&rect); 
	point.x=point.x*GUI_CXSCREEN/(rect.right-rect.left+1); 
	point.y=point.y*GUI_CYSCREEN/(rect.bottom-rect.top+1); 
	 
	HAL_Click(point.x,point.y,TRUE); 
	 
	 
	CWnd ::OnLButtonDown(nFlags, point); 
} 
 
 
int WChildView::OnCreate(LPCREATESTRUCT lpCreateStruct)  
{ 
	if (CWnd ::OnCreate(lpCreateStruct) == -1) 
		return -1; 
	 
	// TODO: Add your specialized creation code here 
	m_pView=(CView*)this; 
	return 0; 
} 
 
void WChildView::OnBmpCode()  
{ 
	// TODO: Add your command handler code here 
	WBMP dlg; 
	dlg.DoModal(); 
} 
 
void WChildView::OnEditPaste()  
{ 
	// TODO: Add your command handler code here 
	WBMP dlg; 
	dlg.DoModal(); 
 
} 
 
void WChildView::OnUpdateEditPaste(CCmdUI* pCmdUI)  
{ 
	// TODO: Add your command update UI handler code here 
	 
}