예제 #1
0
//================================================
void SpecialFolder::UpdateFolder(void)
{
	// ---------------------------------------
	// remember the active item as text

	MenuItem *ActiveItem = m_pActiveItem;
	TCHAR *active_item_text = NULL;

	m_pLastChild = m_pChild;
	if (m_pLastChild) ActiveItem = m_pLastChild->m_pParentItem;
	if (ActiveItem) active_item_text = new_str(ActiveItem->m_pszTitle);

	// delete_old items
	DeleteMenuItems();

	// load the folder contents
	MenuItem *Items = NULL; int r = 0;

	struct pidl_node *p;
	dolist (p, m_pidl_list)
		r |= MenuMaker_LoadFolder(&Items, p->v, m_pszExtra);

	if (Items) add_folder_contents(Items, NULL != m_pidl_list->next);
	else if (r) MakeMenuNOP(this, NLS0(_T("No Files")));
	else MakeMenuNOP(this, NLS0(_T("Invalid Path")));

	// ---------------------------------------
	// search by text the previously active item

	if (active_item_text)
	{
		dolist (ActiveItem, m_pMenuItems)
			if (0 == _tcscmp(active_item_text, ActiveItem->m_pszTitle))
				break;

		free_str(&active_item_text);
	}

	// ---------------------------------------
	// possibly reconnect to an open child-folder

	if (m_pLastChild)
	{
		if (ActiveItem)
		{
			m_pLastChild->incref();
			ActiveItem->LinkSubmenu(m_pLastChild);
			m_pLastChild->LinkToParentItem(ActiveItem);
		}
		else
		{
			m_pLastChild->Hide(); // lost child
		}
		m_pLastChild = NULL;
	}

	if (ActiveItem) ActiveItem->Active(2);
}
예제 #2
0
파일: startmenu.c 프로젝트: Dimillian/wine
static void fill_menu(struct menu_item* item)
{
    if (!item->menu_filled)
    {
        add_folder_contents(item);

        if (item->base)
        {
            fill_menu(item->base);
        }

        item->menu_filled = TRUE;
    }
}