Merge branch 'qt_list_ctrl_hit_test_offset' of https://github.com/GeoTeric/wxWidgets into qt-listctrl

Fix wxListCtrl::HitTest() which was off roughly by 1 due to not taking
into account the header height.

Closes https://github.com/wxWidgets/wxWidgets/pull/1350
This commit is contained in:
Vadim Zeitlin
2019-09-22 01:20:42 +02:00
3 changed files with 17 additions and 5 deletions

View File

@@ -1543,7 +1543,8 @@ void MyListCtrl::OnContextMenu(wxContextMenuEvent& event)
{
point = ScreenToClient(point);
}
ShowContextMenu(point);
int flags;
ShowContextMenu(point, HitTest(point, flags));
}
else
{
@@ -1555,10 +1556,10 @@ void MyListCtrl::OnContextMenu(wxContextMenuEvent& event)
}
#endif
void MyListCtrl::ShowContextMenu(const wxPoint& pos)
void MyListCtrl::ShowContextMenu(const wxPoint& pos, long item)
{
wxMenu menu;
menu.Append(wxID_ANY, wxString::Format("Menu for item %ld", item));
menu.Append(wxID_ABOUT, "&About");
menu.AppendSeparator();
menu.Append(wxID_EXIT, "E&xit");