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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user