Fix bug in vertical toolbar size calculation in wxMSW.

Correct the changes of the r76035 to avoid using separators when calculating
the fitting width of the vertical toolbars as this doesn't always work
correctly.

Closes #3788.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76080 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2014-03-04 14:20:28 +00:00
parent e2fe8927cc
commit 32bf537043

View File

@ -1743,12 +1743,24 @@ bool wxToolBar::HandleSize(WXWPARAM WXUNUSED(wParam), WXLPARAM lParam)
// Find bounding box for any toolbar item.
RECT r;
::SetRectEmpty(&r);
for( int i = 0; i < toolsCount; i++ )
wxToolBarToolsList::compatibility_iterator node;
int i = 0;
for ( node = m_tools.GetFirst(); node; node = node->GetNext(), i++)
{
wxToolBarTool * const tool = (wxToolBarTool*)node->GetData();
// Separators shouldn't be taken into account as they are sometimes
// reported to have the width of the entire client area by the toolbar.
// And we know that they are not the biggest items in the toolbar in
// any case, so just skip them.
if( !tool->IsSeparator() )
{
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;