- wxRect r;
-
- if ( IsSelection() && addToSelected )
- {
- wxRect rect[4];
- bool need_refresh[4];
- need_refresh[0] =
- need_refresh[1] =
- need_refresh[2] =
- need_refresh[3] = FALSE;
-
- int i;
-
- wxCoord oldLeft = m_selectedTopLeft.GetCol();
- wxCoord oldTop = m_selectedTopLeft.GetRow();
- wxCoord oldRight = m_selectedBottomRight.GetCol();
- wxCoord oldBottom = m_selectedBottomRight.GetRow();
-
- if ( oldTop > row )
- {
- need_refresh[0] = TRUE;
- rect[0] = BlockToDeviceRect( wxGridCellCoords ( row, 0 ),
- wxGridCellCoords ( oldTop - 1,
- m_numCols - 1 ) );
- m_selectedTopLeft.SetRow( row );
- }
-
- if ( oldLeft > 0 )
- {
- need_refresh[1] = TRUE;
- rect[1] = BlockToDeviceRect( wxGridCellCoords ( oldTop, 0 ),
- wxGridCellCoords ( oldBottom,
- oldLeft - 1 ) );
-
- m_selectedTopLeft.SetCol( 0 );
- }
-
- if ( oldBottom < row )
- {
- need_refresh[2] = TRUE;
- rect[2] = BlockToDeviceRect( wxGridCellCoords ( oldBottom + 1, 0 ),
- wxGridCellCoords ( row,
- m_numCols - 1 ) );
- m_selectedBottomRight.SetRow( row );
- }
-
- if ( oldRight < m_numCols - 1 )
- {
- need_refresh[3] = TRUE;
- rect[3] = BlockToDeviceRect( wxGridCellCoords ( oldTop ,
- oldRight + 1 ),
- wxGridCellCoords ( oldBottom,
- m_numCols - 1 ) );
- m_selectedBottomRight.SetCol( m_numCols - 1 );
- }
-
- for (i = 0; i < 4; i++ )
- if ( need_refresh[i] && rect[i] != wxGridNoCellRect )
- m_gridWin->Refresh( FALSE, &(rect[i]) );
- }
- else
- {
- r = SelectionToDeviceRect();