correct toolbar width calculation with comctl32.dll < 6.0 (patch 1902358)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@53487 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-05-08 13:25:00 +00:00
parent 282981549e
commit aba0599409
2 changed files with 20 additions and 1 deletions

View File

@@ -171,6 +171,8 @@ wxMSW:
spin button's client size.
- Fixed IMPLEMENT_APP() to be compatible with the -WU flag of Borland C++
compiler (Matthias Bohm).
- Correct size calculation for toolbars containing controls under pre-XP
systems (Gerald Giese)
wxGTK:

View File

@@ -363,8 +363,25 @@ wxSize wxToolBar::DoGetBestSize() const
sizeBest.y = t;
}
}
else
else // TB_GETMAXSIZE succeeded
{
// but it could still return an incorrect result due to what appears to
// be a bug in old comctl32.dll versions which don't handle controls in
// the toolbar correctly, so work around it (see SF patch 1902358)
if ( !IsVertical() && wxApp::GetComCtl32Version() < 600 )
{
// calculate the toolbar width in alternative way
RECT rcFirst, rcLast;
if ( ::SendMessage(GetHwnd(), TB_GETITEMRECT, 0, (LPARAM)&rcFirst)
&& ::SendMessage(GetHwnd(), TB_GETITEMRECT,
GetToolsCount() - 1, (LPARAM)&rcLast) )
{
const int widthAlt = rcLast.right - rcFirst.left;
if ( widthAlt > size.cx )
size.cx = widthAlt;
}
}
sizeBest.x = size.cx;
sizeBest.y = size.cy;
}