Пример #1
0
void LoadFolder(Folder *pFolder, int iconsize, bool is_visible, HWND hwnd)
{
    struct pidl_node *pidl_list;
    LPCITEMIDLIST pIDFolder;

    pidl_list = get_folder_pidl_list (pFolder->path);
    pFolder->pidl_list = pidl_list;
    if (NULL==pidl_list)
        return;

    pIDFolder = first_pidl(pidl_list);
    pFolder->id_notify = add_change_notify_entry(hwnd, pIDFolder);

    Item **ppItems = &pFolder->items;
    while (pidl_list)
    {
        LPCITEMIDLIST pIDFolder = first_pidl(pidl_list);

        struct enum_files *ef;
        if (ef_open(pIDFolder, &ef) && is_visible)
        {
            while (ef_next(ef))
            {
                int attr;
                struct pidl_node *pidl;

                if (0 == ef_getpidl(ef, &pidl))
                    continue;
                ef_getattr(ef, &attr);

                Item *item = new Item;
                item->is_folder = 0 != (attr & ef_folder);
                item->data = pidl;
                sh_get_icon_and_name(first_pidl(pidl), &item->hIcon, iconsize, item->szTip, sizeof item->szTip);

                // add item to the list
                item -> next = *ppItems, *ppItems = item;
            }
            ef_close(ef);
        }
        pidl_list = pidl_list -> next;
    }
    pFolder->items = join_folders(pFolder->items);
}
Пример #2
0
void MenuItem::DrawIcon(HDC hDC)
{
    int size, px, py, d;
/*
    if (m_ItemID & MENUITEM_ID_FOLDER)
        return;
*/
    if (NULL == m_hIcon) {

        // if no icon yet, try to load it, either from explicit string
        // or from pidl_list

        if (m_pszIcon) {
            char path[MAX_PATH];
            const char *p;
            int index;

            p = Tokenize(m_pszIcon, path, ",");
            index = 0;
            if (p) {
                index = atoi(p);
                if (index)
                    --index;
            }
            unquote(path);
            ExtractIconEx(path, index, NULL, &m_hIcon, 1);

        } else if (m_pidl_list) {
			m_hIcon = sh_geticon(first_pidl(m_pidl_list), (Settings_menu.iconSize>16)?(32):(16));

        }

        if (NULL == m_hIcon)
            return;
    }

    size = MenuInfo.nIconSize;
    d = (m_nHeight - size) / 2;
    px = m_nLeft + d;
    py = m_nTop + d;
/*
    DrawIconEx(hDC,
        px, py, m_hIcon,
        size, size, 0,
        NULL, DI_NORMAL
        );
*/
    DrawIconSatnHue(hDC,
        px, py, m_hIcon,
        //size, size, 0,
		Settings_menu.iconSize, Settings_menu.iconSize, 0, /* BlackboxZero 1.4.2012 */
        NULL, DI_NORMAL,
        //false == m_bActive, 40, 0
		false == m_bActive, Settings_menu.iconSaturation, Settings_menu.iconHue /* BlackboxZero 1.3.2012 */
        );
}
Пример #3
0
LPCITEMIDLIST MenuItem::GetPidl(void)
{
    return m_pidl_list ? first_pidl(m_pidl_list) : NULL;
}