Fix bug in ribbon bar label size calculation.

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
This commit is contained in:
Vadim Zeitlin 2012-08-15 23:34:40 +00:00
parent 70f86dedfd
commit 083ec26fb7

View 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)
{