don't duplicate the column reordering in generic wxHeaderCtrl and wxGrid, extract it into a (public) helper function

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57264 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-12-11 22:27:02 +00:00
parent 3169a8e837
commit 1bb7462687
5 changed files with 63 additions and 46 deletions

View File

@@ -473,28 +473,7 @@ wxArrayInt wxHeaderCtrl::DoGetColumnsOrder() const
void wxHeaderCtrl::DoMoveCol(unsigned int idx, unsigned int pos)
{
const unsigned count = m_colIndices.size();
wxArrayInt colIndices;
colIndices.reserve(count);
for ( unsigned n = 0; n < count; n++ )
{
// NB: order of checks is important for this to work when the new
// column position is the same as the old one
// insert the column at its new position
if ( colIndices.size() == pos )
colIndices.push_back(idx);
// delete the column from its old position
const unsigned idxOld = m_colIndices[n];
if ( idxOld == idx )
continue;
colIndices.push_back(idxOld);
}
m_colIndices = colIndices;
MoveColumnInOrderArray(m_colIndices, idx, pos);
Refresh();
}