]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix bug in ribbon bar label size calculation.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 15 Aug 2012 23:34:40 +0000 (23:34 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 15 Aug 2012 23:34:40 +0000 (23:34 +0000)
Due to an off by 1 error in wxString::Mid() call, the size computed was too
small and hence the label could have been not displayed at all.

Fix this and also replace Mid(0, n) with a more clear Left(n) call.

Closes #14566.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72348 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/ribbon/art_msw.cpp

index 0484c51b9816e2dccae424fcd666109025082e95..9318b309c2dae27f1eb289dd80420f815a7a4eb5 100644 (file)
@@ -2889,7 +2889,7 @@ bool wxRibbonMSWArtProvider::GetButtonBarButtonSize(
                 if(wxRibbonCanLabelBreakAtPosition(label, i))
                 {
                     int width = wxMax(
-                        dc.GetTextExtent(label.Mid(0, i - 1)).GetWidth(),
+                        dc.GetTextExtent(label.Left(i)).GetWidth(),
                         dc.GetTextExtent(label.Mid(i + 1)).GetWidth() + last_line_extra_width);
                     if(width < best_width)
                     {