- default:
- wxFAIL_MSG( wxT("unknown tree item image type") );
- // fall through
-
- case wxTreeItemIcon_Normal:
- {
- const int imageNormalOld = GetItemImage(item);
- const int imageSelOld =
- GetItemImage(item, wxTreeItemIcon_Selected);
-
- // 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;
-
- case wxTreeItemIcon_Selected:
- imageNormal = GetItemImage(item);
- imageSel = image;
- break;
-
- case wxTreeItemIcon_Expanded:
- case wxTreeItemIcon_SelectedExpanded:
- if ( !HasIndirectData(item) )
- {
- // we need to get the old images first, because after we create
- // the wxTreeItemIndirectData GetItemXXXImage() will use it to
- // get the images
- imageNormal = GetItemImage(item);
- imageSel = GetItemImage(item, wxTreeItemIcon_Selected);
-
- // if it doesn't have it yet, add it
- wxTreeItemIndirectData *data = new
- wxTreeItemIndirectData(this, item);
-
- // copy the data to the new location
- data->SetImage(imageNormal, wxTreeItemIcon_Normal);
- data->SetImage(imageSel, wxTreeItemIcon_Selected);
- }
-
- DoSetItemImageFromData(item, image, which);
-
- // reset the normal/selected images because we won't use them any
- // more - now they're stored inside the indirect data
- imageNormal =
- imageSel = I_IMAGECALLBACK;
- break;
- }
-
- // NB: at least in version 5.00.0518.9 of comctl32.dll we need to always
- // change both normal and selected image - otherwise the change simply
- // doesn't take place!
- DoSetItemImages(item, imageNormal, imageSel);
-}
-
-wxTreeItemData *wxTreeCtrl::GetItemData(const wxTreeItemId& item) const
-{
- wxCHECK_MSG( item.IsOk(), NULL, wxT("invalid tree item") );
-
- wxTreeViewItem tvItem(item, TVIF_PARAM);
-
- // Hidden root may have data.
- if ( IS_VIRTUAL_ROOT(item) )
- {
- return GET_VIRTUAL_ROOT()->GetData();