亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? multisortlistctrl.cpp

?? 文檔生成工具 XML例子
?? CPP
字號:
/*
	
	Usage:
		You generally should not use this class directly, though it
		is possible. You need to do two things to use it directly.
		Set m_strUniqueName to someting, and set m_strColumnWidthSection
		to where you want the column widths to be saved.

		The purpose of m_strUniqueName is to allow for saving of
		multiple instances of listview objects. So obviously you would
		need to set this differently for each instance. SetUniqueName must be called
		before calling InsertColumn() or LoadColumnWidths().

		If you are deriving from this class, you need to do the following:
		Add a class to your project derived from CListCtrl, then go into the
		header file and include MultiColumnSortListView.h and change all
		references to CListCtrl to CMultiSortListCtrl. Then in the .cpp
		file of your class, change all the message maps to CMultiSortListCtrl
		instead of CListCtrl. That should do it.

  Compiling:
		One problem you will have is finding IDB_ARROWUP and IDB_ARROWDOWN.
		Those bitmaps will be included with this set of classes, You should
		add them to your project or add your own bitmaps named correctly.
		These are the bitmaps that show the sort order on the header control.

        I hope this is simple enough, kind of a pain to get started but after
		that it should be cake and hopefully it will be useful.
  
  Things to be aware of:
		
		Multithreading:
		     If you delete all the items from another thread
			 in the middle of a sort, it will crash. This is the only
			 bug i have found.
		
		Column Widths:
			 
			MINCOLWIDTH - Minimum width a column can be.
			MAXCOLWIDTH - Maximum width a column can be.
			These are hard coded in the header file. Be aware.
			
			MAXCOLUMNS  - The most columns you can have right
			now is 64, that is only because im use __int64 to
			hold the column sort states. Who needs more than
			64 columns anyway? If you do, you can change it to
			CUIntArray, i just didnt see the need for a whole int
			when all i needed was a bit. 
		        

  Credits:
		
		Iuri Apollonio -- Sorting Class ( great class )
		Zafir Anjum    -- CMultiSortListCtrl::GetColumnCount
		Roger Onslow   -- CMultiSortListCtrl::AutoSizeColumns
		Zafir Anjum    -- CSortableHeaderCtrl::SetSortImage
		Me             -- The Rest, I think.

*/
// MultiColumnSortListView.cpp : implementation file
//

#include "stdafx.h"
#include "MultiSortListCtrl.h"
#include "SortClass.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMultiSortListCtrl

IMPLEMENT_DYNCREATE(CMultiSortListCtrl, CListCtrl)
/*
When deriving from this class you must set m_strUniqueName to something
this name is used to save each instances column widths to the registry
*/
CMultiSortListCtrl::CMultiSortListCtrl()
{	
	m_strUniqueName.Empty();
	m_strColumnWidthSection = "";
	m_bSorting = false;
	m_lColumnSortStates = 0;
	m_bCreate = false;
}

CMultiSortListCtrl::~CMultiSortListCtrl()
{
}


BEGIN_MESSAGE_MAP(CMultiSortListCtrl, CListCtrl)
	//{{AFX_MSG_MAP(CMultiSortListCtrl)
	ON_WM_CREATE()
	ON_WM_DESTROY()
	//}}AFX_MSG_MAP
	ON_NOTIFY(HDN_ITEMCLICKA, 0, OnHeaderClicked) 
	ON_NOTIFY(HDN_ITEMCLICKW, 0, OnHeaderClicked)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMultiSortListCtrl drawing

