- int left, top;
- CalcUnscrolledPosition( 0, 0, &left, &top );
-
- dc.SetBrush( wxBrush(GetDefaultCellBackgroundColour(), wxSOLID) );
- dc.SetPen( *wxTRANSPARENT_PEN );
-
- if ( right > GetColRight(m_numCols-1) )
- dc.DrawRectangle( GetColRight(m_numCols-1), top,
- right - GetColRight(m_numCols-1), ch );
-
- if ( bottom > GetRowBottom(m_numRows-1) )
- dc.DrawRectangle( left, GetRowBottom(m_numRows-1),
- cw, bottom - GetRowBottom(m_numRows-1) );
- }
- }
+ wxGridCellCoords cell(row+cell_rows, col+cell_cols);
+ bool marked = FALSE;
+ for ( j = 0; j < numCells; j++ )
+ {
+ if ( cell == cells[j] )
+ {
+ marked = TRUE;
+ break;;
+ }
+ }
+ if (!marked)
+ {
+ int count = redrawCells.GetCount();
+ for (j = 0; j < count; j++)
+ {
+ if ( cell == redrawCells[j] )
+ {
+ marked = TRUE;
+ break;
+ }
+ }
+ if (!marked) redrawCells.Add( cell );
+ }
+ continue; // don't bother drawing this cell
+ }
+
+ // If this cell is empty, find cell to left that might want to overflow
+ if (m_table && m_table->IsEmptyCell(row, col))
+ {
+ for ( l = 0; l < cell_rows; l++ )
+ {
+ for (j = col-1; j >= 0; j--)
+ {
+ if (!m_table->IsEmptyCell(row+l, j))
+ {
+ if (GetCellOverflow(row+l, j))
+ {
+ wxGridCellCoords cell(row+l, j);
+ bool marked = FALSE;
+
+ for (k = 0; k < numCells; k++)
+ {
+ if ( cell == cells[k] )
+ {
+ marked = TRUE;
+ break;
+ }
+ }
+ if (!marked)
+ {
+ int count = redrawCells.GetCount();
+ for (k = 0; k < count; k++)
+ {
+ if ( cell == redrawCells[k] )
+ {
+ marked = TRUE;
+ break;
+ }
+ }
+ if (!marked) redrawCells.Add( cell );
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ DrawCell( dc, cells[i] );
+ }
+
+ numCells = redrawCells.GetCount();
+
+ for ( i = numCells - 1; i >= 0; i-- )
+ {
+ DrawCell( dc, redrawCells[i] );
+ }
+}
+
+
+void wxGrid::DrawGridSpace( wxDC& dc )
+{
+ int cw, ch;
+ m_gridWin->GetClientSize( &cw, &ch );
+
+ int right, bottom;
+ CalcUnscrolledPosition( cw, ch, &right, &bottom );
+
+ int rightCol = m_numCols > 0 ? GetColRight(m_numCols - 1) : 0;
+ int bottomRow = m_numRows > 0 ? GetRowBottom(m_numRows - 1) : 0 ;
+
+ if ( right > rightCol || bottom > bottomRow )
+ {
+ int left, top;
+ CalcUnscrolledPosition( 0, 0, &left, &top );
+
+ dc.SetBrush( wxBrush(GetDefaultCellBackgroundColour(), wxSOLID) );
+ dc.SetPen( *wxTRANSPARENT_PEN );
+
+ if ( right > rightCol )
+ {
+ dc.DrawRectangle( rightCol, top, right - rightCol, ch);
+ }
+
+ if ( bottom > bottomRow )
+ {
+ dc.DrawRectangle( left, bottomRow, cw, bottom - bottomRow);
+ }
+ }