diff --git a/include/wx/generic/gridsel.h b/include/wx/generic/gridsel.h index aeed559ecc..3e078653e5 100644 --- a/include/wx/generic/gridsel.h +++ b/include/wx/generic/gridsel.h @@ -67,9 +67,10 @@ public: void UpdateRows( size_t pos, int numRows ); void UpdateCols( size_t pos, int numCols ); - // Extend (or shrink) the current selection block to the one specified by - // the start and end coordinates of its opposite corners (which don't have - // to be in top/bottom left/right order). + // Extend (or shrink) the current selection block (creating it if + // necessary, i.e. if there is no selection at all currently) to the one + // specified by the start and end coordinates of its opposite corners + // (which don't have to be in top/bottom left/right order). // // Note that blockStart is equal to wxGrid::m_currentCellCoords almost // always, but not always (the exception is when we scrolled out from @@ -80,9 +81,9 @@ public: // Both components of both blockStart and blockEnd must be valid. // // Return true if the current block was actually changed. - bool ExtendOrCreateCurrentBlock(const wxGridCellCoords& blockStart, - const wxGridCellCoords& blockEnd, - const wxKeyboardState& kbd); + bool ExtendCurrentBlock(const wxGridCellCoords& blockStart, + const wxGridCellCoords& blockEnd, + const wxKeyboardState& kbd); // Return the row of the current selection block if it exists and we can diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 6dfd5f9b72..b2f6fb9db2 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -3675,7 +3675,7 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event, wxGridRowLabelWindo if ( (row = YToRow( pos.y )) >= 0 ) { - m_selection->ExtendOrCreateCurrentBlock( + m_selection->ExtendCurrentBlock( wxGridCellCoords(m_currentCellCoords.GetRow(), 0), wxGridCellCoords(row, GetNumberCols() - 1), event); @@ -3728,7 +3728,7 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event, wxGridRowLabelWindo { // Continue editing the current selection and don't // move the grid cursor. - m_selection->ExtendOrCreateCurrentBlock + m_selection->ExtendCurrentBlock ( wxGridCellCoords(m_currentCellCoords.GetRow(), 0), wxGridCellCoords(row, GetNumberCols() - 1), @@ -4006,7 +4006,7 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event, wxGridColLabelWindo if ( !m_selection || m_numRows == 0 || m_numCols == 0 ) break; - m_selection->ExtendOrCreateCurrentBlock( + m_selection->ExtendCurrentBlock( wxGridCellCoords(0, m_currentCellCoords.GetCol()), wxGridCellCoords(GetNumberRows() - 1, col), event); @@ -4126,7 +4126,7 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event, wxGridColLabelWindo { // Continue editing the current selection and don't // move the grid cursor. - m_selection->ExtendOrCreateCurrentBlock + m_selection->ExtendCurrentBlock ( wxGridCellCoords(0, m_currentCellCoords.GetCol()), wxGridCellCoords(GetNumberRows() - 1, col), @@ -4490,7 +4490,7 @@ wxGrid::DoGridCellDrag(wxMouseEvent& event, // Edit the current selection block independently of the modifiers state. if ( m_selection ) - m_selection->ExtendOrCreateCurrentBlock(m_currentCellCoords, coords, event); + m_selection->ExtendCurrentBlock(m_currentCellCoords, coords, event); return performDefault; } @@ -4535,9 +4535,7 @@ wxGrid::DoGridCellLeftDown(wxMouseEvent& event, { if ( m_selection ) { - m_selection->ExtendOrCreateCurrentBlock(m_currentCellCoords, - coords, - event); + m_selection->ExtendCurrentBlock(m_currentCellCoords, coords, event); MakeCellVisible(coords); } } @@ -5789,7 +5787,7 @@ void wxGrid::OnKeyDown( wxKeyEvent& event ) if ( event.ShiftDown() ) { if ( m_selection ) - m_selection->ExtendOrCreateCurrentBlock( + m_selection->ExtendCurrentBlock( m_currentCellCoords, wxGridCellCoords(row, col), event); @@ -7978,9 +7976,9 @@ wxGrid::DoMoveCursor(const wxKeyboardState& kbdState, diroper.Advance(coords); - if ( m_selection->ExtendOrCreateCurrentBlock(m_currentCellCoords, - coords, - kbdState) ) + if ( m_selection->ExtendCurrentBlock(m_currentCellCoords, + coords, + kbdState) ) { // We want to show a line (a row or a column), not the end of // the selection block. And do it only if the selection block @@ -8129,9 +8127,9 @@ wxGrid::DoMoveCursorByBlock(const wxKeyboardState& kbdState, { if ( m_selection ) { - if ( m_selection->ExtendOrCreateCurrentBlock(m_currentCellCoords, - coords, - kbdState) ) + if ( m_selection->ExtendCurrentBlock(m_currentCellCoords, + coords, + kbdState) ) { // We want to show a line (a row or a column), not the end of // the selection block. And do it only if the selection block diff --git a/src/generic/gridsel.cpp b/src/generic/gridsel.cpp index a277c69647..bd1652f25d 100644 --- a/src/generic/gridsel.cpp +++ b/src/generic/gridsel.cpp @@ -482,9 +482,9 @@ void wxGridSelection::UpdateCols( size_t pos, int numCols ) } } -bool wxGridSelection::ExtendOrCreateCurrentBlock(const wxGridCellCoords& blockStart, - const wxGridCellCoords& blockEnd, - const wxKeyboardState& kbd) +bool wxGridSelection::ExtendCurrentBlock(const wxGridCellCoords& blockStart, + const wxGridCellCoords& blockEnd, + const wxKeyboardState& kbd) { wxASSERT( blockStart.GetRow() != -1 && blockStart.GetCol() != -1 && blockEnd.GetRow() != -1 && blockEnd.GetCol() != -1 );