[ 1515520 ] wxOwnerDrawnComboBox mouse hover on partially visible item.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39946 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
5aeabc1a36
commit
276ebe79a6
@ -301,12 +301,30 @@ void wxVListBoxComboPopup::OnPopup()
|
|||||||
|
|
||||||
void wxVListBoxComboPopup::OnMouseMove(wxMouseEvent& event)
|
void wxVListBoxComboPopup::OnMouseMove(wxMouseEvent& event)
|
||||||
{
|
{
|
||||||
// Move selection to cursor if it is inside the popup
|
|
||||||
int itemHere = GetItemAtPosition(event.GetPosition());
|
|
||||||
if ( itemHere >= 0 )
|
|
||||||
wxVListBox::SetSelection(itemHere);
|
|
||||||
|
|
||||||
event.Skip();
|
event.Skip();
|
||||||
|
|
||||||
|
// Move selection to cursor if it is inside the popup
|
||||||
|
|
||||||
|
int y = event.GetPosition().y;
|
||||||
|
int fromBottom = GetClientSize().y - y;
|
||||||
|
|
||||||
|
// Since in any case we need to find out if the last item is only
|
||||||
|
// partially visible, we might just as well replicate the HitTest
|
||||||
|
// loop here.
|
||||||
|
const size_t lineMax = GetVisibleEnd();
|
||||||
|
for ( size_t line = GetVisibleBegin(); line < lineMax; line++ )
|
||||||
|
{
|
||||||
|
y -= OnGetLineHeight(line);
|
||||||
|
if ( y < 0 )
|
||||||
|
{
|
||||||
|
// Only change selection if item is fully visible
|
||||||
|
if ( (y + fromBottom) >= 0 )
|
||||||
|
{
|
||||||
|
wxVListBox::SetSelection((int)line);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxVListBoxComboPopup::OnLeftClick(wxMouseEvent& WXUNUSED(event))
|
void wxVListBoxComboPopup::OnLeftClick(wxMouseEvent& WXUNUSED(event))
|
||||||
|
Loading…
Reference in New Issue
Block a user