本文整理汇总了C++中MenuItem::Active方法的典型用法代码示例。如果您正苦于以下问题:C++ MenuItem::Active方法的具体用法?C++ MenuItem::Active怎么用?C++ MenuItem::Active使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MenuItem
的用法示例。
在下文中一共展示了MenuItem::Active方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateFolder
//================================================
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);
}