- wxPoint pt( GetPosition() );
- int delta;
- size_t idx, num;
- wxArrayInt temp;
- wxArrayInt temp_proportions;
- int sum_proportions = 0;
- int growable_space = 0;
-
- // what to do with the rows? by default, resize them proportionally
- if ( (m_flexDirection & wxVERTICAL) ||
- (m_growMode == wxFLEX_GROWMODE_SPECIFIED) )
- {
- // Transfer only those rows into temp which exist in the sizer
- // ignoring the superfluous ones. This prevents a segfault when
- // calling AddGrowableRow( 3 ) if the sizer only has 2 rows.
- for (idx = 0; idx < m_growableRows.GetCount(); idx++)
- {
- if (m_growableRows[idx] < nrows)
- {
- temp.Add( m_growableRows[idx] );
- temp_proportions.Add( m_growableRowsProportions[idx] );
- sum_proportions += m_growableRowsProportions[idx];
- growable_space += m_rowHeights[ temp[idx] ];
- }
- }
-
- num = temp.GetCount();
-
- if ((num > 0) && (sz.y > minsz.y))
- {
- for (idx = 0; idx < num; idx++)
- {
- delta = (sz.y - minsz.y);
- if (sum_proportions == 0)
- delta = (delta/num) + m_rowHeights[ temp[idx] ];
- else
- delta = ((delta+growable_space)*temp_proportions[idx])/
- sum_proportions;
- m_rowHeights[ temp[idx] ] = delta;
- }
- }
- temp.Empty();
- temp_proportions.Empty();
- sum_proportions = 0;
- growable_space = 0;
- }
- else if ( (m_growMode == wxFLEX_GROWMODE_ALL) && (sz.y > minsz.y) )
- {
- // rounding problem?
- for ( int row = 0; row < nrows; ++row )
- m_rowHeights[ row ] = sz.y / nrows;
- }
-
- // the same logic as above but for the columns
- if ( (m_flexDirection & wxHORIZONTAL) ||
- (m_growMode == wxFLEX_GROWMODE_SPECIFIED) )
- {
- // See above
- for (idx = 0; idx < m_growableCols.GetCount(); idx++)
- {
- if (m_growableCols[idx] < ncols)
- {
- temp.Add( m_growableCols[idx] );
- temp_proportions.Add( m_growableColsProportions[idx] );
- sum_proportions += m_growableColsProportions[idx];
- growable_space += m_colWidths[idx];
- }
- }