⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cjsortclass.h

📁 类似vc的集成开发环境
💻 H
字号:
// Copyright (c) Iuri Apollonio 1998
// Use & modify as you want & need, and leave those 3 lines.
// http://www.codeguru.com
// class extended by Max Poliashenko.

// CJSortClass.h: interface for the CCJSortClass class.
//

#ifndef __CJSORTCLASS_H__
#define __CJSORTCLASS_H__

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

// enumeration data type for sorting
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
};

// This class will sort a List control by a column of text, integer, float or
// date/time type. It could be easily extended for other data types.
class _CJX_EXT_CLASS CCJSortClass  
{

public:

	// Default constructor
	//
	CCJSortClass(CListCtrl* pWnd, const int nCol);

	// Virtual destructor
	//
	virtual ~CCJSortClass();

public:

	// this member function is call to peform the actual sort
	// proceedure.
	//
	void Sort(bool bAsc, DATA_TYPE eType);

protected:

	CListCtrl* m_pWnd;	// pointer to the CListCtrl object to peform sort on
	
	// this callback member function is called to compare to data items
	// during sorting operations
	//
	static int CALLBACK Compare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
	
	// helper struct used during sorting operations
	//
	struct CSortItem
	{
		CSortItem(const DWORD dwData, const CString &strItemText);
		DWORD	m_dwData;
		CString m_strItemText;
	};
};

/////////////////////////////////////////////////////////////////////////////
//	Inline Functions
/////////////////////////////////////////////////////////////////////////////

_CJXLIB_INLINE CCJSortClass::CSortItem::CSortItem(const DWORD dwData, const CString & strItemText)
	{ m_dwData  = dwData; m_strItemText = strItemText; }

#endif // __CJSORTCLASS_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -