X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/33188aa47a831abce261f17d6666fd9f2ffb8569..abcbaea73fa07b88ac681c78ea6933ba70a6fd72:/src/generic/grid.cpp?ds=inline diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index f480ab6911..5ff1ee3ecb 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -3510,7 +3510,7 @@ void wxGridWindow::OnEraseBackground( wxEraseEvent& WXUNUSED(event) ) // Internal helper macros for simpler use of that function static int CoordToRowOrCol(int coord, int defaultDist, int minDist, - wxArrayInt BorderArray, bool maxOnOverflow); + const wxArrayInt& BorderArray, bool maxOnOverflow); #define internalXToCol(x) CoordToRowOrCol(x, m_defaultColWidth, \ WXGRID_MIN_COL_WIDTH, \ @@ -4397,7 +4397,11 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event ) if ( event.Dragging() ) { - m_isDragging = TRUE; + if (!m_isDragging) + { + m_isDragging = TRUE; + m_rowLabelWin->CaptureMouse(); + } if ( event.LeftIsDown() ) { @@ -4443,8 +4447,14 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event ) return; } - m_isDragging = FALSE; + if ( m_isDragging && (event.Entering() || event.Leaving()) ) + return; + if (m_isDragging) + { + m_rowLabelWin->ReleaseMouse(); + m_isDragging = FALSE; + } // ------------ Entering or leaving the window // @@ -4583,7 +4593,11 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event ) if ( event.Dragging() ) { - m_isDragging = TRUE; + if (!m_isDragging) + { + m_isDragging = TRUE; + m_colLabelWin->CaptureMouse(); + } if ( event.LeftIsDown() ) { @@ -4629,8 +4643,14 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event ) return; } - m_isDragging = FALSE; + if ( m_isDragging && (event.Entering() || event.Leaving()) ) + return; + if (m_isDragging) + { + m_colLabelWin->ReleaseMouse(); + m_isDragging = FALSE; + } // ------------ Entering or leaving the window // @@ -6856,12 +6876,12 @@ void wxGrid::XYToCell( int x, int y, wxGridCellCoords& coords ) // of m_rowBottoms/m_ColRights to speed up the search! static int CoordToRowOrCol(int coord, int defaultDist, int minDist, - wxArrayInt BorderArray, bool maxOnOverflow) + const wxArrayInt& BorderArray, bool maxOnOverflow) { if (!defaultDist) defaultDist = 1; - int i_max = coord / defaultDist, - i_min = 0; + size_t i_max = coord / defaultDist, + i_min = 0; if (BorderArray.IsEmpty()) { return i_max; @@ -6880,7 +6900,7 @@ static int CoordToRowOrCol(int coord, int defaultDist, int minDist, i_max = BorderArray.GetCount() - 1; } if ( coord >= BorderArray[i_max]) - return (maxOnOverflow ? i_max : -1); + return maxOnOverflow ? (int)i_max : -1; if ( coord < BorderArray[0] ) return 0;