From 3f4304f6ab92b333b9c9b6c0a378f3e28ef9b930 Mon Sep 17 00:00:00 2001 From: Iwbnwif Yiw Date: Sun, 10 May 2015 03:13:35 +0200 Subject: [PATCH] Update wxGrid correctly in presence of hidden rows/columns. Use GetRowHeight()/GetColWidth() instead of accessing m_rowHeights/m_colWidths arrays directly as the functions handle the hidden rows/columns correctly. This fixes bug with corruption of wxGrid appearance if any rows/columns were inserted into or deleted from a grid containing some hidden rows/columns. Closes #16980. --- docs/changes.txt | 1 + src/generic/grid.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 7d08f574dc..eda810d200 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -595,6 +595,7 @@ All (GUI): - Fix wxPixelData::Offset() for alpha (Markus Rollmann). - Fix bug in wxImage::ClearAlpha() for shared data (Markus Rollmann). - Accept wxALIGN_CENTRE_HORIZONTAL in wxStaticText XRC handler (David Hart). +- Fix appearance after updating a wxGrid with hidden rows/columns (iwbnwif). wxGTK: diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index b9f4f1a2a7..b83b8f0e12 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -2726,7 +2726,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) for ( i = pos; i < m_numRows; i++ ) { - bottom += m_rowHeights[i]; + bottom += GetRowHeight(i); m_rowBottoms[i] = bottom; } } @@ -2771,7 +2771,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) for ( i = oldNumRows; i < m_numRows; i++ ) { - bottom += m_rowHeights[i]; + bottom += GetRowHeight(i); m_rowBottoms[i] = bottom; } } @@ -2807,7 +2807,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) int h = 0; for ( i = 0; i < m_numRows; i++ ) { - h += m_rowHeights[i]; + h += GetRowHeight(i); m_rowBottoms[i] = h; } } @@ -2891,7 +2891,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) { i = GetColAt( colPos ); - right += m_colWidths[i]; + right += GetColWidth(i); m_colRights[i] = right; } } @@ -2949,7 +2949,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) { i = GetColAt( colPos ); - right += m_colWidths[i]; + right += GetColWidth(i); m_colRights[i] = right; } } @@ -3010,7 +3010,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) { i = GetColAt( colPos ); - w += m_colWidths[i]; + w += GetColWidth(i); m_colRights[i] = w; } }