Don't set stretchable spacers size to 0, this doesn't work so use 1 instead.

If the toolbar is not big enough for its fixed-size contents, we set the size
of the tools corresponding to stretchable spacers to 0 but this didn't really
work and resulted in bad toolbar appearance even after resizing it to be big
enough (as could be seen in samples/xrc).

So set the spacers size to at least 1 to ensure that we do resize them
correctly.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63173 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-01-18 00:29:05 +00:00
parent 5852e62f1f
commit 187839afce

View File

@@ -1219,13 +1219,13 @@ void wxToolBar::UpdateStretchableSpacersSize()
// reduce their size if there is not enough place for all tools
const int totalSize = IsVertical() ? GetClientSize().y : GetClientSize().x;
const int extraSize = totalSize - m_totalFixedSize;
const int sizeSpacer = extraSize > 0 ? extraSize / numSpaces : 0;
const int sizeSpacer = extraSize > 0 ? extraSize / numSpaces : 1;
// the last spacer should consume all remaining space if we have too much
// of it (which can be greater than sizeSpacer because of the rounding)
const int sizeLastSpacer = extraSize > 0
? extraSize - (numSpaces - 1)*sizeSpacer
: 0;
: 1;
// cumulated offset by which we need to move all the following controls to
// the right: while the toolbar takes care of the normal items, we must