Adjust point coordinates in wxDataViewCtrl::HitTest

Point coordinates passed from wxDataViewCtrl::HitTest() to wxDataViewMainWindow::HitTest()
should be converted from wxDataViewCtrl client coordinates to wxDataViewMainWindow client coordinates because they can different due to the presence of the header in wxDataViewCtrl client area.
This commit is contained in:
Artur Wieczorek
2016-10-04 23:20:06 +02:00
parent fb5f6c4720
commit 2ec1bad4d6
3 changed files with 9 additions and 4 deletions

View File

@@ -107,6 +107,7 @@ All (GUI):
- Add wxEVT_STC_AUTOCOMP_COMPLETED event (NewPagodi). - Add wxEVT_STC_AUTOCOMP_COMPLETED event (NewPagodi).
- Fix retrieving bounding box for wxDC with transformed coordinates. - Fix retrieving bounding box for wxDC with transformed coordinates.
- Fix wxGraphicsMatrixData::Concat() for Direct2D and Cairo renderers. - Fix wxGraphicsMatrixData::Concat() for Direct2D and Cairo renderers.
- Fix calculating point position in wxDataViewCtrl::HitTest().
wxGTK: wxGTK:

View File

@@ -1485,7 +1485,9 @@ public:
bool HasSelection() const; bool HasSelection() const;
/** /**
Hittest. Retrieves item and column at the given point.
The point coordinates are specified in wxDataViewCtrl client area
coordinates.
*/ */
virtual void HitTest(const wxPoint& point, wxDataViewItem& item, virtual void HitTest(const wxPoint& point, wxDataViewItem& item,
wxDataViewColumn*& col) const; wxDataViewColumn*& col) const;
@@ -2398,8 +2400,7 @@ public:
const wxDataViewItem & item, const wxDataViewItem & item,
unsigned int col); unsigned int col);
/**
/**
Override this to render the cell. Override this to render the cell.
Before this is called, wxDataViewRenderer::SetValue was called Before this is called, wxDataViewRenderer::SetValue was called
so that this instance knows what to render. so that this instance knows what to render.

View File

@@ -5340,7 +5340,10 @@ void wxDataViewCtrl::EnsureVisible( const wxDataViewItem & item, const wxDataVie
void wxDataViewCtrl::HitTest( const wxPoint & point, wxDataViewItem & item, void wxDataViewCtrl::HitTest( const wxPoint & point, wxDataViewItem & item,
wxDataViewColumn* &column ) const wxDataViewColumn* &column ) const
{ {
m_clientArea->HitTest(point, item, column); // Convert from wxDataViewCtrl coordinates to wxDataViewMainWindow coordinates.
// (They can be different due to the presence of the header.).
const wxPoint clientPt = m_clientArea->ScreenToClient(ClientToScreen(point));
m_clientArea->HitTest(clientPt, item, column);
} }
wxRect wxDataViewCtrl::GetItemRect( const wxDataViewItem & item, wxRect wxDataViewCtrl::GetItemRect( const wxDataViewItem & item,