[EXPLORER]

- Correct tray icon image list handling. Patch by Joachim Henze
CORE-10257 #resolve

svn path=/trunk/; revision=69508
This commit is contained in:
Thomas Faber 2015-10-12 10:05:39 +00:00
parent c4b93ac3c5
commit 350351aa24

View file

@ -163,14 +163,8 @@ public:
if (iconData->uFlags & NIF_ICON) if (iconData->uFlags & NIF_ICON)
{ {
TBBUTTONINFO tbbiOld = { 0 };
tbbiOld.cbSize = sizeof(tbbiOld);
tbbiOld.dwMask = TBIF_BYINDEX | TBIF_IMAGE;
GetButtonInfo(index, &tbbiOld);
tbbi.dwMask |= TBIF_IMAGE; tbbi.dwMask |= TBIF_IMAGE;
tbbi.iImage = ImageList_ReplaceIcon(m_ImageList, tbbiOld.iImage, iconData->hIcon); tbbi.iImage = ImageList_ReplaceIcon(m_ImageList, index, iconData->hIcon);
} }
if (iconData->uFlags & NIF_TIP) if (iconData->uFlags & NIF_TIP)
@ -215,16 +209,6 @@ public:
if (index < 0) if (index < 0)
return FALSE; return FALSE;
TBBUTTONINFO tbbiOld = { 0 };
tbbiOld.cbSize = sizeof(tbbiOld);
tbbiOld.dwMask = TBIF_BYINDEX | TBIF_IMAGE;
GetButtonInfo(index, &tbbiOld);
ImageList_Remove(m_ImageList, tbbiOld.iImage);
DeleteButton(index);
if (!(notifyItem->dwState & NIS_HIDDEN)) if (!(notifyItem->dwState & NIS_HIDDEN))
{ {
m_VisibleButtonCount--; m_VisibleButtonCount--;
@ -232,6 +216,22 @@ public:
delete notifyItem; delete notifyItem;
ImageList_Remove(m_ImageList, index);
int count = GetButtonCount();
/* shift all buttons one index to the left -- starting one index right
from item to delete -- to preserve their correct icon and tip */
for (int i = index; i < count - 1; i++)
{
notifyItem = GetItemData(i + 1);
SetItemData(i, notifyItem);
UpdateButton(notifyItem);
}
/* Delete the right-most, now obsolete button */
DeleteButton(count - 1);
return TRUE; return TRUE;
} }
@ -322,7 +322,7 @@ private:
LRESULT OnMouseEvent(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) LRESULT OnMouseEvent(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{ {
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
INT iBtn = HitTest(&pt); INT iBtn = HitTest(&pt);
if (iBtn >= 0) if (iBtn >= 0)