本文整理汇总了C++中CGUIDialogContextMenu::EnableButton方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIDialogContextMenu::EnableButton方法的具体用法?C++ CGUIDialogContextMenu::EnableButton怎么用?C++ CGUIDialogContextMenu::EnableButton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIDialogContextMenu
的用法示例。
在下文中一共展示了CGUIDialogContextMenu::EnableButton方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPopupMenu
void CGUIWindowFileManager::OnPopupMenu(int list, int item, bool bContextDriven /* = true */)
{
if (list < 0 || list > 2) return ;
bool bDeselect = SelectItem(list, item);
// calculate the position for our menu
float posX = 200;
float posY = 100;
const CGUIControl *pList = GetControl(CONTROL_LEFT_LIST + list);
if (pList)
{
posX = pList->GetXPosition() + pList->GetWidth() / 2;
posY = pList->GetYPosition() + pList->GetHeight() / 2;
}
CFileItemPtr pItem = m_vecItems[list]->Get(item);
if (!pItem.get())
return;
if (m_Directory[list]->IsVirtualDirectoryRoot())
{
if (item < 0)
{ // TODO: We should add the option here for shares to be added if there aren't any
return ;
}
// and do the popup menu
if (CGUIDialogContextMenu::SourcesMenu("files", pItem, posX, posY))
{
m_rootDir.SetSources(g_settings.m_fileSources);
if (m_Directory[1 - list]->IsVirtualDirectoryRoot())
Refresh();
else
Refresh(list);
return ;
}
pItem->Select(false);
return ;
}
// popup the context menu
CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)m_gWindowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU);
if (pMenu)
{
bool showEntry = false;
if (item >= m_vecItems[list]->Size()) item = -1;
if (item >= 0)
showEntry=(!pItem->IsParentFolder() || (pItem->IsParentFolder() && m_vecItems[list]->GetSelectedCount()>0));
// determine available players
VECPLAYERCORES vecCores;
CPlayerCoreFactory::GetPlayers(*pItem, vecCores);
// load our menu
pMenu->Initialize();
// add the needed buttons
int btn_SelectAll = pMenu->AddButton(188); // SelectAll
int btn_HandleFavourite; // Add/Remove Favourite
if (CFavourites::IsFavourite(pItem.get(), GetID()))
btn_HandleFavourite = pMenu->AddButton(14077);
else
btn_HandleFavourite = pMenu->AddButton(14076);
int btn_PlayUsing = pMenu->AddButton(15213); // Play Using ..
int btn_Rename = pMenu->AddButton(118); // Rename
int btn_Delete = pMenu->AddButton(117); // Delete
int btn_Copy = pMenu->AddButton(115); // Copy
int btn_Move = pMenu->AddButton(116); // Move
int btn_NewFolder = pMenu->AddButton(20309); // New Folder
int btn_Size = pMenu->AddButton(13393); // Calculate Size
int btn_Settings = pMenu->AddButton(5); // Settings
int btn_GoToRoot = pMenu->AddButton(20128); // Go To Root
int btn_Switch = pMenu->AddButton(523); // switch media
pMenu->EnableButton(btn_SelectAll, item >= 0);
pMenu->EnableButton(btn_HandleFavourite, item >=0 && !pItem->IsParentFolder());
pMenu->EnableButton(btn_PlayUsing, item >= 0 && vecCores.size() > 1);
pMenu->EnableButton(btn_Rename, item >= 0 && CanRename(list) && !pItem->IsParentFolder());
pMenu->EnableButton(btn_Delete, item >= 0 && CanDelete(list) && showEntry);
pMenu->EnableButton(btn_Copy, item >= 0 && CanCopy(list) && showEntry);
pMenu->EnableButton(btn_Move, item >= 0 && CanMove(list) && showEntry);
pMenu->EnableButton(btn_NewFolder, CanNewFolder(list));
pMenu->EnableButton(btn_Size, item >=0 && pItem->m_bIsFolder && !pItem->IsParentFolder());
// position it correctly
pMenu->OffsetPosition(posX, posY);
pMenu->DoModal();
int btnid = pMenu->GetButton();
if (btnid == btn_SelectAll)
{
OnSelectAll(list);
bDeselect=false;
}
if (btnid == btn_HandleFavourite)
{
CFavourites::AddOrRemove(pItem.get(), GetID());
return;
}
if (btnid == btn_PlayUsing)
{
VECPLAYERCORES vecCores;
//.........这里部分代码省略.........