Fix calculating the size of vertical toolbar in wxMSW.

Use the width of the largest toolbar item as the toolbar width, not the width
of the first one. The implicit assumption that all items had the same width
was wrong and resulted in items wider than the first one being truncated.

Closes #3788.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76035 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2014-02-28 23:40:22 +00:00
parent 18cd6f624f
commit b2b49c32ec

View File

@ -1734,12 +1734,21 @@ void wxToolBar::OnEraseBackground(wxEraseEvent& event)
bool wxToolBar::HandleSize(WXWPARAM WXUNUSED(wParam), WXLPARAM lParam)
{
// wait until we have some tools
if ( !GetToolsCount() )
const int toolsCount = GetToolsCount();
if ( toolsCount == 0 )
return false;
// calculate our minor dimension ourselves - we're confusing the standard
// logic (TB_AUTOSIZE) with our horizontal toolbars and other hacks
const RECT r = wxGetTBItemRect(GetHwnd(), 0);
// Find bounding box for any toolbar item.
RECT r;
::SetRectEmpty(&r);
for( int i = 0; i < toolsCount; i++ )
{
RECT ritem = wxGetTBItemRect(GetHwnd(), i);
::OffsetRect(&ritem, -ritem.left, -ritem.top); // Shift origin to (0,0)
::UnionRect(&r, &r, &ritem);
}
if ( !r.right )
return false;