From 9765b6d58e5c6ec19ce0f684da00f29e0d60aa3e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 21 Aug 2020 16:10:40 +0200 Subject: [PATCH] Send SELECTING events while selecting rows/columns too Generalize the changes of 415f080c80 (Split wxGrid RANGE_SELECT event into SELECTING and SELECTED, 2020-07-27) to the case when the mouse is dragged over row or column headers: also send SELECTING events while dragging and a SELECTED event at the end, whether it's due to releasing the mouse button or losing mouse capture. --- src/generic/grid.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 93a4d4764f..315e9c95b0 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -3678,7 +3678,8 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event, wxGridRowLabelWindo m_selection->ExtendCurrentBlock( wxGridCellCoords(m_currentCellCoords.GetRow(), 0), wxGridCellCoords(row, GetNumberCols() - 1), - event); + event, + wxEVT_GRID_RANGE_SELECTING); } } break; @@ -3695,9 +3696,6 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event, wxGridRowLabelWindo if ( m_isDragging && (event.Entering() || event.Leaving()) ) return; - if (m_isDragging) - m_isDragging = false; - // ------------ Entering or leaving the window // if ( event.Entering() || event.Leaving() ) @@ -3811,6 +3809,7 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event, wxGridRowLabelWindo ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL, rowLabelWin); m_dragLastPos = -1; + m_isDragging = false; } // ------------ Right button down @@ -4021,7 +4020,8 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event, wxGridColLabelWindo m_selection->ExtendCurrentBlock( wxGridCellCoords(0, m_currentCellCoords.GetCol()), wxGridCellCoords(GetNumberRows() - 1, col), - event); + event, + wxEVT_GRID_RANGE_SELECTING); } } break; @@ -4092,9 +4092,6 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event, wxGridColLabelWindo if ( m_isDragging && (event.Entering() || event.Leaving()) ) return; - if (m_isDragging) - m_isDragging = false; - // ------------ Entering or leaving the window // if ( event.Entering() || event.Leaving() ) @@ -4264,6 +4261,7 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event, wxGridColLabelWindo ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL, GetColLabelWindow()); m_dragLastPos = -1; + m_isDragging = false; } // ------------ Right button down