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:
parent
0a8e82b010
commit
c834c0b8b7
3 changed files with 32 additions and 8 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue