diff --git a/include/wx/generic/gridsel.h b/include/wx/generic/gridsel.h index 18016adfcd..dab94952fb 100644 --- a/include/wx/generic/gridsel.h +++ b/include/wx/generic/gridsel.h @@ -52,14 +52,6 @@ public: kbd, sendEvent); } - void ToggleCellSelection(int row, int col, - const wxKeyboardState& kbd = wxKeyboardState()); - void ToggleCellSelection(const wxGridCellCoords& coords, - const wxKeyboardState& kbd = wxKeyboardState()) - { - ToggleCellSelection(coords.GetRow(), coords.GetCol(), kbd); - } - void DeselectBlock(const wxGridBlockCoords& block, const wxKeyboardState& kbd = wxKeyboardState(), bool sendEvent = true ); diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 6d56e2b556..f0b4863f98 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -4577,7 +4577,21 @@ wxGrid::DoGridCellLeftDown(wxMouseEvent& event, { if ( m_selection ) { - m_selection->ToggleCellSelection(coords, event); + if ( !m_selection->IsInSelection(coords) ) + { + // If the cell is not selected, select it. + m_selection->SelectBlock(coords.GetRow(), coords.GetCol(), + coords.GetRow(), coords.GetCol(), + event); + } + else + { + // Otherwise deselect it. + m_selection->DeselectBlock( + wxGridBlockCoords(coords.GetRow(), coords.GetCol(), + coords.GetRow(), coords.GetCol()), + event); + } } m_selectedBlockTopLeft = wxGridNoCellCoords; diff --git a/src/generic/gridsel.cpp b/src/generic/gridsel.cpp index b7f27405ee..e8530388a8 100644 --- a/src/generic/gridsel.cpp +++ b/src/generic/gridsel.cpp @@ -183,23 +183,6 @@ void wxGridSelection::SelectBlock( int topRow, int leftCol, kbd, sendEvent); } -void -wxGridSelection::ToggleCellSelection(int row, int col, - const wxKeyboardState& kbd) -{ - // if the cell is not selected, select it - if ( !IsInSelection ( row, col ) ) - { - SelectBlock(row, col, row, col, kbd); - - return; - } - - // otherwise deselect it. - DeselectBlock(wxGridBlockCoords(row, col, row, col), kbd); -} - - void wxGridSelection::DeselectBlock(const wxGridBlockCoords& block, const wxKeyboardState& kbd,