From b235987a69b93c4b567be441e3611e7a25ed69d1 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Fri, 4 Jan 2019 21:26:47 +0100 Subject: [PATCH] Use dedicated functions to covert between physical and logical coordinates of the scrolled wxPropertyGrid --- src/propgrid/propgrid.cpp | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 760f7ffaa3..e630dead3d 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -3810,12 +3810,8 @@ wxSize wxPropertyGrid::GetImageSize( wxPGProperty* p, int item ) const // takes scrolling into account void wxPropertyGrid::ImprovedClientToScreen( int* px, int* py ) { - int vx, vy; - GetViewStart(&vx,&vy); - vy*=wxPG_PIXELS_PER_UNIT; - vx*=wxPG_PIXELS_PER_UNIT; - *px -= vx; - *py -= vy; + wxASSERT(px && py); + CalcScrolledPosition(*px, *py, px, py); ClientToScreen( px, py ); } @@ -3823,14 +3819,7 @@ void wxPropertyGrid::ImprovedClientToScreen( int* px, int* py ) wxPropertyGridHitTestResult wxPropertyGrid::HitTest( const wxPoint& pt ) const { - wxPoint pt2; - GetViewStart(&pt2.x,&pt2.y); - pt2.x *= wxPG_PIXELS_PER_UNIT; - pt2.y *= wxPG_PIXELS_PER_UNIT; - pt2.x += pt.x; - pt2.y += pt.y; - - return m_pState->HitTest(pt2); + return m_pState->HitTest(CalcUnscrolledPosition(pt)); } // -----------------------------------------------------------------------