(root)//common/listviewsorter.h – Rev 1
Details |
Last modification |
View Log
| RSS feed
| Rev |
Author |
Line No. |
Line |
| 1 |
cycrow |
1 |
#pragma once
|
|
|
2 |
|
|
|
3 |
using namespace System;
|
|
|
4 |
using namespace System::Collections;
|
|
|
5 |
using namespace System::Windows::Forms;
|
|
|
6 |
|
|
|
7 |
ref class ListViewItemComparer : IComparer {
|
|
|
8 |
private:
|
|
|
9 |
int col;
|
|
|
10 |
bool reverse;
|
|
|
11 |
|
|
|
12 |
public:
|
|
|
13 |
ListViewItemComparer() {
|
|
|
14 |
col=0;
|
|
|
15 |
reverse = false;
|
|
|
16 |
}
|
|
|
17 |
ListViewItemComparer(int column, bool rev)
|
|
|
18 |
{
|
|
|
19 |
reverse = rev;
|
|
|
20 |
col=column;
|
|
|
21 |
}
|
|
|
22 |
virtual int Compare(System::Object ^x, System::Object ^y)
|
|
|
23 |
{
|
|
|
24 |
int returnVal = -1;
|
|
|
25 |
if ( reverse )
|
|
|
26 |
returnVal = String::Compare(((ListViewItem ^)y)->SubItems[col]->Text, ((ListViewItem ^)x)->SubItems[col]->Text);
|
|
|
27 |
else
|
|
|
28 |
returnVal = String::Compare(((ListViewItem ^)x)->SubItems[col]->Text, ((ListViewItem ^)y)->SubItems[col]->Text);
|
|
|
29 |
return returnVal;
|
|
|
30 |
}
|
|
|
31 |
};
|