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 BookmarkEditDlg::OnShellAsyncIcon(WPARAM wParam, LPARAM lParam)
{
    ShellIcon::AsyncIcon *sAsyncIcon = (ShellIcon::AsyncIcon *)wParam;
    if (sAsyncIcon == XPR_NULL)
        return 0;

    //if (sAsyncIcon->uCode == m_uCode)
    {
        xpr_sint_t sIndex = -1;
        BookmarkItem *sBookmarkItem = XPR_NULL;

        if (sAsyncIcon->mItem != -1 && sAsyncIcon->mItem >= 0)
        {
            sBookmarkItem = (BookmarkItem *)mListCtrl.GetItemData((xpr_sint_t)sAsyncIcon->mItem);
            if (sBookmarkItem != XPR_NULL && sBookmarkItem->getSignature() == sAsyncIcon->mSignature)
                sIndex = (xpr_sint_t)sAsyncIcon->mItem;
        }

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

        if (sIndex >= 0 && sBookmarkItem != XPR_NULL)
        {
            HICON sIcon = sAsyncIcon->mResult.mIcon;
            if (sIcon == XPR_NULL)
                sIcon = BookmarkMgr::instance().getTypeIcon(BookmarkMgr::IconTypeNot, XPR_TRUE);

            sBookmarkItem->setIcon(sIcon);

            sAsyncIcon->mResult.mIcon = XPR_NULL;

            xpr_sint_t sImage = mImgList.Add(sIcon);

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

    XPR_SAFE_DELETE(sAsyncIcon);

    return 0;
}
Beispiel #3
0
xpr_sint_t BookmarkEditDlg::findSignature(xpr_uint_t aSignature)
{
    xpr_sint_t i;
    xpr_sint_t sCount;
    BookmarkItem *sBookmarkItem;

    sCount = mListCtrl.GetItemCount();
    for (i = 0; i < sCount; ++i)
    {
        sBookmarkItem = (BookmarkItem *)mListCtrl.GetItemData(i);
        if (sBookmarkItem == XPR_NULL)
            continue;

        if (sBookmarkItem->getSignature() == aSignature)
            return i;
    }

    return -1;
}