From 2ebbd666d9ce469c7c74744f491afe6a263a7e7e Mon Sep 17 00:00:00 2001 From: Stefan Neis Date: Wed, 28 Jun 2000 16:47:06 +0000 Subject: [PATCH] Fix for hiding cell edit control that actually is smaller than a cell. Use CellToRect in to more places instead of doing the same thing by hand. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7653 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/grid.cpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 1011b9daf4..1b31ef10db 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -5718,17 +5718,7 @@ void wxGrid::DrawCell( wxDC& dc, const wxGridCellCoords& coords ) bool isCurrent = coords == m_currentCellCoords; - wxRect rect; - rect.x = GetColLeft(col); - rect.y = GetRowTop(row); - rect.width = GetColWidth(col) - 1; - rect.height = GetRowHeight(row) - 1; - - // if grid lines are disabled, then the area of the cell is a bit larger - if (! m_gridLinesEnabled) { - rect.width += 1; - rect.height += 1; - } + wxRect rect = CellToRect( row, col ); // if the editor is shown, we should use it and not the renderer // Note: However, only if it is really _shown_, i.e. not hidden! @@ -5758,11 +5748,7 @@ void wxGrid::DrawCellHighlight( wxDC& dc, const wxGridCellAttr *attr ) if ( GetColWidth(col) <= 0 || GetRowHeight(row) <= 0 ) return; - wxRect rect; - rect.x = GetColLeft(col); - rect.y = GetRowTop(row); - rect.width = GetColWidth(col) - 1; - rect.height = GetRowHeight(row) - 1; + wxRect rect = CellToRect(row, col); // hmmm... what could we do here to show that the cell is disabled? // for now, I just draw a thinner border than for the other ones, but @@ -6335,6 +6321,8 @@ void wxGrid::HideCellEditControl() editor->DecRef(); attr->DecRef(); m_gridWin->SetFocus(); + wxRect rect( CellToRect( row, col ) ); + m_gridWin->Refresh( FALSE, &rect ); } } @@ -6469,6 +6457,11 @@ wxRect wxGrid::CellToRect( int row, int col ) rect.height = GetRowHeight(row); } + // if grid lines are enabled, then the area of the cell is a bit smaller + if (m_gridLinesEnabled) { + rect.width -= 1; + rect.height -= 1; + } return rect; }