Merge branch 'grid-ellipsize-offset' of https://github.com/thesiv/wxWidgets
Fix text cropping when using ellipsization in wxGrid. See https://github.com/wxWidgets/wxWidgets/pull/1720
This commit is contained in:
@@ -114,6 +114,9 @@ const int DRAG_SENSITIVITY = 3;
|
|||||||
// the space between the cell edge and the checkbox mark
|
// the space between the cell edge and the checkbox mark
|
||||||
const int GRID_CELL_CHECKBOX_MARGIN = 2;
|
const int GRID_CELL_CHECKBOX_MARGIN = 2;
|
||||||
|
|
||||||
|
// the margin between a cell vertical line and a cell text
|
||||||
|
const int GRID_TEXT_MARGIN = 1;
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
#include "wx/arrimpl.cpp"
|
#include "wx/arrimpl.cpp"
|
||||||
@@ -6814,9 +6817,9 @@ void wxGrid::DrawTextRectangle(wxDC& dc,
|
|||||||
{
|
{
|
||||||
case wxALIGN_BOTTOM:
|
case wxALIGN_BOTTOM:
|
||||||
if ( textOrientation == wxHORIZONTAL )
|
if ( textOrientation == wxHORIZONTAL )
|
||||||
y = rect.y + (rect.height - textHeight - 1);
|
y = rect.y + (rect.height - textHeight - GRID_TEXT_MARGIN);
|
||||||
else
|
else
|
||||||
x = rect.x + rect.width - textWidth;
|
x = rect.x + (rect.width - textWidth - GRID_TEXT_MARGIN);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxALIGN_CENTRE:
|
case wxALIGN_CENTRE:
|
||||||
@@ -6829,9 +6832,9 @@ void wxGrid::DrawTextRectangle(wxDC& dc,
|
|||||||
case wxALIGN_TOP:
|
case wxALIGN_TOP:
|
||||||
default:
|
default:
|
||||||
if ( textOrientation == wxHORIZONTAL )
|
if ( textOrientation == wxHORIZONTAL )
|
||||||
y = rect.y + 1;
|
y = rect.y + GRID_TEXT_MARGIN;
|
||||||
else
|
else
|
||||||
x = rect.x + 1;
|
x = rect.x + GRID_TEXT_MARGIN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6855,9 +6858,9 @@ void wxGrid::DrawTextRectangle(wxDC& dc,
|
|||||||
{
|
{
|
||||||
case wxALIGN_RIGHT:
|
case wxALIGN_RIGHT:
|
||||||
if ( textOrientation == wxHORIZONTAL )
|
if ( textOrientation == wxHORIZONTAL )
|
||||||
x = rect.x + (rect.width - lineWidth - 1);
|
x = rect.x + (rect.width - lineWidth - GRID_TEXT_MARGIN);
|
||||||
else
|
else
|
||||||
y = rect.y + lineWidth + 1;
|
y = rect.y + lineWidth + GRID_TEXT_MARGIN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxALIGN_CENTRE:
|
case wxALIGN_CENTRE:
|
||||||
@@ -6870,9 +6873,9 @@ void wxGrid::DrawTextRectangle(wxDC& dc,
|
|||||||
case wxALIGN_LEFT:
|
case wxALIGN_LEFT:
|
||||||
default:
|
default:
|
||||||
if ( textOrientation == wxHORIZONTAL )
|
if ( textOrientation == wxHORIZONTAL )
|
||||||
x = rect.x + 1;
|
x = rect.x + GRID_TEXT_MARGIN;
|
||||||
else
|
else
|
||||||
y = rect.y + rect.height - 1;
|
y = rect.y + rect.height - GRID_TEXT_MARGIN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6904,7 +6907,7 @@ void wxGrid::DrawTextRectangle(wxDC& dc,
|
|||||||
text,
|
text,
|
||||||
dc,
|
dc,
|
||||||
attr.GetFitMode().GetEllipsizeMode(),
|
attr.GetFitMode().GetEllipsizeMode(),
|
||||||
rect.GetWidth(),
|
rect.GetWidth() - 2 * GRID_TEXT_MARGIN,
|
||||||
wxELLIPSIZE_FLAGS_NONE
|
wxELLIPSIZE_FLAGS_NONE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user