wxListBox in wxUniv need to overwrite DoListHistTest function, otherwise Listbox::HitTest will call DoListHitTest in wx/listbox.h, which will always return wxNOT_FOUND
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77792 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
831045ff45
commit
26ce3d6361
@ -116,6 +116,8 @@ protected:
|
||||
void **clientData,
|
||||
wxClientDataType type) wxOVERRIDE;
|
||||
|
||||
virtual int DoListHitTest(const wxPoint& point) const wxOVERRIDE;
|
||||
|
||||
// universal wxComboBox implementation internally uses wxListBox
|
||||
friend class WXDLLIMPEXP_FWD_CORE wxComboBox;
|
||||
|
||||
|
@ -1112,6 +1112,34 @@ void wxListBox::Activate(int item)
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// hittest
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int wxListBox::DoListHitTest(const wxPoint& point) const
|
||||
{
|
||||
if ( !GetClientRect().Contains(point) )
|
||||
return wxNOT_FOUND;
|
||||
|
||||
int y, index;
|
||||
|
||||
CalcUnscrolledPosition(0, point.y, NULL, &y);
|
||||
index = y / GetLineHeight();
|
||||
|
||||
if ( index < 0 )
|
||||
{
|
||||
// mouse is above the first item
|
||||
index = 0;
|
||||
}
|
||||
else if ( (unsigned int)index >= GetCount() )
|
||||
{
|
||||
// mouse is below the last item
|
||||
index= GetCount() - 1;
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// input handling
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user