void CMultiSortListCtrl::OnDraw(CDC* pDC)
{
	//CDocument* pDoc = GetDocument();
}
/////////////////////////////////////////////////////////////////////////////
// CMultiSortListCtrl diagnostics
#ifdef _DEBUG
void CMultiSortListCtrl::AssertValid() const
{
	CListCtrl::AssertValid();
}
void CMultiSortListCtrl::Dump(CDumpContext& dc) const
{
	CListCtrl::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMultiSortListCtrl message handlers

/*
This function saves the columns widths of the listctrl to the registry.
This is called in two places, OnDestroy, and OnEndTrack in the headerCtrl class.
*/


/*
This function loads all the column widths for each column that was saved and applies the width
to the column. This function should be called when you are done inserting data. Or you 
can call SetColumnWidth to set the column width right after you InsertColumn(), If you call 
my InsertColumn it will do this for you.
*/


/*
This function is the heart of the class. This will get called automatically
when you click a header, and if you press control while clicking the header,
a multi column sort will take place (ie: sorting the current columns within all the
previously control+clicked columns). The multi column sort saves all the previosuly
control+clicked columns in an array and sorts them in reverse order. So if you click 
column 0, 2, 3, 5 while holding control, it will sort 5, 3, 2, 0. ( this acheives a
muli-column sort).
*/
void CMultiSortListCtrl::SortColumn( int iSubItem, BOOL bSortingMultipleColumns )
{	
	int iNumCombinedSortedCols = GetNumCombinedSortedColumns();
	m_bSorting = true;

	if( bSortingMultipleColumns )
	{
		if( NotInCombinedSortedColumnList( iSubItem ) )
			m_aCombinedSortedColumns[ iNumCombinedSortedCols++ ] = iSubItem;
		else
			MoveItemInCombinedSortedListToEnd( iSubItem );

		for( int i = iNumCombinedSortedCols - 1; i >= 0 ; i-- )
		{
			SORT_STATE ssEachItem = GetItemSortState( m_aCombinedSortedColumns[i] );
			if( iNumCombinedSortedCols - 1 != i )
				ssEachItem = (SORT_STATE)!ssEachItem;
			
			CSortClass csc(this, m_aCombinedSortedColumns[i], IsColumnNumeric( m_aCombinedSortedColumns[i] ) );	
			csc.Sort( ssEachItem );
			if( i == iNumCombinedSortedCols - 1 )
			{	//Only swap the last column's sort order.
				m_ctlHeaderCtrl.SetSortImage( m_aCombinedSortedColumns[i], ssEachItem );
				SetItemSortState( m_aCombinedSortedColumns[i] , (SORT_STATE)!ssEachItem );			
			}
		}
	}
	else
	{
		m_ctlHeaderCtrl.RemoveAllSortImages();
		EmptyArray(m_aCombinedSortedColumns);
		m_aCombinedSortedColumns[ 0 ] = iSubItem;
		SORT_STATE ssEachItem = GetItemSortState( iSubItem );
		
		CSortClass csc(this, iSubItem, IsColumnNumeric( iSubItem ) );	
		csc.Sort( ssEachItem );
		m_ctlHeaderCtrl.SetSortImage( iSubItem, ssEachItem );
		SetItemSortState( iSubItem , (SORT_STATE)!ssEachItem );
	}
	m_bSorting = false;
}

/*
My version of InsertColumn that will automatically load the last column
width from the registry. 
*/
int CMultiSortListCtrl::InsertColumn(int nCol, LPCTSTR lpszColumnHeading, int nFormat, int nWidth, int nSubItem)
{	
	CListCtrl::InsertColumn( nCol, lpszColumnHeading, nFormat, nWidth, nSubItem );
	//SetColumnWidth( nCol );
	return 1;
}

/*
Utility function to get rid of all the columns
*/
void CMultiSortListCtrl::DeleteAllColumns()
{
	int iNumCols = GetColumnCount();
	for ( int i = 0; i < iNumCols; i++ )
		CListCtrl::DeleteColumn(0);
}

/*
Utility function to get rid of all items.
*/
void CMultiSortListCtrl::DeleteAllItems()
{
	if( GetItemCount() > 0 )
		CListCtrl::DeleteAllItems();
}

/*
Utility function to get the number of columns
written by Zafir Anjum
*/
UINT CMultiSortListCtrl::GetColumnCount()
{
	CHeaderCtrl *pHeaderCtrl = (CHeaderCtrl*)GetDlgItem(0);
	return pHeaderCtrl->GetItemCount();
}

/*
Just add some extended styles from the new IE4 stuff.
Of course you can either change the code or change your
derived class's OnCreate to call CListCtrl::OnCreate
*/
int CMultiSortListCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CListCtrl::OnCreate(lpCreateStruct) == -1)
		return -1;
	// set list control's style to hilight the entire row
	DWORD dwStyle = SendMessage(LVM_GETEXTENDEDLISTVIEWSTYLE);
	dwStyle |= LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_HEADERDRAGDROP;
	SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, (LPARAM)dwStyle);
	m_ctlHeaderCtrl.SubclassWindow( GetDlgItem(0)->m_hWnd );		

	return 0;
}

/*
We are only sorting in report view so far.
*/
BOOL CMultiSortListCtrl::PreCreateWindow(CREATESTRUCT& cs) 
{
	cs.style |= LVS_REPORT;
	return CListCtrl::PreCreateWindow(cs);
}

