Beispiel #1
0
LRESULT BookmarkEditDlg::OnBookmarkAsyncIcon(WPARAM wParam, LPARAM lParam)
{
    xpr_sint_t sBookmarkIndex = (xpr_sint_t)wParam;
    BookmarkItem *sBookmarkItem = (BookmarkItem *)lParam;

    if (sBookmarkItem == XPR_NULL)
        return 0;

    xpr_sint_t sIndex = -1;
    BookmarkItem *sBookmarkItem2 = XPR_NULL;

    xpr_sint_t sCount = mListCtrl.GetItemCount();
    if (XPR_IS_RANGE(0, sBookmarkIndex, sCount-1))
    {
        sBookmarkItem2 = (BookmarkItem *)mListCtrl.GetItemData(sBookmarkIndex);
        if (sBookmarkItem2 != XPR_NULL && sBookmarkItem2->getSignature() == sBookmarkItem->getSignature())
            sIndex = sBookmarkIndex;
    }

    if (sIndex < 0)
    {
        sIndex = findSignature(sBookmarkItem->getSignature());
        if (sIndex >= 0)
            sBookmarkItem2 = (BookmarkItem *)mListCtrl.GetItemData(sIndex);
    }

    if (sIndex >= 0 && sBookmarkItem2 != XPR_NULL)
    {
        HICON sIcon = sBookmarkItem->getIcon();
        if (sIcon != XPR_NULL)
            sIcon = ::DuplicateIcon(XPR_NULL, sIcon);

        sBookmarkItem2->setIcon(sIcon);

        xpr_sint_t sImage = mImgList.Add(sIcon);

        LVITEM sLvItem = {0};
        sLvItem.mask   = LVIF_IMAGE;
        sLvItem.iItem  = sIndex;
        sLvItem.iImage = sImage;
        mListCtrl.SetItem(&sLvItem);
    }

    return 0;
}
Beispiel #2
0
LRESULT BookmarkToolBar::OnBookmarkAsyncIcon(WPARAM wParam, LPARAM lParam)
{
    xpr_sint_t sIndex = (xpr_sint_t)wParam;
    BookmarkItem *sBookmarkItem = (BookmarkItem *)lParam;

    if (sBookmarkItem == XPR_NULL)
        return 0;

    if (XPR_IS_RANGE(0, sIndex, BookmarkMgr::instance().getCount()-1))
    {
        TBBUTTONINFO sTbButtonInfo = {0};
        sTbButtonInfo.cbSize = sizeof(TBBUTTONINFO);
        sTbButtonInfo.dwMask = TBIF_BYINDEX | TBIF_IMAGE;
        sTbButtonInfo.iImage = mImgList.Add(sBookmarkItem->getIcon());

        GetToolBarCtrl().SetButtonInfo(sIndex, &sTbButtonInfo);
    }

    return 0;
}