git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19842
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
dc->GetTextExtent(ellipsis, &base_w, &h);
// continue until we have enough space or only one character left
dc->GetTextExtent(ellipsis, &base_w, &h);
// continue until we have enough space or only one character left
- drawntext = text.Left(text.Length() - 1);
- while (drawntext.Length() > 1)
+ wxCoord w_c, h_c;
+ size_t len = text.Length();
+ drawntext = text.Left(len);
+ while (len > 1)
- dc->GetTextExtent(drawntext, &w, &h);
+ dc->GetTextExtent(drawntext.Last(), &w_c, &h_c);
+ drawntext.RemoveLast();
+ len--;
+ w -= w_c;
if (w + base_w <= width)
break;
if (w + base_w <= width)
break;
- drawntext = drawntext.Left(drawntext.Length() - 1);
}
// if still not enough space, remove ellipsis characters
}
// if still not enough space, remove ellipsis characters