/*
Utility function to tell you if a sort is taking place
*/
const BOOL CMultiSortListCtrl::IsSorting() const
{
	return CMultiSortListCtrl::m_bSorting;
}

/*
Utility function to tell you if the control key is being pressed
*/
const int CMultiSortListCtrl::IsControlPressed() const
{
	return (::GetKeyState( VK_CONTROL ) < 0 );
}

/*
Message handler for when a header is clicked.
*/
void CMultiSortListCtrl::OnHeaderClicked(NMHDR* pNMHDR, LRESULT* pResult) 
{
	if(!m_bCreate)
	{
		DWORD dwStyle = SendMessage(LVM_GETEXTENDEDLISTVIEWSTYLE);
		dwStyle |= LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP;
		SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, (LPARAM)dwStyle);
		m_ctlHeaderCtrl.SubclassWindow( GetDlgItem(0)->m_hWnd );		
		m_bCreate = true;
	}
	HD_NOTIFY *pHDN = (HD_NOTIFY *) pNMHDR;
	if( pHDN->iButton == 0 )
	{
		if( IsControlPressed() )
			SortColumn( pHDN->iItem, MULTI_COLUMN_SORT );
		else
			SortColumn( pHDN->iItem, SINGLE_COLUMN_SORT );
	}
	*pResult = 0;
}

/*
Message handler for when control is about to be destroyed.
This is where the column widths are saved.
*/
void CMultiSortListCtrl::OnDestroy() 
{
	//SaveColumnWidths();	
	CListCtrl::OnDestroy();
}

/*
Utility function to tell you if a column is in the combined sorted list.
*/
BOOL CMultiSortListCtrl::NotInCombinedSortedColumnList(int iItem) const
{
	int iNumCombinedSortedColumns = GetNumCombinedSortedColumns();
	for( int i = 0; i < iNumCombinedSortedColumns; i++ )
	{
		if( m_aCombinedSortedColumns[i] == iItem )
			return false;
	}
	return true;
}

/*
Utility function to get you the sort state of a column
*/
const SORT_STATE CMultiSortListCtrl::GetItemSortState( int iItem ) const
{
	return (SORT_STATE)((m_lColumnSortStates) & ( 1 << iItem ));
}

/*
Utility function to set the sort state of a column
*/
void CMultiSortListCtrl::SetItemSortState(int iItem, SORT_STATE bSortState)
{
	if( bSortState != GetItemSortState( iItem ) )
		m_lColumnSortStates ^= (1 << iItem);
}

/*
Utility function to get you the number of combined sorted columns
*/
const int CMultiSortListCtrl::GetNumCombinedSortedColumns() const
{
	for( int i = 0; i < MAX_COLUMNS; i++ )
		if( m_aCombinedSortedColumns[i] == -1 )
			return i;
	return MAX_COLUMNS;
}

/*
Utility function clear some internal arrays
*/
void CMultiSortListCtrl::EmptyArray( int *pArray )
{
	memset( pArray, -1, MAX_COLUMNS );
}

/*
This function will move a clicked column to the end of the combined
column list. This is useful when you move backwards through column clicks.
Like click columns: 0, 1, 2, 1. The array will hold [0,1,2] after the first 3
clicks, this function will change it to [0,2,1] after the 4th click.
*/
void CMultiSortListCtrl::MoveItemInCombinedSortedListToEnd(int iItem)
{
	int iNumCombinedSortedColumns = GetNumCombinedSortedColumns();
	int aCombinedSortedColumns[MAX_COLUMNS];
	memset( aCombinedSortedColumns, -1, MAX_COLUMNS );
	int iItemIndex = FindItemInCombedSortedList( iItem );
	if( iItemIndex != -1 )
	{
		if( iItemIndex > 0 )
		{
			memcpy( aCombinedSortedColumns, m_aCombinedSortedColumns, iItemIndex * sizeof( int ) );
			memcpy( &aCombinedSortedColumns[iItemIndex], &m_aCombinedSortedColumns[iItemIndex + 1], (iNumCombinedSortedColumns - iItemIndex - 1) * sizeof(int) );
		}
	}
	aCombinedSortedColumns[ iNumCombinedSortedColumns - 1 ] = iItem;
	memcpy( m_aCombinedSortedColumns, aCombinedSortedColumns, MAX_COLUMNS * sizeof(int) );
	for( int i = 0; i < MAX_COLUMNS ; i++ )
	{
		if( aCombinedSortedColumns[i] == -1 )
			break;
	}
}

