Update wxDataViewColumn when sort order changes under macOS

The value returned by wxDataViewColumn::IsSortOrderAscending() wasn't
updated when the sort order changed due to the user clicking on a column
and reversing the sort order.

Fix this now by explicitly calling SetSortOrderVariable() when this
happens.

Closes https://github.com/wxWidgets/wxWidgets/pull/901
This commit is contained in:
Hartwig 2018-08-27 21:07:11 +02:00 committed by Vadim Zeitlin
parent b38813a5e9
commit 3591756166

View File

@ -652,9 +652,12 @@ outlineView:(NSOutlineView*)outlineView
for (NSUInteger i=0; i<noOfDescriptors; ++i) for (NSUInteger i=0; i<noOfDescriptors; ++i)
{ {
NSSortDescriptor* const newDescriptor = [newDescriptors objectAtIndex:i]; NSSortDescriptor* const newDescriptor = [newDescriptors objectAtIndex:i];
wxDataViewColumn* const sortingColumn = dvc->GetColumn([[newDescriptor key] intValue]);
sortingColumn->SetSortOrderVariable([newDescriptor ascending]);
[wxSortDescriptors addObject:[[[wxSortDescriptorObject alloc] initWithModelPtr:model [wxSortDescriptors addObject:[[[wxSortDescriptorObject alloc] initWithModelPtr:model
sortingColumnPtr:dvc->GetColumn([[newDescriptor key] intValue]) sortingColumnPtr:sortingColumn
ascending:[newDescriptor ascending]] autorelease]]; ascending:[newDescriptor ascending]] autorelease]];
} }
[(wxCocoaOutlineDataSource*)[outlineView dataSource] setSortDescriptors:wxSortDescriptors]; [(wxCocoaOutlineDataSource*)[outlineView dataSource] setSortDescriptors:wxSortDescriptors];