Let wxListCtrl::ShowSortIndicator() implicitly enable indicators

It doesn't seem right for ShowSortIndicator() to silently do nothing if
EnableSortIndicator() hadn't been called before, so make it enable the
sort indicators if they hadn't been enabled yet.

The alternative would be to assert in this function, but this seems less
useful.

Also add some comments to wxMSW version.
This commit is contained in:
Vadim Zeitlin
2021-12-13 14:31:49 +00:00
parent c287840faa
commit 30ce892ed5
4 changed files with 34 additions and 7 deletions

View File

@@ -426,6 +426,11 @@ protected:
int m_colCount; // Windows doesn't have GetColumnCount so must
// keep track of inserted/deleted columns
// m_sortCol and m_sortAsc are used only if m_enableSortCol is true.
//
// Note that m_sortCol may be set to -1, but this is not the same as
// setting m_enableSortCol to false, as the control updates the sort
// indicator on column click in the former case, but not in the latter.
bool m_enableSortCol;
bool m_sortAsc;
int m_sortCol;
@@ -457,7 +462,8 @@ private:
// in-place editor control.
void OnCharHook(wxKeyEvent& event);
// Draw the sort arrow arror in the header.
// Draw the sort arrow in the header. Should only be called when sort
// indicators are enabled.
void DrawSortArrow();
// Object using for header custom drawing if necessary, may be NULL.