The two member functions, SetAsSortKey() and SetSortOrder(), were doing almost
the same thing but differently and the former was only used in the generic
wxDataViewCtrl implementation and not implemented in the native GTK/OS X one.
Remove SetAsSortKey() entirely and only keep UnsetAsSortKey() which is still
needed by generic/MSW wxDataViewCtrl. But only SetSortOrder() should now be
called to indicate that the column is used for sorting.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69174
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
virtual void SetFlags(int flags) { m_flags = flags; UpdateDisplay(); }
virtual int GetFlags() const { return m_flags; }
virtual void SetFlags(int flags) { m_flags = flags; UpdateDisplay(); }
virtual int GetFlags() const { return m_flags; }
- virtual void SetAsSortKey(bool sort = true) { m_sort = sort; UpdateDisplay(); }
virtual bool IsSortKey() const { return m_sort; }
virtual bool IsSortKey() const { return m_sort; }
- virtual void SetSortOrder(bool ascending) { m_sortAscending = ascending; UpdateDisplay(); }
+ virtual void UnsetAsSortKey() { m_sort = false; UpdateDisplay(); }
+
+ virtual void SetSortOrder(bool ascending)
+ {
+ m_sort = true;
+ m_sortAscending = ascending;
+ UpdateDisplay();
+ }
+
virtual bool IsSortOrderAscending() const { return m_sortAscending; }
virtual void SetBitmap( const wxBitmap& bitmap ) { wxDataViewColumnBase::SetBitmap(bitmap); UpdateDisplay(); }
virtual bool IsSortOrderAscending() const { return m_sortAscending; }
virtual void SetBitmap( const wxBitmap& bitmap ) { wxDataViewColumnBase::SetBitmap(bitmap); UpdateDisplay(); }
virtual void SetSortable( bool sortable );
virtual void SetSortOrder( bool ascending );
virtual void SetSortable( bool sortable );
virtual void SetSortOrder( bool ascending );
- virtual void SetAsSortKey(bool sort = true);
virtual void SetResizeable( bool resizable );
virtual void SetHidden( bool hidden );
virtual void SetResizeable( bool resizable );
virtual void SetHidden( bool hidden );
virtual void SetHidden(bool hidden)
{ ChangeFlag(wxCOL_HIDDEN, hidden); }
virtual void SetHidden(bool hidden)
{ ChangeFlag(wxCOL_HIDDEN, hidden); }
- virtual void SetAsSortKey(bool sort = true) = 0;
- void UnsetAsSortKey() { SetAsSortKey(false); }
+ // This function can be called to indicate that this column is not used for
+ // sorting any more. Under some platforms it's not necessary to do anything
+ // in this case as just setting another column as a sort key takes care of
+ // everything but under MSW we currently need to call this explicitly to
+ // reset the sort indicator displayed on the column.
+ virtual void UnsetAsSortKey() { }
virtual void SetSortOrder(bool ascending) = 0;
void ToggleSortOrder() { SetSortOrder(!IsSortOrderAscending()); }
virtual void SetSortOrder(bool ascending) = 0;
void ToggleSortOrder() { SetSortOrder(!IsSortOrderAscending()); }
virtual void SetFlags(int flags) { m_flags = flags; }
virtual int GetFlags() const { return m_flags; }
virtual void SetFlags(int flags) { m_flags = flags; }
virtual int GetFlags() const { return m_flags; }
- virtual void SetAsSortKey(bool sort = true) { m_sort = sort; }
virtual bool IsSortKey() const { return m_sort; }
virtual bool IsSortKey() const { return m_sort; }
+ virtual void UnsetAsSortKey() { m_sort = false; }
+
+ virtual void SetSortOrder(bool ascending)
+ {
+ m_sort = true;
+ m_sortAscending = ascending;
+ }
- virtual void SetSortOrder(bool ascending) { m_sortAscending = ascending; }
virtual bool IsSortOrderAscending() const { return m_sortAscending; }
private:
virtual bool IsSortOrderAscending() const { return m_sortAscending; }
private:
virtual void SetSortOrder (bool ascending);
virtual void SetTitle (wxString const& title);
virtual void SetWidth (int width);
virtual void SetSortOrder (bool ascending);
virtual void SetTitle (wxString const& title);
virtual void SetWidth (int width);
- virtual void SetAsSortKey (bool sort = true);
// implementation only
wxDataViewColumnNativeData* GetNativeData() const
// implementation only
wxDataViewColumnNativeData* GetNativeData() const
virtual void SetHidden(bool hidden);
virtual void SetHidden(bool hidden);
- /**
- Sets this column as the sort key for the associated control.
-
- Calling this function with @true argument means that this column is
- currently used for sorting the control contents and so should typically
- display an arrow indicating it (the direction of the arrow depends on
- IsSortOrderAscending() return value).
-
- Don't confuse this function with SetSortable() which should be used to
- indicate that the column @em may be used for sorting while this one is
- used to indicate that it currently @em is used for sorting. Of course,
- SetAsSortKey() can be only called for sortable columns.
-
- @param sort
- Sort (default) or don't sort the control contents by this column.
- */
- virtual void SetAsSortKey(bool sort = true) = 0;
-
/**
Don't use this column for sorting.
/**
Don't use this column for sorting.
- This is equivalent to calling SetAsSortKey() with @false argument.
+ This is the reverse of SetSortOrder() and is called to indicate that
+ this column is not used for sorting any longer.
*/
void UnsetAsSortKey();
/**
*/
void UnsetAsSortKey();
/**
- Sets the sort order for this column.
+ Sets this column as the sort key for the associated control.
+
+ This function indicates that this column is currently used for sorting
+ the control and also sets the sorting direction. Notice that actual
+ sorting is only done in the control associated with the header, this
+ function doesn't do any sorting on its own.
- This only makes sense for sortable columns which are currently used as
- sort key, i.e. for which IsSortKey() returns @true and is only taken
- into account by the control in which this column is inserted, this
- function just stores the sort order in the wxHeaderColumn object.
+ Don't confuse this function with SetSortable() which should be used to
+ indicate that the column @em may be used for sorting while this one is
+ used to indicate that it currently @em is used for sorting. Of course,
+ SetSortOrder() can be only called for sortable columns.
@param ascending
If @true, sort in ascending order, otherwise in descending order.
@param ascending
If @true, sort in ascending order, otherwise in descending order.
virtual wxAlignment GetAlignment() const;
virtual void SetFlags(int flags);
virtual int GetFlags() const;
virtual wxAlignment GetAlignment() const;
virtual void SetFlags(int flags);
virtual int GetFlags() const;
- virtual void SetAsSortKey(bool sort = true);
virtual bool IsSortKey() const;
virtual void SetSortOrder(bool ascending);
virtual bool IsSortOrderAscending() const;
virtual bool IsSortKey() const;
virtual void SetSortOrder(bool ascending);
virtual bool IsSortOrderAscending() const;
- m_cols[idx].SetAsSortKey(ascending);
+ m_cols[idx].SetSortOrder(ascending);
m_sortKey = idx;
UpdateColumn(idx);
m_sortKey = idx;
UpdateColumn(idx);
}
owner->SetSortingColumnIndex(idx);
}
owner->SetSortingColumnIndex(idx);
+ col->SetSortOrder(true);
}
wxDataViewModel * const model = owner->GetModel();
}
wxDataViewModel * const model = owner->GetModel();
return gtk_tree_view_column_get_clickable( column );
}
return gtk_tree_view_column_get_clickable( column );
}
-void wxDataViewColumn::SetAsSortKey( bool WXUNUSED(sort) )
-{
- // it might not make sense to have this function in wxHeaderColumn at
- // all in fact, changing of the sort order should only be done using the
- // associated control API
- wxFAIL_MSG( "not implemented" );
-}
-
bool wxDataViewColumn::IsSortKey() const
{
GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN(m_column);
bool wxDataViewColumn::IsSortKey() const
{
GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN(m_column);
-void wxDataViewColumn::SetAsSortKey(bool WXUNUSED(sort))
-{
- // see wxGTK native wxDataViewColumn implementation
- wxFAIL_MSG( "not implemented" );
-}
-
void wxDataViewColumn::SetNativeData(wxDataViewColumnNativeData* newNativeDataPtr)
{
delete m_NativeDataPtr;
void wxDataViewColumn::SetNativeData(wxDataViewColumnNativeData* newNativeDataPtr)
{
delete m_NativeDataPtr;
-void wxDataViewColumn::SetAsSortKey(bool WXUNUSED(sort))
-{
- // see wxGTK native wxDataViewColumn implementation
- wxFAIL_MSG("not implemented");
-}
-
void wxDataViewColumn::SetNativeData(wxDataViewColumnNativeData* newNativeDataPtr)
{
delete m_NativeDataPtr;
void wxDataViewColumn::SetNativeData(wxDataViewColumnNativeData* newNativeDataPtr)
{
delete m_NativeDataPtr;