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:
@@ -6831,13 +6831,16 @@ void wxGrid::DrawTextRectangle(wxDC& dc,
|
|||||||
{
|
{
|
||||||
attr.GetNonDefaultAlignment(&hAlign, &vAlign);
|
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.
|
// This does nothing if there is no need to ellipsize.
|
||||||
const wxString& ellipsizedText = wxControl::Ellipsize
|
const wxString& ellipsizedText = wxControl::Ellipsize
|
||||||
(
|
(
|
||||||
text,
|
text,
|
||||||
dc,
|
dc,
|
||||||
attr.GetFitMode().GetEllipsizeMode(),
|
attr.GetFitMode().GetEllipsizeMode(),
|
||||||
rect.GetWidth(),
|
rect.GetWidth() - textMargin,
|
||||||
wxELLIPSIZE_FLAGS_NONE
|
wxELLIPSIZE_FLAGS_NONE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user