+ // and if we have any selection, it has to be repainted, because it
+ // uses different colour when the grid is not focused:
+ if ( m_owner->IsSelection() )
+ {
+ Refresh();
+ }
+ else
+ {
+ // NB: Note that this code is in "else" branch only because the other
+ // branch refreshes everything and so there's no point in calling
+ // Refresh() again, *not* because it should only be done if
+ // !IsSelection(). If the above code is ever optimized to refresh
+ // only selected area, this needs to be moved out of the "else"
+ // branch so that it's always executed.
+
+ // current cell cursor {dis,re}appears on focus change:
+ const wxGridCellCoords cursorCoords(m_owner->GetGridCursorRow(),
+ m_owner->GetGridCursorCol());
+ const wxRect cursor =
+ m_owner->BlockToDeviceRect(cursorCoords, cursorCoords);
+ Refresh(true, &cursor);
+ }
+