Fix text cropping when using ellipsization in wxGrid

A text is cropped for cells with ellipsization enabled when width of the
cell nearly equal to width of the text because wxGrid::DrawTextRectangle
function variant with the parameter of type wxArrayString adds the offset
before actually drawing the text using dc.DrawText or dc.DrawRotatedText.
This commit is contained in:
Ilya Sinitsyn
2020-01-29 05:06:03 +07:00
parent 6e52a70582
commit 72824bc269

View File

@@ -6831,13 +6831,16 @@ void wxGrid::DrawTextRectangle(wxDC& dc,
{
attr.GetNonDefaultAlignment(&hAlign, &vAlign);
// The text will be displaced in final wxGrid::DrawTextRectangle function.
const int textMargin = 2;
// This does nothing if there is no need to ellipsize.
const wxString& ellipsizedText = wxControl::Ellipsize
(
text,
dc,
attr.GetFitMode().GetEllipsizeMode(),
rect.GetWidth(),
rect.GetWidth() - textMargin,
wxELLIPSIZE_FLAGS_NONE
);