X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b524b5c6f86062573c9a06a98290daaeb8d6ba01..3d3d7d0994d27260ddfa2db127f32b1515c5069b:/src/generic/grid.cpp diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 4d76b9be45..284143a62e 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -6618,6 +6618,32 @@ int wxGrid::SendEvent( const wxEventType type, claimed = GetEventHandler()->ProcessEvent(gridEvt); vetoed = !gridEvt.IsAllowed(); } + else if ( type == wxEVT_GRID_LABEL_LEFT_CLICK || + type == wxEVT_GRID_LABEL_LEFT_DCLICK || + type == wxEVT_GRID_LABEL_RIGHT_CLICK || + type == wxEVT_GRID_LABEL_RIGHT_DCLICK ) + { + wxPoint pos = mouseEv.GetPosition(); + + if ( mouseEv.GetEventObject() == GetGridRowLabelWindow() ) + pos.y += GetColLabelSize(); + if ( mouseEv.GetEventObject() == GetGridColLabelWindow() ) + pos.x += GetRowLabelSize(); + + wxGridEvent gridEvt( GetId(), + type, + this, + row, col, + pos.x, + pos.y, + false, + mouseEv.ControlDown(), + mouseEv.ShiftDown(), + mouseEv.AltDown(), + mouseEv.MetaDown() ); + claimed = GetEventHandler()->ProcessEvent(gridEvt); + vetoed = !gridEvt.IsAllowed(); + } else { wxGridEvent gridEvt( GetId(), @@ -8173,13 +8199,6 @@ void wxGrid::ShowCellEditControl() m_currentCellCoords.SetCol( col ); } - // convert to scrolled coords - CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y ); - - int nXMove = 0; - if (rect.x < 0) - nXMove = rect.x; - // erase the highlight and the cell contents because the editor // might not cover the entire cell wxClientDC dc( m_gridWin ); @@ -8188,6 +8207,13 @@ void wxGrid::ShowCellEditControl() dc.SetPen(*wxTRANSPARENT_PEN); dc.DrawRectangle(rect); + // convert to scrolled coords + CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y ); + + int nXMove = 0; + if (rect.x < 0) + nXMove = rect.x; + // cell is shifted by one pixel // However, don't allow x or y to become negative // since the SetSize() method interprets that as