diff --git a/docs/changes.txt b/docs/changes.txt index 3e5d3fe8a5..3e5033920a 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -634,6 +634,7 @@ wxMSW: - Fix checking menu items before appending them to the menu. - Fix crash when adding/removing the same path to/from wxFileSystemWatcher. - Draw "classic" disabled owner drawn buttons better (Artur Wieczorek). +- Fix width of the vertical toolbars (Artur Wieczorek). wxOSX: diff --git a/src/msw/toolbar.cpp b/src/msw/toolbar.cpp index 05ff1534f5..7a89067b48 100644 --- a/src/msw/toolbar.cpp +++ b/src/msw/toolbar.cpp @@ -1718,12 +1718,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;