mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-26 22:03:35 -06:00
Merge continued
git-svn-id: svn://ultimatepp.org/upp/trunk@10263 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
adf46bd64e
commit
2e4b276e07
3860 changed files with 1161787 additions and 438 deletions
43
uppdev/ArrayCtrlSort/main.cpp
Normal file
43
uppdev/ArrayCtrlSort/main.cpp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#include "ArrayCtrlSort.h"
|
||||
|
||||
class ArrayCtrlSort : public TopWindow {
|
||||
ArrayCtrl a;
|
||||
EditDouble ed1, ed2;
|
||||
|
||||
bool SortTest(int i1, int i2)
|
||||
{
|
||||
return a.Get(i1, 0) > a.Get(i2, 0);
|
||||
}
|
||||
|
||||
public:
|
||||
typedef ArrayCtrlSort CLASSNAME;
|
||||
ArrayCtrlSort();
|
||||
};
|
||||
|
||||
struct CvSum : public Convert {
|
||||
virtual Value Format(const Value& q) const {
|
||||
ValueArray va = q;
|
||||
return (int)va[0] + (int)va[1];
|
||||
}
|
||||
};
|
||||
|
||||
ArrayCtrlSort::ArrayCtrlSort()
|
||||
{
|
||||
a.AddColumn("first", "First").Edit(ed1).Sorting();
|
||||
a.AddColumn("second", "Second").Edit(ed2);
|
||||
a.AddColumnAt("first", "Format").Add("second").SetFormat("%d + %d = ").Sorting();
|
||||
a.AddColumnAt("first", "Sum")
|
||||
.Add("second")
|
||||
.SetConvert(Single<CvSum>());
|
||||
for(int i = 0; i < 100; i++)
|
||||
a.Add(rand() % 20, rand() % 10);
|
||||
Add(a.SizePos());
|
||||
// a.ColumnSort(3, StdValueOrder());
|
||||
|
||||
a.Sort(10, 40, THISBACK(SortTest));
|
||||
}
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
ArrayCtrlSort().Run();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue