keep selected image in sync with the normal one if it hasn't been changed (patch 754906)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21851 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
f9dae7798b
commit
7ab0c3adb7
@ -1012,15 +1012,28 @@ void wxTreeCtrl::SetItemImage(const wxTreeItemId& item, int image,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int imageNormal, imageSel;
|
int imageNormal,
|
||||||
|
imageSel;
|
||||||
|
|
||||||
switch ( which )
|
switch ( which )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
wxFAIL_MSG( wxT("unknown tree item image type") );
|
wxFAIL_MSG( wxT("unknown tree item image type") );
|
||||||
|
// fall through
|
||||||
|
|
||||||
case wxTreeItemIcon_Normal:
|
case wxTreeItemIcon_Normal:
|
||||||
imageNormal = image;
|
{
|
||||||
imageSel = GetItemSelectedImage(item);
|
const int imageNormalOld = GetItemImage(item);
|
||||||
|
const int imageSelOld = GetItemSelectedImage(item);
|
||||||
|
|
||||||
|
// always set the normal image
|
||||||
|
imageNormal = image;
|
||||||
|
|
||||||
|
// if the selected and normal images were the same, they should
|
||||||
|
// be the same after the update, otherwise leave the selected
|
||||||
|
// image as it was
|
||||||
|
imageSel = imageNormalOld == imageSelOld ? image : imageSelOld;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxTreeItemIcon_Selected:
|
case wxTreeItemIcon_Selected:
|
||||||
|
Loading…
Reference in New Issue
Block a user