Adjust rectangle coordinates returned by wxDataViewCtrl::GetItemRect()
Because query for item rectangle is executed in the context of wxDataViewCtrl so coordinates of retrieved rectangle should be specified in wxDataViewCtrl client coordinates (not in wxDataViewMainWindow coordinates). To return correct coordinates it is necessary to convert rectangle coordinates retrieved by wxDataViewMainWindow::GetItemRect() from wxDataViewMainWindow client coordinates to wxDataViewCtrl client coordinates (they can different due to the presence of the header in wxDataViewCtrl client area).
This commit is contained in:
@@ -5349,7 +5349,12 @@ void wxDataViewCtrl::HitTest( const wxPoint & point, wxDataViewItem & item,
|
||||
wxRect wxDataViewCtrl::GetItemRect( const wxDataViewItem & item,
|
||||
const wxDataViewColumn* column ) const
|
||||
{
|
||||
return m_clientArea->GetItemRect(item, column);
|
||||
// Convert position from the main window coordinates to the control coordinates.
|
||||
// (They can be different due to the presence of the header.).
|
||||
wxRect r = m_clientArea->GetItemRect(item, column);
|
||||
const wxPoint ctrlPos = ScreenToClient(m_clientArea->ClientToScreen(r.GetPosition()));
|
||||
r.SetPosition(ctrlPos);
|
||||
return r;
|
||||
}
|
||||
|
||||
wxDataViewItem wxDataViewCtrl::GetItemByRow( unsigned int row ) const
|
||||
|
Reference in New Issue
Block a user