X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e1843000400eabbb7d0ba7bf80d5439f53694fd..dc36b43adf22c24d5f30ad7b7021bf9da4ce0d81:/src/osx/cocoa/dataview.mm diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm index f8f8c38b02..29d412a26b 100644 --- a/src/osx/cocoa/dataview.mm +++ b/src/osx/cocoa/dataview.mm @@ -2069,6 +2069,22 @@ bool wxCocoaDataViewControl::AssociateModel(wxDataViewModel* model) // // selection related methods (inherited from wxDataViewWidgetImpl) // + +wxDataViewItem wxCocoaDataViewControl::GetCurrentItem() const +{ + return wxDataViewItem([[m_OutlineView itemAtRow:[m_OutlineView selectedRow]] pointer]); +} + +void wxCocoaDataViewControl::SetCurrentItem(const wxDataViewItem& item) +{ + // We can't have unselected current item in a NSTableView, as the + // documentation of its deselectRow method explains, the control will + // automatically change the current item to the closest still selected item + // if the current item is deselected. So we have no choice but to select + // the item in the same time as making it current. + Select(item); +} + int wxCocoaDataViewControl::GetSelections(wxDataViewItemArray& sel) const { NSIndexSet* selectedRowIndexes([m_OutlineView selectedRowIndexes]); @@ -2960,7 +2976,12 @@ void wxDataViewColumn::SetResizeable(bool resizeable) void wxDataViewColumn::SetSortable(bool sortable) { - wxDataViewColumnBase::SetSortable(sortable); + // wxDataViewColumnBase::SetSortable(sortable); + // Avoid endless recursion and just set the flag here + if (sortable) + m_flags |= wxDATAVIEW_COL_SORTABLE; + else + m_flags &= ~wxDATAVIEW_COL_SORTABLE; } void wxDataViewColumn::SetSortOrder(bool ascending)