- if ( m_selectionMode != wxGridSelection::wxGridSelectRows &&
- m_selectionMode != wxGridSelection::wxGridSelectColumns )
- {
-
- while( ( n = m_cellSelection.GetCount() ) > 0)
- {
- wxRect r;
- r = m_grid->BlockToDeviceRect( m_cellSelection[n],
- m_cellSelection[n] );
- m_cellSelection.RemoveAt(n);
- if ( !m_grid->GetBatchCount() )
- ((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
- }
- }
- while( ( n = m_blockSelectionTopLeft.GetCount() ) > 0)
- {
- wxRect r;
- r = m_grid->BlockToDeviceRect( m_blockSelectionTopLeft[n],
- m_blockSelectionBottomRight[n] );
- m_blockSelectionTopLeft.RemoveAt(n);
- m_blockSelectionBottomRight.RemoveAt(n);
- if ( !m_grid->GetBatchCount() )
- ((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
- }
- if ( m_selectionMode != wxGridSelection::wxGridSelectColumns )
- {
- while( ( n = m_rowSelection.GetCount() ) > 0)
- {
- int & row = m_rowSelection[n];
- wxRect r;
- r = m_grid->BlockToDeviceRect( wxGridCellCoords( row, 0 ),
- wxGridCellCoords( row, m_grid->GetNumberCols() - 1 ) );
- m_rowSelection.RemoveAt(n);
- if ( !m_grid->GetBatchCount() )
- ((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
- }
- }
- if ( m_selectionMode != wxGridSelection::wxGridSelectRows )
- {
- while( ( n = m_colSelection.GetCount() ) > 0)
- {
- int & col = m_colSelection[n];
- wxRect r;
- r = m_grid->BlockToDeviceRect( wxGridCellCoords( 0, col ),
- wxGridCellCoords( m_grid->GetNumberRows() - 1, col ) );
- m_colSelection.RemoveAt(n);
- if ( !m_grid->GetBatchCount() )
- ((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
- }
+ wxRect r;
+ wxGridCellCoords coords1, coords2;
+
+ // deselect all individual cells and update the screen
+ if ( m_selectionMode == wxGrid::wxGridSelectCells )
+ {
+ while ( ( n = m_cellSelection.GetCount() ) > 0)
+ {
+ n--;
+ coords1 = m_cellSelection[n];
+ m_cellSelection.RemoveAt(n);
+ if ( !m_grid->GetBatchCount() )
+ {
+ r = m_grid->BlockToDeviceRect( coords1, coords1 );
+ ((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
+
+#ifdef __WXMAC__
+ ((wxWindow *)m_grid->m_gridWin)->Update();
+#endif
+ }
+ }
+ }
+
+ // deselect all blocks and update the screen
+ while ( ( n = m_blockSelectionTopLeft.GetCount() ) > 0)
+ {
+ n--;
+ coords1 = m_blockSelectionTopLeft[n];
+ coords2 = m_blockSelectionBottomRight[n];
+ m_blockSelectionTopLeft.RemoveAt(n);
+ m_blockSelectionBottomRight.RemoveAt(n);
+ if ( !m_grid->GetBatchCount() )
+ {
+ r = m_grid->BlockToDeviceRect( coords1, coords2 );
+ ((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
+
+#ifdef __WXMAC__
+ ((wxWindow *)m_grid->m_gridWin)->Update();
+#endif
+ }
+ }
+
+ // deselect all rows and update the screen
+ if ( m_selectionMode != wxGrid::wxGridSelectColumns )
+ {
+ while ( ( n = m_rowSelection.GetCount() ) > 0)
+ {
+ n--;
+ int row = m_rowSelection[n];
+ m_rowSelection.RemoveAt(n);
+ if ( !m_grid->GetBatchCount() )
+ {
+ r = m_grid->BlockToDeviceRect( wxGridCellCoords( row, 0 ),
+ wxGridCellCoords( row, m_grid->GetNumberCols() - 1 ) );
+ ((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
+
+#ifdef __WXMAC__
+ ((wxWindow *)m_grid->m_gridWin)->Update();
+#endif
+ }
+ }
+ }
+
+ // deselect all columns and update the screen
+ if ( m_selectionMode != wxGrid::wxGridSelectRows )
+ {
+ while ( ( n = m_colSelection.GetCount() ) > 0)
+ {
+ n--;
+ int col = m_colSelection[n];
+ m_colSelection.RemoveAt(n);
+ if ( !m_grid->GetBatchCount() )
+ {
+ r = m_grid->BlockToDeviceRect( wxGridCellCoords( 0, col ),
+ wxGridCellCoords( m_grid->GetNumberRows() - 1, col ) );
+ ((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
+
+#ifdef __WXMAC__
+ ((wxWindow *)m_grid->m_gridWin)->Update();
+#endif
+ }
+ }