www.pudn.com > HReportTest.rar > HListSort.h


// HListSort.h: interface for the CHListSort class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_HLISTSORT_H__24AE392E_0912_478B_9F62_F72A61CD475E__INCLUDED_) 
#define AFX_HLISTSORT_H__24AE392E_0912_478B_9F62_F72A61CD475E__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
typedef enum DATA_TYPE 
{ 
	DT_INT = 1,		// sort type int 
	DT_STRING,		// sort type string 
	DT_DATETIME,	// sort type date / time 
	DT_DEC			// sort type decimal 
}; 
 
class CHListSort   
{ 
public: 
	CHListSort(CListCtrl* pListCtrl, const int nCol); 
	virtual ~CHListSort(); 
 
protected: 
	CListCtrl* m_pListCtrl; 
	struct SORT_ITEM 
	{ 
		SORT_ITEM(const DWORD dwData, const CString &strItemText)  
		{ 
			m_dwData = dwData; 
			m_strItemText = strItemText; 
		} 
		DWORD	m_dwData; 
		CString m_strItemText; 
	}; 
 
public: 
	virtual void Sort(BOOL bAsc, DATA_TYPE eType); 
 
protected: 
	static int CALLBACK Compare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort); 
}; 
 
#endif // !defined(AFX_HLISTSORT_H__24AE392E_0912_478B_9F62_F72A61CD475E__INCLUDED_)