Improve HitTest in generic wxListCtrl

Detect when a checkbox is hit and return wxLIST_HITTEST_ONITEMSTATEICON.

Determine the correct location of the icon, it might be preceded by a
checkbox.

Return only the icon rectangle in GetSubItemRect with wxLIST_RECT_ICON,
not the padding or margins above/below the icon.

Closes #25764.
This commit is contained in:
Maarten Bent
2025-09-06 21:20:30 +02:00
committed by Vadim Zeitlin
parent 18711b55ba
commit 29c30d5917
3 changed files with 31 additions and 15 deletions
+1
View File
@@ -1491,6 +1491,7 @@ void MyListCtrl::OnRightClick(wxMouseEvent& event)
case wxLIST_HITTEST_NOWHERE: where = "nowhere near"; break;
case wxLIST_HITTEST_ONITEMICON: where = "on icon of"; break;
case wxLIST_HITTEST_ONITEMLABEL: where = "on label of"; break;
case wxLIST_HITTEST_ONITEMSTATEICON: where = "on checkbox of"; break;
case wxLIST_HITTEST_TOLEFT: where = "to the left of"; break;
case wxLIST_HITTEST_TORIGHT: where = "to the right of"; break;
default: where = "not clear exactly where on"; break;