X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/84912ef8b796a7c8d06171d43ae26f18b65a28e1..445783deeaa7b3d122c8017d364c30cf691f406c:/src/generic/grid.cpp?ds=sidebyside diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index c51c40cd96..7b2b3b3f43 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -474,7 +474,7 @@ void wxGridCellEditor::HandleReturn(wxKeyEvent& event) bool wxGridCellEditor::IsAcceptedKey(wxKeyEvent& event) { // accept the simple key presses, not anything with Ctrl/Alt/Meta - return !event.HasModifiers(); + return !(event.ControlDown() || event.AltDown()); } void wxGridCellEditor::StartingKey(wxKeyEvent& event) @@ -1393,6 +1393,7 @@ void wxGridCellEditorEvtHandler::OnKeyDown(wxKeyEvent& event) event.Skip( m_grid->ProcessEvent( event ) ); break; + case WXK_NUMPAD_ENTER: case WXK_RETURN: if (!m_grid->ProcessEvent(event)) m_editor->HandleReturn(event); @@ -1411,6 +1412,7 @@ void wxGridCellEditorEvtHandler::OnChar(wxKeyEvent& event) case WXK_ESCAPE: case WXK_TAB: case WXK_RETURN: + case WXK_NUMPAD_ENTER: break; default: @@ -5422,6 +5424,7 @@ void wxGrid::OnKeyDown( wxKeyEvent& event ) break; case WXK_RETURN: + case WXK_NUMPAD_ENTER: if ( event.ControlDown() ) { event.Skip(); // to let the edit control have the return @@ -8103,7 +8106,7 @@ void wxGrid::AutoSizeColOrRow( int colOrRow, bool setAsMin, bool column ) if ( column ) dc.GetTextExtent( GetColLabelValue(col), &w, &h ); else - dc.GetTextExtent( GetRowLabelValue(col), &w, &h ); + dc.GetTextExtent( GetRowLabelValue(row), &w, &h ); extent = column ? w : h; if ( extent > extentMax ) @@ -8272,6 +8275,52 @@ void wxGrid::SelectAll() m_selection->SelectBlock( 0, 0, m_numRows-1, m_numCols-1 ); } +// +// ------ Cell, row and col deselection +// + +void wxGrid::DeselectRow( int row ) +{ + if ( m_selection->GetSelectionMode() == wxGrid::wxGridSelectRows ) + { + if ( m_selection->IsInSelection(row, 0 ) ) + m_selection->ToggleCellSelection( row, 0); + } + else + { + int nCols = GetNumberCols(); + for ( int i = 0; i < nCols ; i++ ) + { + if ( m_selection->IsInSelection(row, i ) ) + m_selection->ToggleCellSelection( row, i); + } + } +} + +void wxGrid::DeselectCol( int col ) +{ + if ( m_selection->GetSelectionMode() == wxGrid::wxGridSelectColumns ) + { + if ( m_selection->IsInSelection(0, col ) ) + m_selection->ToggleCellSelection( 0, col); + } + else + { + int nRows = GetNumberRows(); + for ( int i = 0; i < nRows ; i++ ) + { + if ( m_selection->IsInSelection(i, col ) ) + m_selection->ToggleCellSelection(i, col); + } + } +} + +void wxGrid::DeselectCell( int row, int col ) +{ + if ( m_selection->IsInSelection(row, col) ) + m_selection->ToggleCellSelection(row, col); +} + bool wxGrid::IsSelection() { return ( m_selection->IsSelection() ||