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.
This commit is contained in:
Iwbnwif Yiw
2015-05-10 03:13:35 +02:00
committed by Vadim Zeitlin
parent 8277848a5f
commit 3f4304f6ab
2 changed files with 7 additions and 6 deletions

View File

@@ -595,6 +595,7 @@ All (GUI):
- Fix wxPixelData<wxImage>::Offset() for alpha (Markus Rollmann). - Fix wxPixelData<wxImage>::Offset() for alpha (Markus Rollmann).
- Fix bug in wxImage::ClearAlpha() for shared data (Markus Rollmann). - Fix bug in wxImage::ClearAlpha() for shared data (Markus Rollmann).
- Accept wxALIGN_CENTRE_HORIZONTAL in wxStaticText XRC handler (David Hart). - Accept wxALIGN_CENTRE_HORIZONTAL in wxStaticText XRC handler (David Hart).
- Fix appearance after updating a wxGrid with hidden rows/columns (iwbnwif).
wxGTK: wxGTK:

View File

@@ -2726,7 +2726,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg )
for ( i = pos; i < m_numRows; i++ ) for ( i = pos; i < m_numRows; i++ )
{ {
bottom += m_rowHeights[i]; bottom += GetRowHeight(i);
m_rowBottoms[i] = bottom; m_rowBottoms[i] = bottom;
} }
} }
@@ -2771,7 +2771,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg )
for ( i = oldNumRows; i < m_numRows; i++ ) for ( i = oldNumRows; i < m_numRows; i++ )
{ {
bottom += m_rowHeights[i]; bottom += GetRowHeight(i);
m_rowBottoms[i] = bottom; m_rowBottoms[i] = bottom;
} }
} }
@@ -2807,7 +2807,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg )
int h = 0; int h = 0;
for ( i = 0; i < m_numRows; i++ ) for ( i = 0; i < m_numRows; i++ )
{ {
h += m_rowHeights[i]; h += GetRowHeight(i);
m_rowBottoms[i] = h; m_rowBottoms[i] = h;
} }
} }
@@ -2891,7 +2891,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg )
{ {
i = GetColAt( colPos ); i = GetColAt( colPos );
right += m_colWidths[i]; right += GetColWidth(i);
m_colRights[i] = right; m_colRights[i] = right;
} }
} }
@@ -2949,7 +2949,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg )
{ {
i = GetColAt( colPos ); i = GetColAt( colPos );
right += m_colWidths[i]; right += GetColWidth(i);
m_colRights[i] = right; m_colRights[i] = right;
} }
} }
@@ -3010,7 +3010,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg )
{ {
i = GetColAt( colPos ); i = GetColAt( colPos );
w += m_colWidths[i]; w += GetColWidth(i);
m_colRights[i] = w; m_colRights[i] = w;
} }
} }