本文整理汇总了C++中CContextButtons::end方法的典型用法代码示例。如果您正苦于以下问题:C++ CContextButtons::end方法的具体用法?C++ CContextButtons::end怎么用?C++ CContextButtons::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContextButtons
的用法示例。
在下文中一共展示了CContextButtons::end方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SourcesMenu
bool CGUIDialogContextMenu::SourcesMenu(const CStdString &strType, const CFileItemPtr item, float posX, float posY)
{
// TODO: This should be callable even if we don't have any valid items
if (!item)
return false;
// popup the context menu
CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)g_windowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU);
if (pMenu)
{
// load our menu
pMenu->Initialize();
// grab our context menu
CContextButtons buttons;
GetContextButtons(strType, item, buttons);
// add the buttons and execute it
for (CContextButtons::iterator it = buttons.begin(); it != buttons.end(); it++)
pMenu->AddButton((*it).second);
// position it correctly
pMenu->OffsetPosition(posX, posY);
pMenu->DoModal();
// translate our button press
CONTEXT_BUTTON btn = CONTEXT_BUTTON_CANCELLED;
if (pMenu->GetButton() > 0 && pMenu->GetButton() <= (int)buttons.size())
btn = buttons[pMenu->GetButton() - 1].first;
if (btn != CONTEXT_BUTTON_CANCELLED)
return OnContextButton(strType, item, btn);
}
return false;
}
示例2: OnPopupMenu
bool CGUIMediaWindow::OnPopupMenu(int iItem)
{
// popup the context menu
// grab our context menu
CContextButtons buttons;
GetContextButtons(iItem, buttons);
if (buttons.size())
{
// mark the item
if (iItem >= 0 && iItem < m_vecItems->Size())
m_vecItems->Get(iItem)->Select(true);
CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)m_gWindowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU);
if (!pMenu) return false;
// load our menu
pMenu->Initialize();
// add the buttons and execute it
for (CContextButtons::iterator it = buttons.begin(); it != buttons.end(); it++)
pMenu->AddButton((*it).second);
// position it correctly
float posX = 200;
float posY = 100;
const CGUIControl *pList = GetControl(CONTROL_VIEW_START);
if (pList)
{
posX = pList->GetXPosition() + pList->GetWidth() / 2;
posY = pList->GetYPosition() + pList->GetHeight() / 2;
}
pMenu->SetPosition(posX - pMenu->GetWidth() / 2, posY - pMenu->GetHeight() / 2);
pMenu->DoModal();
// translate our button press
CONTEXT_BUTTON btn = CONTEXT_BUTTON_CANCELLED;
if (pMenu->GetButton() > 0 && pMenu->GetButton() <= (int)buttons.size())
btn = buttons[pMenu->GetButton() - 1].first;
// deselect our item
if (iItem >= 0 && iItem < m_vecItems->Size())
m_vecItems->Get(iItem)->Select(false);
if (btn != CONTEXT_BUTTON_CANCELLED)
return OnContextButton(iItem, btn);
}
return false;
}
示例3: OnPopupMenu
bool CGUIMediaWindow::OnPopupMenu(int iItem)
{
// popup the context menu
// grab our context menu
CContextButtons buttons;
GetContextButtons(iItem, buttons);
if (buttons.size())
{
// mark the item
if (iItem >= 0 && iItem < m_vecItems->Size())
m_vecItems->Get(iItem)->Select(true);
CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)m_gWindowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU);
if (!pMenu) return false;
// load our menu
pMenu->Initialize();
// add the buttons and execute it
for (CContextButtons::iterator it = buttons.begin(); it != buttons.end(); it++)
pMenu->AddButton((*it).second);
// position it correctly
CPoint pos = GetContextPosition();
pMenu->OffsetPosition(pos.x, pos.y);
pMenu->DoModal();
// translate our button press
CONTEXT_BUTTON btn = CONTEXT_BUTTON_CANCELLED;
if (pMenu->GetButton() > 0 && pMenu->GetButton() <= (int)buttons.size())
btn = buttons[pMenu->GetButton() - 1].first;
// deselect our item
if (iItem >= 0 && iItem < m_vecItems->Size())
m_vecItems->Get(iItem)->Select(false);
if (btn != CONTEXT_BUTTON_CANCELLED)
return OnContextButton(iItem, btn);
}
return false;
}
示例4: AddVisibleItems
void CContextMenuManager::AddVisibleItems(
const CFileItemPtr& item, CContextButtons& list, const CContextMenuItem& root /* = CContextMenuItem::MAIN */)
{
if (!item)
return;
const int initialSize = list.size();
for (const auto& kv : m_items)
if (IsVisible(kv.second, root, item))
list.push_back(std::make_pair(kv.first, kv.second.GetLabel()));
if (root == MAIN || root == MANAGE)
{
std::stable_sort(list.begin() + initialSize, list.end(),
[](const std::pair<int, std::string>& lhs, const std::pair<int, std::string>& rhs)
{
return lhs.second < rhs.second;
}
);
}
}