本文整理汇总了C++中CGUIWindow::CanBeActivated方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIWindow::CanBeActivated方法的具体用法?C++ CGUIWindow::CanBeActivated怎么用?C++ CGUIWindow::CanBeActivated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIWindow
的用法示例。
在下文中一共展示了CGUIWindow::CanBeActivated方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ActivateWindow_Internal
void CGUIWindowManager::ActivateWindow_Internal(int iWindowID, const std::vector<std::string>& params, bool swappingWindows, bool force /* = false */)
{
// translate virtual windows
// virtual music window which returns the last open music window (aka the music start window)
if (iWindowID == WINDOW_MUSIC || iWindowID == WINDOW_MUSIC_FILES)
{ // backward compatibility for pre-something
iWindowID = WINDOW_MUSIC_NAV;
}
// virtual video window which returns the last open video window (aka the video start window)
if (iWindowID == WINDOW_VIDEOS || iWindowID == WINDOW_VIDEO_FILES)
{ // backward compatibility for pre-Eden
iWindowID = WINDOW_VIDEO_NAV;
}
if (iWindowID == WINDOW_SCRIPTS)
{ // backward compatibility for pre-Dharma
iWindowID = WINDOW_PROGRAMS;
}
if (iWindowID == WINDOW_START)
{ // virtual start window
iWindowID = g_SkinInfo->GetStartWindow();
}
// debug
CLog::Log(LOGDEBUG, "Activating window ID: %i", iWindowID);
if (!g_passwordManager.CheckMenuLock(iWindowID))
{
CLog::Log(LOGERROR, "MasterCode is Wrong: Window with id %d will not be loaded! Enter a correct MasterCode!", iWindowID);
if (GetActiveWindow() == WINDOW_INVALID && iWindowID != WINDOW_HOME)
ActivateWindow(WINDOW_HOME);
return;
}
// first check existence of the window we wish to activate.
CGUIWindow *pNewWindow = GetWindow(iWindowID);
if (!pNewWindow)
{ // nothing to see here - move along
CLog::Log(LOGERROR, "Unable to locate window with id %d. Check skin files", iWindowID - WINDOW_HOME);
return ;
}
else if (!pNewWindow->CanBeActivated())
{
return;
}
else if (pNewWindow->IsDialog())
{ // if we have a dialog, we do a DoModal() rather than activate the window
if (!pNewWindow->IsDialogRunning())
{
CSingleExit exitit(g_graphicsContext);
((CGUIDialog *)pNewWindow)->Open(params.size() > 0 ? params[0] : "");
}
return;
}
// don't activate a window if there are active modal dialogs of type NORMAL
if (!force && HasModalDialog({ DialogModalityType::MODAL }))
{
CLog::Log(LOGINFO, "Activate of window '%i' refused because there are active modal dialogs", iWindowID);
g_audioManager.PlayActionSound(CAction(ACTION_ERROR));
return;
}
g_infoManager.SetNextWindow(iWindowID);
// deactivate any window
int currentWindow = GetActiveWindow();
CGUIWindow *pWindow = GetWindow(currentWindow);
if (pWindow)
CloseWindowSync(pWindow, iWindowID);
g_infoManager.SetNextWindow(WINDOW_INVALID);
// Add window to the history list (we must do this before we activate it,
// as all messages done in WINDOW_INIT will want to be sent to the new
// topmost window). If we are swapping windows, we pop the old window
// off the history stack
if (swappingWindows && !m_windowHistory.empty())
m_windowHistory.pop();
AddToWindowHistory(iWindowID);
g_infoManager.SetPreviousWindow(currentWindow);
// Send the init message
CGUIMessage msg(GUI_MSG_WINDOW_INIT, 0, 0, currentWindow, iWindowID);
msg.SetStringParams(params);
pNewWindow->OnMessage(msg);
// g_infoManager.SetPreviousWindow(WINDOW_INVALID);
}