no changes, just refactoring: extracted the code to update the column indices array when the number of columns changes to the common code to be able to reuse it from the MSW version

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57340 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-12-14 21:56:38 +00:00
parent 4797b0145c
commit f665539195
3 changed files with 44 additions and 27 deletions

View File

@@ -92,33 +92,8 @@ wxHeaderCtrl::~wxHeaderCtrl()
void wxHeaderCtrl::DoSetCount(unsigned int count)
{
// update the column indices array if necessary
if ( count > m_numColumns )
{
// all new columns have default positions equal to their indices
for ( unsigned n = m_numColumns; n < count; n++ )
m_colIndices.push_back(n);
}
else if ( count < m_numColumns )
{
// filter out all the positions which are invalid now while keeping the
// order of the remaining ones
wxArrayInt colIndices;
for ( unsigned n = 0; n < m_numColumns; n++ )
{
const unsigned idx = m_colIndices[n];
if ( idx < count )
colIndices.push_back(idx);
}
wxASSERT_MSG( colIndices.size() == count, "logic error" );
m_colIndices = colIndices;
}
else // count didn't really change
{
return;
}
// update the column indices order array before changing m_numColumns
DoResizeColumnIndices(m_colIndices, count);
m_numColumns = count;