account for scroll offset correctly in the mouse event handler

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57185 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-12-08 11:37:42 +00:00
parent 6090efab94
commit 04a33b5031

View File

@@ -134,7 +134,7 @@ int wxHeaderCtrl::GetColStart(unsigned int idx) const
{
wxHeaderCtrl * const self = const_cast<wxHeaderCtrl *>(this);
int pos = 0;
int pos = m_scrollOffset;
for ( unsigned n = 0; n < idx; n++ )
{
const wxHeaderColumnBase& col = self->GetColumn(n);
@@ -287,11 +287,14 @@ void wxHeaderCtrl::OnMouse(wxMouseEvent& mevent)
{
mevent.Skip();
// account for the control displacement
const int x = mevent.GetX() - m_scrollOffset;
// find if the event is over a column at all
bool onSeparator;
const unsigned col = mevent.Leaving()
? (onSeparator = false, COL_NONE)
: FindColumnAtPos(mevent.GetX(), onSeparator);
: FindColumnAtPos(x, onSeparator);
// update the highlighted column if it changed
if ( col != m_hover )