remove the item from proportions arrays as well as from m_growableCols/Rows in wxFlexGridSizer::RemoveGrowableCol/Row(); also added an assert in case the item to remove is not growable

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39834 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-06-26 00:11:59 +00:00
parent f5a9eef7c7
commit ca243008b3

View File

@@ -1481,20 +1481,38 @@ void wxFlexGridSizer::AddGrowableRow( size_t idx, int proportion )
m_growableRowsProportions.Add( proportion );
}
void wxFlexGridSizer::RemoveGrowableRow( size_t idx )
{
m_growableRows.Remove( idx );
}
void wxFlexGridSizer::AddGrowableCol( size_t idx, int proportion )
{
m_growableCols.Add( idx );
m_growableColsProportions.Add( proportion );
}
// helper function for RemoveGrowableCol/Row()
static void
DoRemoveFromArrays(size_t idx, wxArrayInt& items, wxArrayInt& proportions)
{
const size_t count = items.size();
for ( size_t n = 0; n < count; n++ )
{
if ( (size_t)items[n] == idx )
{
items.RemoveAt(n);
proportions.RemoveAt(n);
return;
}
}
wxFAIL_MSG( _T("column/row is already not growable") );
}
void wxFlexGridSizer::RemoveGrowableCol( size_t idx )
{
m_growableCols.Remove( idx );
DoRemoveFromArrays(idx, m_growableCols, m_growableColsProportions);
}
void wxFlexGridSizer::RemoveGrowableRow( size_t idx )
{
DoRemoveFromArrays(idx, m_growableRows, m_growableRowsProportions);
}
//---------------------------------------------------------------------------