don't return wxLIST_HITTEST_ONITEMICON from HitTest() when the muse is clicked to the right of the icon label

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29995 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2004-10-19 11:49:37 +00:00
parent d80fc6df55
commit 698b34facd

View File

@ -1426,23 +1426,38 @@ long wxListCtrl::HitTest(const wxPoint& point, int& flags)
ListView_HitTest(GetHwnd(), & hitTestInfo);
flags = 0;
if ( hitTestInfo.flags & LVHT_ABOVE )
flags |= wxLIST_HITTEST_ABOVE;
if ( hitTestInfo.flags & LVHT_BELOW )
flags |= wxLIST_HITTEST_BELOW;
if ( hitTestInfo.flags & LVHT_NOWHERE )
flags |= wxLIST_HITTEST_NOWHERE;
if ( hitTestInfo.flags & LVHT_ONITEMICON )
flags |= wxLIST_HITTEST_ONITEMICON;
if ( hitTestInfo.flags & LVHT_ONITEMLABEL )
flags |= wxLIST_HITTEST_ONITEMLABEL;
if ( hitTestInfo.flags & LVHT_ONITEMSTATEICON )
flags |= wxLIST_HITTEST_ONITEMSTATEICON;
if ( hitTestInfo.flags & LVHT_TOLEFT )
flags |= wxLIST_HITTEST_TOLEFT;
if ( hitTestInfo.flags & LVHT_TORIGHT )
flags |= wxLIST_HITTEST_TORIGHT;
if ( hitTestInfo.flags & LVHT_NOWHERE )
flags |= wxLIST_HITTEST_NOWHERE;
// note a bug or at least a very strange feature of comtl32.dll (tested
// with version 4.0 under Win95 and 6.0 under Win 2003): if you click to
// the right of the item label, ListView_HitTest() returns a combination of
// LVHT_ONITEMICON, LVHT_ONITEMLABEL and LVHT_ONITEMSTATEICON -- filter out
// the bits which don't make sense
if ( hitTestInfo.flags & LVHT_ONITEMLABEL )
{
flags |= wxLIST_HITTEST_ONITEMLABEL;
// do not translate LVHT_ONITEMICON here, as per above
}
else
{
if ( hitTestInfo.flags & LVHT_ONITEMICON )
flags |= wxLIST_HITTEST_ONITEMICON;
if ( hitTestInfo.flags & LVHT_ONITEMSTATEICON )
flags |= wxLIST_HITTEST_ONITEMSTATEICON;
}
return (long) hitTestInfo.iItem;
}