wxPropertyGrid member m_visPropArray removed, now always recreated from scratch in DoDrawItems()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55586 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2008-09-13 20:14:20 +00:00
parent d27f4c7bcb
commit 23b4f32040
2 changed files with 13 additions and 14 deletions

View File

@@ -1632,9 +1632,6 @@ protected:
// background colour for empty space below the grid // background colour for empty space below the grid
wxColour m_colEmptySpace; wxColour m_colEmptySpace;
// temp property array used in DoDrawItems
wxArrayPtrVoid m_visPropArray;
// NB: These *cannot* be moved to globals. // NB: These *cannot* be moved to globals.
// Array of background colour brushes. // Array of background colour brushes.

View File

@@ -1060,7 +1060,6 @@ void wxPropertyGrid::CalculateFontAndBitmapStuff( int vspacing )
GetTextExtent(wxS("jG"), &x, &y, 0, 0, &m_captionFont); GetTextExtent(wxS("jG"), &x, &y, 0, 0, &m_captionFont);
m_lineHeight = m_fontHeight+(2*m_spacingy)+1; m_lineHeight = m_fontHeight+(2*m_spacingy)+1;
m_visPropArray.SetCount((m_height/m_lineHeight)+10);
// button spacing // button spacing
m_buttonSpacingY = (m_lineHeight - m_iconHeight) / 2; m_buttonSpacingY = (m_lineHeight - m_iconHeight) / 2;
@@ -2089,7 +2088,11 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
wxPropertyGridConstIterator it( state, wxPG_ITERATE_VISIBLE, firstItem ); wxPropertyGridConstIterator it( state, wxPG_ITERATE_VISIBLE, firstItem );
int endScanBottomY = lastItemBottomY + lh; int endScanBottomY = lastItemBottomY + lh;
int y = firstItemTopY; int y = firstItemTopY;
unsigned int arrInd = 0;
//
// Pregenerate list of visible properties.
wxArrayPGProperty visPropArray;
visPropArray.reserve((m_height/m_lineHeight)+6);
for ( ; !it.AtEnd(); it.Next() ) for ( ; !it.AtEnd(); it.Next() )
{ {
@@ -2097,8 +2100,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
if ( !p->HasFlag(wxPG_PROP_HIDDEN) ) if ( !p->HasFlag(wxPG_PROP_HIDDEN) )
{ {
m_visPropArray[arrInd] = (wxPGProperty*)p; visPropArray.push_back((wxPGProperty*)p);
arrInd++;
if ( y > endScanBottomY ) if ( y > endScanBottomY )
break; break;
@@ -2107,17 +2109,19 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
} }
} }
m_visPropArray[arrInd] = NULL; visPropArray.push_back(NULL);
wxPGProperty* nextP = visPropArray[0];
int gridWidth = state->m_width; int gridWidth = state->m_width;
y = firstItemTopY; y = firstItemTopY;
for ( arrInd=0; for ( unsigned int arrInd=1;
m_visPropArray[arrInd] != NULL && y <= lastItemBottomY; nextP && y <= lastItemBottomY;
arrInd++ ) arrInd++ )
{ {
wxPGProperty* p =(wxPGProperty*) m_visPropArray[arrInd]; wxPGProperty* p = nextP;
wxPGProperty* nextP = (wxPGProperty*) m_visPropArray[arrInd+1]; nextP = visPropArray[arrInd];
int rowHeight = m_fontHeight+(m_spacingy*2)+1; int rowHeight = m_fontHeight+(m_spacingy*2)+1;
int textMarginHere = x; int textMarginHere = x;
@@ -4140,8 +4144,6 @@ void wxPropertyGrid::OnResize( wxSizeEvent& event )
m_width = width; m_width = width;
m_height = height; m_height = height;
m_visPropArray.SetCount((height/m_lineHeight)+10);
#if wxPG_DOUBLE_BUFFER #if wxPG_DOUBLE_BUFFER
if ( !(GetExtraStyle() & wxPG_EX_NATIVE_DOUBLE_BUFFERING) ) if ( !(GetExtraStyle() & wxPG_EX_NATIVE_DOUBLE_BUFFERING) )
{ {