-
- m_selectedTopLeft.Set( topRow, leftCol );
- m_selectedBottomRight.Set( bottomRow, rightCol );
-
- wxRect r;
- r = SelectionToDeviceRect();
- m_gridWin->Refresh( TRUE, &r );
+
+ updateTopLeft = m_selectedTopLeft;
+ if (m_selectedTopLeft != wxGridCellCoords( topRow, leftCol ) )
+ {
+ m_selectedTopLeft = wxGridCellCoords( topRow, leftCol );
+ if (updateTopLeft == wxGridNoCellCoords)
+ {
+ updateTopLeft = m_selectedTopLeft;
+ }
+ else
+ {
+ if(updateTopLeft.GetRow() > topRow)
+ updateTopLeft.SetRow(topRow);
+ if (updateTopLeft.GetCol() > leftCol)
+ updateTopLeft.SetCol(leftCol);
+ }
+ changed = true;
+ }
+
+ updateBottomRight = m_selectedBottomRight;
+ if (m_selectedBottomRight != wxGridCellCoords( bottomRow, rightCol ) )
+ {
+ m_selectedBottomRight = wxGridCellCoords( bottomRow, rightCol );
+ if (updateBottomRight == wxGridNoCellCoords)
+ {
+ updateBottomRight = m_selectedBottomRight;
+ }
+ else
+ {
+ if (updateBottomRight.GetRow() < bottomRow)
+ updateBottomRight.SetRow(bottomRow);
+ if (updateBottomRight.GetCol() < rightCol)
+ updateBottomRight.SetCol(rightCol);
+ }
+ changed = true;
+ }
+
+ if (changed)
+ {
+ wxRect r( BlockToDeviceRect( updateTopLeft, updateBottomRight ) );
+ m_gridWin->Refresh( TRUE, &r );
+ }