From 32b4e9ecd77e106fcbadc95e0671c611b136456a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 15 Sep 2008 08:25:47 +0000 Subject: [PATCH] select current column when Ctrl-Space is pressed; the current row when Shift-Space is and everything on Shift-Ctrl-Space git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55638 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/grid.cpp | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 1d30f7baf5..c86a760755 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -7117,25 +7117,34 @@ void wxGrid::OnKeyDown( wxKeyEvent& event ) break; case WXK_SPACE: - if ( event.ControlDown() ) + // Ctrl-Space selects the current column, Shift-Space -- the + // current row and Ctrl-Shift-Space -- everything + switch ( m_selection ? event.GetModifiers() : wxMOD_NONE ) { - if ( m_selection ) - { - m_selection->ToggleCellSelection( - m_currentCellCoords.GetRow(), - m_currentCellCoords.GetCol(), - event.ControlDown(), - event.ShiftDown(), - event.AltDown(), - event.MetaDown() ); - } - break; - } + case wxMOD_CONTROL: + m_selection->SelectCol(m_currentCellCoords.GetCol()); + break; - if ( !IsEditable() ) - MoveCursorRight( false ); - else - event.Skip(); + case wxMOD_SHIFT: + m_selection->SelectRow(m_currentCellCoords.GetRow()); + break; + + case wxMOD_CONTROL | wxMOD_SHIFT: + m_selection->SelectBlock(0, 0, + m_numRows - 1, m_numCols - 1); + break; + + case wxMOD_NONE: + if ( !IsEditable() ) + { + MoveCursorRight(false); + break; + } + //else: fall through + + default: + event.Skip(); + } break; default: -- 2.45.2