/*
Utility function to find an item in the combined sorted list.
*/
int CMultiSortListCtrl::FindItemInCombedSortedList( int iItem )
{
	int iNumCombinedSortedColumns = GetNumCombinedSortedColumns();
	for( int i = 0; i < iNumCombinedSortedColumns; i++ )
	{
		if(m_aCombinedSortedColumns[i] == iItem )
			return i;
	}
	return -1;
}


/*
Utility function to set a column that will contain only numeric values.
Speeds up the sorting if this is set on the right columns.
*/
void CMultiSortListCtrl::SetColumnNumeric( int iCol )
{
	m_aNumericColumns.Add( iCol );
}

/*
Utility function to tell you if the given column is set as numeric.
*/
const BOOL CMultiSortListCtrl::IsColumnNumeric( int iCol ) const
{
	for( int i = 0; i < m_aNumericColumns.GetSize(); i++ )
	{	
		if( m_aNumericColumns.GetAt( i ) == (UINT)iCol )
			return true;
	}
	return false;
}

/*
Utility function to remove the numeric status of a column
*/
void CMultiSortListCtrl::UnsetColumnNumeric(int iCol)
{
	int iIndex = FindNumericColumnIndex( iCol );
	if( iIndex >= 0 )
		m_aNumericColumns.RemoveAt( iIndex );
}

/*
Utility function to find a numeric column in the array.
*/
int CMultiSortListCtrl::FindNumericColumnIndex( int iCol )
{
	for( int i = 0; i < m_aNumericColumns.GetSize(); i++ )
	{	
		if( m_aNumericColumns.GetAt( i ) == (UINT)iCol )
			return i;
	}
	return -1;
}

void CMultiSortListCtrl::SetUniqueName(LPCTSTR lpszUniqueName)
{
	m_strUniqueName = lpszUniqueName;
}

