Add support for sorting by more than one column to generic wxDataViewCtrl.

Maintain a list of columns used for sorting instead of a single sort column
index and allow to add/remove columns to/from it interactively by right
clicking them if AllowMultiColumnSort() was used.

See https://github.com/wxWidgets/wxWidgets/pull/3

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75806 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-02-05 22:12:53 +00:00
parent 4cbb78cf7d
commit 5e6d30aa0b
6 changed files with 299 additions and 25 deletions

View File

@@ -645,6 +645,25 @@ public:
{ return m_expander_column; }
virtual wxDataViewColumn *GetSortingColumn() const = 0;
virtual wxVector<wxDataViewColumn *> GetSortingColumns() const
{
wxVector<wxDataViewColumn *> columns;
if ( wxDataViewColumn* col = GetSortingColumn() )
columns.push_back(col);
return columns;
}
// This must be overridden to return true if the control does allow sorting
// by more than one column, which is not the case by default.
virtual bool AllowMultiColumnSort(bool allow)
{
// We can still return true when disabling multi-column sort.
return !allow;
}
// This should also be overridden to actually use the specified column for
// sorting if using multiple columns is supported.
virtual void ToggleSortByColumn(int WXUNUSED(column)) { }
// items management