]> git.saurik.com Git - wxWidgets.git/commitdiff
select current column when Ctrl-Space is pressed; the current row when Shift-Space...
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 15 Sep 2008 08:25:47 +0000 (08:25 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 15 Sep 2008 08:25:47 +0000 (08:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55638 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/grid.cpp

index 1d30f7baf5d80880fb64630b7bdfff550275aa77..c86a76075538d93fedcb8a817838ccdc93ec6afa 100644 (file)
@@ -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: