www.pudn.com > HReportTest.rar > HReportListView.cpp


// HReportListView.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "HReportListView.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CHReportListView 
 
IMPLEMENT_DYNCREATE(CHReportListView, CListView) 
 
 
BEGIN_MESSAGE_MAP(CHReportListView, CListView) 
	//{{AFX_MSG_MAP(CHReportListView) 
	ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw) 
	ON_NOTIFY_REFLECT(NM_RCLICK, OnRclick) 
	ON_WM_DESTROY() 
	ON_WM_ERASEBKGND() 
	ON_WM_PAINT() 
	ON_WM_CREATE() 
	ON_NOTIFY_REFLECT(NM_CLICK, OnClick) 
	ON_NOTIFY_REFLECT(NM_DBLCLK, OnDblclk) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
 
void CHReportListView::OnDraw(CDC* pDC) 
{ 
	UNUSED_ALWAYS( pDC ); 
} 
 
///////////////////////////////////////////////////////////////////////////// 
 
#ifdef _DEBUG 
void CHReportListView::AssertValid() const 
{ 
	CListView::AssertValid(); 
} 
 
void CHReportListView::Dump(CDumpContext& dc) const 
{ 
	CListView::Dump(dc); 
} 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
 
BOOL CHReportListView::PreCreateWindow(CREATESTRUCT& cs) 
{ 
	PreCreateWindowImpl_Pre(cs); 
	return CListView::PreCreateWindow(cs); 
} 
 
void CHReportListView::OnInitialUpdate()  
{ 
	CListView::OnInitialUpdate(); 
} 
 
void CHReportListView::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)  
{ 
	OnCustomDrawImpl(pNMHDR, pResult); 
} 
 
BOOL CHReportListView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)  
{ 
	return OnNotifyImpl(wParam, lParam, pResult); 
} 
 
void CHReportListView::OnDestroy()  
{ 
	OnDestroyImpl_Pre(); 
	CListView::OnDestroy(); 
} 
 
BOOL CHReportListView::OnEraseBkgnd(CDC* pDC)  
{ 
	return OnEraseBkgndImpl(pDC); 
} 
 
void CHReportListView::OnPaint()  
{ 
	OnPaintImpl(); 
} 
 
int CHReportListView::OnCreate(LPCREATESTRUCT lpCreateStruct)  
{ 
	if (CListView::OnCreate(lpCreateStruct) == -1) 
		return -1; 
 
	return OnCreateImpl_Post(lpCreateStruct); 
} 
 
void CHReportListView::OnRclick(NMHDR* pNMHDR, LRESULT* pResult)  
{ 
	CPoint point; 
	GetCursorPos(&point); 
 
	CListCtrl& list = GetListCtrl(); 
	list.ScreenToClient(&point); 
 
	UINT uFlags = 0; 
	int nItem = list.HitTest(point, &uFlags); 
	OnRclickImpl(point, nItem); 
 
	*pResult = 0; 
} 
 
void CHReportListView::OnClick(NMHDR* pNMHDR, LRESULT* pResult)  
{ 
	CPoint point; 
	GetCursorPos(&point); 
 
	CListCtrl& list = GetListCtrl(); 
	list.ScreenToClient(&point); 
 
	UINT uFlags = 0; 
	int nItem = list.HitTest(point, &uFlags); 
	 
	OnClickImpl(point, nItem); 
 
	*pResult = 0; 
} 
 
void CHReportListView::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult)  
{ 
	CPoint point; 
	GetCursorPos(&point); 
 
	CListCtrl& list = GetListCtrl(); 
	list.ScreenToClient(&point); 
 
	UINT uFlags = 0; 
	int nItem = list.HitTest(point, &uFlags); 
	 
	OnDbClickImpl(point, nItem); 
 
	*pResult = 0; 
} 
 
void CHReportListView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)  
{ 
	print.OnBeginPrinting(pDC, pInfo); 
} 
 
void CHReportListView::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)  
{ 
	print.OnEndPrinting(pDC, pInfo); 
	CListView::OnEndPrinting(pDC, pInfo); 
} 
 
BOOL CHReportListView::OnPreparePrinting(CPrintInfo* pInfo)  
{ 
	print.Attach(&GetListCtrl()); 
	print.OnPreparePrinting(pInfo); 
	return DoPreparePrinting(pInfo); 
} 
 
void CHReportListView::OnPrint(CDC* pDC, CPrintInfo* pInfo)  
{ 
	print.OnPrint(pDC, pInfo); 
}