当前位置: 首页>>代码示例>>C++>>正文


C++ CGUIDialogContextMenu::CenterWindow方法代码示例

本文整理汇总了C++中CGUIDialogContextMenu::CenterWindow方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIDialogContextMenu::CenterWindow方法的具体用法?C++ CGUIDialogContextMenu::CenterWindow怎么用?C++ CGUIDialogContextMenu::CenterWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CGUIDialogContextMenu的用法示例。


在下文中一共展示了CGUIDialogContextMenu::CenterWindow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SwitchMedia

void CGUIDialogContextMenu::SwitchMedia(const CStdString& strType, const CStdString& strPath)
{
    // what should we display?
    vector <CStdString> vecTypes;
    if (!strType.Equals("music"))
        vecTypes.push_back(g_localizeStrings.Get(2)); // My Music
    if (!strType.Equals("video"))
        vecTypes.push_back(g_localizeStrings.Get(3)); // My Videos
    if (!strType.Equals("pictures"))
        vecTypes.push_back(g_localizeStrings.Get(1)); // My Pictures
    if (!strType.Equals("files"))
        vecTypes.push_back(g_localizeStrings.Get(7)); // My Files

    // something went wrong
    if (vecTypes.size() != 3)
        return;

    // create menu
    CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)m_gWindowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU);
    pMenu->Initialize();

    // add buttons
    int btn_Type[3];
    for (int i=0; i<3; i++)
    {
        btn_Type[i] = pMenu->AddButton(vecTypes[i]);
    }

    // display menu
    pMenu->CenterWindow();
    pMenu->DoModal();

    // check selection
    int btn = pMenu->GetButton();
    for (int i=0; i<3; i++)
    {
        if (btn == btn_Type[i])
        {
            // map back to correct window
            int iWindow = WINDOW_INVALID;
            if (vecTypes[i].Equals(g_localizeStrings.Get(2)))
                iWindow = WINDOW_MUSIC_FILES;
            else if (vecTypes[i].Equals(g_localizeStrings.Get(3)))
                iWindow = WINDOW_VIDEO_FILES;
            else if (vecTypes[i].Equals(g_localizeStrings.Get(1)))
                iWindow = WINDOW_PICTURES;
            else if (vecTypes[i].Equals(g_localizeStrings.Get(7)))
                iWindow = WINDOW_FILES;

            //m_gWindowManager.ActivateWindow(iWindow, strPath);
            CUtil::ClearFileItemCache();
            m_gWindowManager.ChangeActiveWindow(iWindow, strPath);
            return;
        }
    }
    return;
}
开发者ID:aaronjb,项目名称:plex,代码行数:57,代码来源:GUIDialogContextMenu.cpp

示例2: SelectPlayerDialog

EPLAYERCORES CPlayerCoreFactory::SelectPlayerDialog(VECPLAYERCORES &vecCores, float posX, float posY)
{

  CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)m_gWindowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU);

  // Reset menu
  pMenu->Initialize();

  // Add all possible players
  auto_aptr<int> btn_Cores(NULL);
  if( vecCores.size() > 0 )
  {    
    btn_Cores = new int[ vecCores.size() ];
    btn_Cores[0] = 0;

    CStdString strCaption;

    //Add default player
    strCaption = CPlayerCoreFactory::GetPlayerName(vecCores[0]);
    strCaption += " (";
    strCaption += g_localizeStrings.Get(13278);
    strCaption += ")";
    btn_Cores[0] = pMenu->AddButton(strCaption);

    //Add all other players
    for( unsigned int i = 1; i < vecCores.size(); i++ )
    {
      strCaption = CPlayerCoreFactory::GetPlayerName(vecCores[i]);
      btn_Cores[i] = pMenu->AddButton(strCaption);
    }
  }

  // Display menu
  if (posX && posY)
    pMenu->OffsetPosition(posX, posY);
  else
    pMenu->CenterWindow();
  pMenu->DoModal();

  //Check what player we selected
  int btnid = pMenu->GetButton();
  for( unsigned int i = 0; i < vecCores.size(); i++ )
  {
    if( btnid == btn_Cores[i] )
    {
      return vecCores[i];
    }
  }

  return EPC_NONE;
}
开发者ID:derobert,项目名称:debianlink-xbmc,代码行数:51,代码来源:PlayerCoreFactory.cpp


注:本文中的CGUIDialogContextMenu::CenterWindow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。