Add GetUpdatedAscendingSortIndicator() helper function
It seems like this function will need to be used in every implementation of EVT_LIST_COL_CLICK handler when using sorting, so it makes sense to provide it in the library itself.
This commit is contained in:
@@ -1089,15 +1089,8 @@ void MyListCtrl::OnColClick(wxListEvent& event)
|
||||
return; // clicked outside any column.
|
||||
}
|
||||
|
||||
// If clicking on the same column by which we already sort, toggle the sort
|
||||
// direction, otherwise use ascending sort by default.
|
||||
bool ascending;
|
||||
if ( col == GetSortIndicator() )
|
||||
ascending = !IsAscendingSortIndicator();
|
||||
else
|
||||
ascending = true;
|
||||
|
||||
// sort on item data (SetItemData)
|
||||
const bool ascending = GetUpdatedAscendingSortIndicator(col);
|
||||
if ( SortItems(MyCompareFunction, ascending) )
|
||||
{
|
||||
ShowSortIndicator(col, ascending);
|
||||
|
||||
Reference in New Issue
Block a user