Fix setting wxBK_HITTEST_xxx flags in wxNotebook::HitTest
The state represented by TCHT_ONITEM Win API flag is not a superposition TCHT_ONITEMICON and TCHT_ONITLABEL states but it represents a separate state. The fact that binary value of TCHT_ONITEM is bitwise-OR operation on TCHT_ONITEMICON and TCHT_ONITEMLABEL doesn't matter here. The same applies to wxBK_HITTEST_xxx flags where state represented by wxBK_HITTEST_ONITEM is not a superposition of wxBK_HITTEST_ONICON and wxBK_HITTEST_ONLABEL. Add note to wxBookCtrl::HitTest documentation that wxBK_HITTEST_ONICON, wxBK_HITTEST_ONLABEL, wxBK_HITTEST_ONITEM are mutually exclusive bits. See https://github.com/wxWidgets/wxWidgets/pull/159
This commit is contained in:
committed by
Vadim Zeitlin
parent
a016e6b896
commit
1237e932ad
@@ -750,15 +750,18 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
|
||||
*flags = 0;
|
||||
|
||||
if ((hitTestInfo.flags & TCHT_NOWHERE) == TCHT_NOWHERE)
|
||||
{
|
||||
wxASSERT( item == wxNOT_FOUND );
|
||||
*flags |= wxBK_HITTEST_NOWHERE;
|
||||
if ((hitTestInfo.flags & TCHT_ONITEM) == TCHT_ONITEM)
|
||||
if ( GetPageSize().Contains(pt) )
|
||||
*flags |= wxBK_HITTEST_ONPAGE;
|
||||
}
|
||||
else if ((hitTestInfo.flags & TCHT_ONITEM) == TCHT_ONITEM)
|
||||
*flags |= wxBK_HITTEST_ONITEM;
|
||||
if ((hitTestInfo.flags & TCHT_ONITEMICON) == TCHT_ONITEMICON)
|
||||
else if ((hitTestInfo.flags & TCHT_ONITEMICON) == TCHT_ONITEMICON)
|
||||
*flags |= wxBK_HITTEST_ONICON;
|
||||
if ((hitTestInfo.flags & TCHT_ONITEMLABEL) == TCHT_ONITEMLABEL)
|
||||
else if ((hitTestInfo.flags & TCHT_ONITEMLABEL) == TCHT_ONITEMLABEL)
|
||||
*flags |= wxBK_HITTEST_ONLABEL;
|
||||
if ( item == wxNOT_FOUND && GetPageSize().Contains(pt) )
|
||||
*flags |= wxBK_HITTEST_ONPAGE;
|
||||
}
|
||||
|
||||
return item;
|
||||
|
||||
Reference in New Issue
Block a user