Completed sorting in wxDataViewCtrl

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47552 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2007-07-18 18:46:28 +00:00
parent 01cd7f7575
commit 0be79c8a80
2 changed files with 103 additions and 31 deletions

View File

@@ -162,7 +162,26 @@ int wxDataViewModel::Compare( const wxDataViewItem &item1, const wxDataViewItem
{
wxString str1 = value1.GetString();
wxString str2 = value2.GetString();
return str1.Cmp( str2 );
int res = str1.Cmp( str2 );
if (res == 0)
{
// no difference, try 0th column
if (m_sortingColumn != 0)
{
unsigned int temp = m_sortingColumn;
m_sortingColumn = 0;
res = Compare( item1, item2 );
m_sortingColumn = temp;
}
if (res == 0)
{
// still no difference, resort to desparate non-sense
long l1 = (long) item1.GetID();
long l2 = (long) item2.GetID();
return l1-l2;
}
}
return res;
}
if (value1.GetType() == wxT("long"))
{
@@ -186,6 +205,8 @@ int wxDataViewModel::Compare( const wxDataViewItem &item1, const wxDataViewItem
if (dt1.IsEarlierThan(dt2)) return 1;
return -1;
}
return 0;
}