From e0c09c84386c74c70dc8427ee6e9022f017528c5 Mon Sep 17 00:00:00 2001 From: Ilya Sinitsyn Date: Wed, 5 Feb 2020 00:48:52 +0700 Subject: [PATCH] Only overflow left-aligned cells in wxGrid Doing it for cells using a different alignment doesn't work correctly and it's not clear whether it really makes sense, so just don't do it at all for now. Closes https://github.com/wxWidgets/wxWidgets/pull/1726 --- src/generic/grid.cpp | 6 +++++- src/generic/gridctrl.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index ed11e6c7e0..09c4fde9d5 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -6086,7 +6086,11 @@ void wxGrid::DrawGridCellArea( wxDC& dc, const wxGridCellCoordsArray& cells ) { if (!m_table->IsEmptyCell(row + l, j)) { - if (GetCellOverflow(row + l, j)) + wxGridCellAttr *attr = GetCellAttr(row + l, j); + const bool canOverflow = attr->CanOverflow(); + attr->DecRef(); + + if ( canOverflow ) { wxGridCellCoords cell(row + l, j); bool marked = false; diff --git a/src/generic/gridctrl.cpp b/src/generic/gridctrl.cpp index 0efd1b499a..0d04d89e34 100644 --- a/src/generic/gridctrl.cpp +++ b/src/generic/gridctrl.cpp @@ -591,7 +591,7 @@ void wxGridCellStringRenderer::Draw(wxGrid& grid, // erase only this cells background, overflow cells should have been erased wxGridCellRenderer::Draw(grid, attr, dc, rectCell, row, col, isSelected); - if (attr.GetOverflow()) + if ( attr.CanOverflow() ) { int hAlign, vAlign; attr.GetAlignment(&hAlign, &vAlign);