BOOL CMultiSortListCtrl::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) 
{
	
	return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国免费一区二区三区| 成人av在线网| 国产综合一区二区| 99精品欧美一区二区蜜桃免费 | 国产精品久久久久国产精品日日| 一区二区在线观看视频| 黄一区二区三区| 欧美日韩国产小视频在线观看| 国产精品女同一区二区三区| 久久91精品久久久久久秒播 | 国产乱码字幕精品高清av| 欧美丝袜丝nylons| 国产精品电影院| 国产成人综合精品三级| 日韩免费在线观看| 日韩精品电影一区亚洲| 欧洲在线/亚洲| 亚洲精品乱码久久久久久黑人| 国产99久久久精品| 久久嫩草精品久久久精品一| 男人的天堂亚洲一区| 欧美人狂配大交3d怪物一区| 亚洲激情图片qvod| 91色|porny| 最新高清无码专区| 成人av在线资源网站| 欧美国产日韩a欧美在线观看 | 午夜在线电影亚洲一区| 色综合天天综合网天天狠天天| 国产亚洲午夜高清国产拍精品| 久久精品国产精品亚洲综合| 欧美一区二区三区视频免费播放 | 91福利视频网站| 亚洲精品视频在线观看网站| 91香蕉视频mp4| 亚洲精品五月天| 欧美视频你懂的| 天天综合网天天综合色| 欧美精三区欧美精三区| 日韩高清一级片| 精品卡一卡二卡三卡四在线| 国产在线播放一区二区三区| 久久蜜桃一区二区| 国产91清纯白嫩初高中在线观看| 国产区在线观看成人精品| 成人毛片在线观看| 亚洲色图在线视频| 欧美三区在线视频| 秋霞影院一区二区| 337p日本欧洲亚洲大胆精品| 成人性生交大合| 亚洲欧美一区二区三区久本道91| 在线亚洲+欧美+日本专区| 亚洲成人久久影院| 欧美tickling网站挠脚心| 国产91综合网| 亚洲一区二区三区四区在线| 欧美一区二区在线播放| 国产精品77777竹菊影视小说| 国产精品国产三级国产a| 欧美自拍偷拍午夜视频| 毛片av一区二区| 中文字幕免费观看一区| 欧美亚洲动漫制服丝袜| 伦理电影国产精品| 日韩伦理电影网| 欧美一二三区在线| av午夜精品一区二区三区| 午夜精品一区二区三区三上悠亚| 精品国产在天天线2019| 91浏览器打开| 国产一区二区在线视频| 亚洲综合色成人| 国产亚洲女人久久久久毛片| 欧美亚洲自拍偷拍| 国产一区二区网址| 午夜精品福利一区二区三区av| 久久蜜桃av一区精品变态类天堂 | 国产精品美女久久久久av爽李琼 | 精品国产1区二区| 日本电影亚洲天堂一区| 国产麻豆一精品一av一免费 | 国产精品色在线| 3atv在线一区二区三区| 97精品国产露脸对白| 精品在线一区二区三区| 亚洲午夜精品在线| 中文字幕国产一区二区| 日韩一区二区不卡| 欧美色网站导航| 成人av先锋影音| 国产一区欧美一区| 日日夜夜精品免费视频| 亚洲人吸女人奶水| 中文av一区二区| 精品粉嫩超白一线天av| 91精品国产综合久久精品图片 | 欧美绝品在线观看成人午夜影视| 成人avav影音| 国产成人精品亚洲777人妖| 天天影视涩香欲综合网| 亚洲最快最全在线视频| 国产精品国模大尺度视频| 久久综合九色欧美综合狠狠 | 色偷偷久久一区二区三区| 国产宾馆实践打屁股91| 国产精品自拍在线| 激情综合网激情| 极品少妇xxxx偷拍精品少妇| 热久久免费视频| 老司机午夜精品| 蜜臀av性久久久久av蜜臀妖精| 亚洲444eee在线观看| 午夜欧美电影在线观看| 午夜精品久久久久久久99水蜜桃| 亚洲一区二区五区| 亚洲国产美国国产综合一区二区| 一区二区三区四区激情 | 成人午夜av在线| 国产成人精品一区二| 成人午夜在线免费| 波多野结衣精品在线| av毛片久久久久**hd| 99精品视频中文字幕| 91激情五月电影| 欧美日本在线播放| 日韩一级片在线观看| 亚洲精品一区二区三区四区高清 | 狠狠色丁香婷综合久久| 国产一区二区三区最好精华液| 国产精品中文字幕一区二区三区| 国产乱码精品一区二区三区av | 三级欧美在线一区| 日本女优在线视频一区二区| 极品少妇xxxx精品少妇| 大白屁股一区二区视频| 色综合天天视频在线观看| 欧美性猛交xxxxxx富婆| 日韩三级免费观看| 国产亚洲综合av| 亚洲黄一区二区三区| 日韩av网站在线观看| 狠狠网亚洲精品| 一本在线高清不卡dvd| 制服丝袜一区二区三区| 久久久综合九色合综国产精品| 国产精品国产三级国产aⅴ入口| 亚洲尤物在线视频观看| 久久国产人妖系列| 91免费版在线看| 欧美成人a∨高清免费观看| 国产偷v国产偷v亚洲高清| 国产精品原创巨作av| 色88888久久久久久影院野外 | 欧美视频自拍偷拍| 亚洲精品在线观| 亚洲一级片在线观看| 国产精品一区二区男女羞羞无遮挡| 色婷婷久久一区二区三区麻豆| 日韩精品在线看片z| 亚洲精品亚洲人成人网| 国产在线精品视频| 欧美日韩激情一区二区| 日本一区二区在线不卡| 天天综合天天综合色| 91在线丨porny丨国产| 精品国产人成亚洲区| 亚洲国产精品一区二区久久| 国产馆精品极品| 91精品在线一区二区| 亚洲色图.com| 懂色av一区二区夜夜嗨| 日韩美女视频在线| 亚洲一区二区三区四区在线观看| 成人午夜碰碰视频| 欧美电视剧在线看免费| 午夜视黄欧洲亚洲| 91亚洲国产成人精品一区二三| 亚洲精品一区二区三区影院 | 在线播放视频一区| 综合在线观看色| 成人免费不卡视频| 国产日韩欧美在线一区| 精品在线一区二区| 911精品国产一区二区在线| 亚洲欧美精品午睡沙发| 国产成人久久精品77777最新版本| 日韩免费视频一区| 视频一区视频二区中文字幕| 91国产免费看| 一个色在线综合| 91久久精品日日躁夜夜躁欧美| 国产欧美日韩在线视频| 国产精品亚洲一区二区三区妖精 | 中文字幕第一区| 国产成人精品免费网站| 欧美经典三级视频一区二区三区| 国产乱理伦片在线观看夜一区| 久久午夜老司机| 国产91精品入口|