+ // is the desired size of this item big enough?
+ if ( (remaining*propItem)/totalProportion >= minMajor )
+ {
+ // yes, it is, we'll determine the real size of this
+ // item later, for now just leave it as wxDefaultCoord
+ continue;
+ }
+
+ // the proportion of this item won't count, it has
+ // effectively become fixed
+ totalProportion -= propItem;
+ }
+
+ // we can already allocate space for this item
+ majorSizes[n] = minMajor;
+
+ // change the amount of the space remaining to the other items,
+ // as this can result in not being able to satisfy their
+ // proportions any more we will need to redo another loop
+ // iteration
+ remaining -= minMajor;
+
+ nonFixedSpaceChanged = true;
+ }
+
+ // Similar to the previous loop, but dealing with items whose max size
+ // is less than what we would allocate to them taking their proportion
+ // into account.
+ nonFixedSpaceChanged = false;
+ for ( i = m_children.begin(), n = 0; ; ++i, ++n )
+ {
+ if ( nonFixedSpaceChanged )
+ {
+ i = m_children.begin();
+ n = 0;
+ nonFixedSpaceChanged = false;
+ }
+
+ // check for the end of the loop only after the check above as
+ // otherwise we wouldn't do another pass if the last child resulted
+ // in non fixed space reduction
+ if ( i == m_children.end() )
+ break;
+
+ wxSizerItem * const item = *i;
+
+ if ( !item->IsShown() )
+ continue;
+
+ // don't check the item which we had already dealt with during a
+ // previous pass (this is more than an optimization, the code
+ // wouldn't work correctly if we kept adjusting for the same item
+ // over and over again)
+ if ( majorSizes[n] != wxDefaultCoord )
+ continue;
+
+ wxCoord maxMajor = GetSizeInMajorDir(item->GetMaxSizeWithBorder());
+
+ // must be nonzero, fixed-size items were dealt with in previous loop
+ const int propItem = item->GetProportion();
+
+ // is the desired size of this item small enough?
+ if ( maxMajor < 0 ||
+ (remaining*propItem)/totalProportion <= maxMajor )
+ {
+ // yes, it is, we'll determine the real size of this
+ // item later, for now just leave it as wxDefaultCoord
+ continue;
+ }
+
+ // the proportion of this item won't count, it has
+ // effectively become fixed
+ totalProportion -= propItem;
+
+ // we can already allocate space for this item
+ majorSizes[n] = maxMajor;