Return empty rect for wxLIST_RECT_ICON for subitems without icons

It doesn't make sense to return anything else than an empty rectangle
when querying the icon rectangle of the sub-items that can't show any
icon.

Also document this behaviour, just in case it's not obvious.
This commit is contained in:
Vadim Zeitlin
2019-08-27 16:38:25 +02:00
parent ba787af932
commit 0bf223be44
2 changed files with 15 additions and 0 deletions

View File

@@ -1230,6 +1230,16 @@ bool wxListCtrl::GetSubItemRect(long item, long subItem, wxRect& rect, int code)
break;
case wxLIST_RECT_ICON:
// Only the first subitem can have an icon, so it doesn't make
// sense to query the native control for the other ones --
// especially because it returns a nonsensical non-empty icon
// rectangle for them.
if ( subItem > 0 )
{
rect = wxRect();
return true;
}
codeWin = LVIR_ICON;
break;