Remove wxGridSelection::ToggleCellSelection()

Remove the function because it's not usefull anymore and used only in one
place.
This commit is contained in:
Ilya Sinitsyn
2020-03-27 22:40:20 +07:00
committed by Vadim Zeitlin
parent cdf3187fe5
commit d4919d3334
3 changed files with 15 additions and 26 deletions

View File

@@ -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 );

View File

@@ -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;

View File

@@ -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,