本文整理汇总了C++中CGUIWindow::OnMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIWindow::OnMessage方法的具体用法?C++ CGUIWindow::OnMessage怎么用?C++ CGUIWindow::OnMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIWindow
的用法示例。
在下文中一共展示了CGUIWindow::OnMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendWindowMessage
bool CGUIControl::SendWindowMessage(CGUIMessage &message) const
{
CGUIWindow *pWindow = g_windowManager.GetWindow(GetParentID());
if (pWindow)
return pWindow->OnMessage(message);
return g_windowManager.SendMessage(message);
}
示例2: SendWindowMessage
bool CGUIControl::SendWindowMessage(CGUIMessage &message)
{
CGUIWindow *pWindow = m_gWindowManager.GetWindow(GetParentID());
if (pWindow)
return pWindow->OnMessage(message);
return g_graphicsContext.SendMessage(message);
}
示例3: DeInitialize
void CGUIWindowManager::DeInitialize()
{
CSingleLock lock(g_graphicsContext);
for (WindowMap::iterator it = m_mapWindows.begin(); it != m_mapWindows.end(); it++)
{
CGUIWindow* pWindow = (*it).second;
if (IsWindowActive(it->first))
{
pWindow->DisableAnimations();
CGUIMessage msg(GUI_MSG_WINDOW_DEINIT, 0, 0);
pWindow->OnMessage(msg);
}
pWindow->ResetControlStates();
pWindow->FreeResources(true);
}
UnloadNotOnDemandWindows();
m_vecMsgTargets.erase( m_vecMsgTargets.begin(), m_vecMsgTargets.end() );
// destroy our custom windows...
for (int i = 0; i < (int)m_vecCustomWindows.size(); i++)
{
CGUIWindow *pWindow = m_vecCustomWindows[i];
Remove(pWindow->GetID());
delete pWindow;
}
// clear our vectors of windows
m_vecCustomWindows.clear();
m_activeDialogs.clear();
m_initialized = false;
}
示例4: SendMessage
bool CGUIWindowManager::SendMessage(CGUIMessage& message, int window)
{
CGUIWindow* pWindow = GetWindow(window);
if(pWindow)
return pWindow->OnMessage(message);
else
return false;
}
示例5: Show
/*! \brief Show a picture.
* \param params The parameters.
* \details params[0] = URL of picture.
*/
static int Show(const std::vector<std::string>& params)
{
CGUIMessage msg(GUI_MSG_SHOW_PICTURE, 0, 0);
msg.SetStringParam(params[0]);
CGUIWindow *pWindow = CServiceBroker::GetGUI()->GetWindowManager().GetWindow(WINDOW_SLIDESHOW);
if (pWindow)
pWindow->OnMessage(msg);
return 0;
}
示例6: Execute
bool CGUIAction::Execute(int controlID, int parentID, int direction /*= 0*/) const
{
/*
参数:
1、
返回:
1、
说明:
1、此函数对m_actions 容器中的所有单元都进行处理了
*/
if (m_actions.size() == 0)
return false;
bool retval = false;
CGUIAction copy(*this); /* 对调用实例的一个复制,相当于哪个CGUIAction 实例调用此方法,copy 就是哪个实例*/
for (ciActions it = copy.m_actions.begin() ; it != copy.m_actions.end() ; it++)/* 遍历容器内的每个单元,每个单元都为一个条件与动作的匹配对*/
{
if (it->condition.IsEmpty() || g_infoManager.EvaluateBool(it->condition))
{
if (StringUtils::IsInteger(it->action))/* 是一个移动动作的消息,则向相应的窗口发送移动的消息*/
{
CGUIMessage msg(GUI_MSG_MOVE, parentID, controlID, direction);
if (parentID)/* 如果父窗口id 有效则向父窗口发送就行*/
{
CGUIWindow *pWindow = g_windowManager.GetWindow(parentID);
if (pWindow)
{
retval |= pWindow->OnMessage(msg);
continue;
}
}
retval |= g_windowManager.SendMessage(msg);
}
else /* 是一个执行动作的消息,则向相应的窗口发送执行的消息*/
{
CGUIMessage msg(GUI_MSG_EXECUTE, controlID, parentID);
msg.SetStringParam(it->action);
if (m_sendThreadMessages)
g_windowManager.SendThreadMessage(msg);
else
g_windowManager.SendMessage(msg);
retval |= true;
}
}
}
return retval;
}
示例7: SendMessage
bool CGUIWindowManager::SendMessage(CGUIMessage& message, int window)
{
if (window == 0)
// send to no specified windows.
return SendMessage(message);
CGUIWindow* pWindow = GetWindow(window);
if(pWindow)
return pWindow->OnMessage(message);
else
return false;
}
示例8: SendSearchMessage
void CGUIDialogKeyboard::SendSearchMessage()
{
CStdString utf8Edit;
g_charsetConverter.wToUTF8(m_strEdit, utf8Edit);
// send our search message (only the active window needs it)
CGUIMessage message(GUI_MSG_NOTIFY_ALL, GetID(), 0, GUI_MSG_SEARCH_UPDATE);
message.SetStringParam(utf8Edit);
CGUIWindow *window = g_windowManager.GetWindow(g_windowManager.GetActiveWindow());
if (window)
window->OnMessage(message);
}
示例9: SendMessage
bool CGUIWindowManager::SendMessage(CGUIMessage& message, int window)
{
/*
参数:
1、
返回:
1、
说明:
1、直接发送消息给指定的窗体,即直接调用此窗体
实例的OnMessage 方法
*/
CGUIWindow* pWindow = GetWindow(window);
if(pWindow)
return pWindow->OnMessage(message);
else
return false;
}
示例10: Slideshow
static int Slideshow(const std::vector<std::string>& params)
{
std::string beginSlidePath;
// leave RecursiveSlideShow command as-is
unsigned int flags = 0;
if (Recursive)
flags |= 1;
// SlideShow(dir[,recursive][,[not]random][,pause][,beginslide="/path/to/start/slide.jpg"])
// the beginslide value need be escaped (for '"' or '\' in it, by backslash)
// and then quoted, or not. See CUtil::SplitParams()
else
{
for (unsigned int i = 1 ; i < params.size() ; i++)
{
if (StringUtils::EqualsNoCase(params[i], "recursive"))
flags |= 1;
else if (StringUtils::EqualsNoCase(params[i], "random")) // set fullscreen or windowed
flags |= 2;
else if (StringUtils::EqualsNoCase(params[i], "notrandom"))
flags |= 4;
else if (StringUtils::EqualsNoCase(params[i], "pause"))
flags |= 8;
else if (StringUtils::StartsWithNoCase(params[i], "beginslide="))
beginSlidePath = params[i].substr(11);
}
}
CGUIMessage msg(GUI_MSG_START_SLIDESHOW, 0, 0, flags);
std::vector<std::string> strParams;
strParams.push_back(params[0]);
strParams.push_back(beginSlidePath);
msg.SetStringParams(strParams);
CGUIWindow *pWindow = CServiceBroker::GetGUI()->GetWindowManager().GetWindow(WINDOW_SLIDESHOW);
if (pWindow)
pWindow->OnMessage(msg);
return 0;
}
示例11: PreviousWindow
void CGUIWindowManager::PreviousWindow()
{
// deactivate any window
CSingleLock lock(g_graphicsContext);
CLog::Log(LOGDEBUG,"CGUIWindowManager::PreviousWindow: Deactivate");
int currentWindow = GetActiveWindow();
CGUIWindow *pCurrentWindow = GetWindow(currentWindow);
if (!pCurrentWindow)
return; // no windows or window history yet
// check to see whether our current window has a <previouswindow> tag
if (pCurrentWindow->GetPreviousWindow() != WINDOW_INVALID)
{
// TODO: we may need to test here for the
// whether our history should be changed
// don't reactivate the previouswindow if it is ourselves.
if (currentWindow != pCurrentWindow->GetPreviousWindow())
ActivateWindow(pCurrentWindow->GetPreviousWindow());
return;
}
// get the previous window in our stack
if (m_windowHistory.size() < 2)
{ // no previous window history yet - check if we should just activate home
if (GetActiveWindow() != WINDOW_INVALID && GetActiveWindow() != WINDOW_HOME)
{
ClearWindowHistory();
ActivateWindow(WINDOW_HOME);
}
return;
}
m_windowHistory.pop();
int previousWindow = GetActiveWindow();
m_windowHistory.push(currentWindow);
CGUIWindow *pNewWindow = GetWindow(previousWindow);
if (!pNewWindow)
{
CLog::Log(LOGERROR, "Unable to activate the previous window");
ClearWindowHistory();
ActivateWindow(WINDOW_HOME);
return;
}
// ok to go to the previous window now
// tell our info manager which window we are going to
g_infoManager.SetNextWindow(previousWindow);
// set our overlay state (enables out animations on window change)
HideOverlay(pNewWindow->GetOverlayState());
// deinitialize our window
CloseWindowSync(pCurrentWindow);
g_infoManager.SetNextWindow(WINDOW_INVALID);
g_infoManager.SetPreviousWindow(currentWindow);
// remove the current window off our window stack
m_windowHistory.pop();
// ok, initialize the new window
CLog::Log(LOGDEBUG,"CGUIWindowManager::PreviousWindow: Activate new");
CGUIMessage msg2(GUI_MSG_WINDOW_INIT, 0, 0, WINDOW_INVALID, GetActiveWindow());
pNewWindow->OnMessage(msg2);
g_infoManager.SetPreviousWindow(WINDOW_INVALID);
return;
}
示例12: PreviousWindow
void CGUIWindowManager::PreviousWindow()
{
/*
参数:
1、
返回:
1、
说明:
1、此函数实现激活上一个窗体的功能
2、函数执行的原理:
根据窗体操作栈(m_windowHistory) 来实现的
*/
// deactivate any window
CSingleLock lock(g_graphicsContext);
CLog::Log(LOGDEBUG,"CGUIWindowManager::PreviousWindow: Deactivate");
int currentWindow = GetActiveWindow(); /* 获取当前激活窗体的id 号*/
CGUIWindow *pCurrentWindow = GetWindow(currentWindow); /* 获取当前激活窗体指针*/
if (!pCurrentWindow)/* 没有当前被激活的窗体*/
return; // no windows or window history yet
// check to see whether our current window has a <previouswindow> tag
if (pCurrentWindow->GetPreviousWindow() != WINDOW_INVALID)/* 获取当前窗体是否具有上一个窗体的标记*/
{
// TODO: we may need to test here for the
// whether our history should be changed
// don't reactivate the previouswindow if it is ourselves.
if (currentWindow != pCurrentWindow->GetPreviousWindow())
ActivateWindow(pCurrentWindow->GetPreviousWindow());/* 激活上一个窗体*/
return;/* 返回*/
}
/*
执行到此处时只能是从窗体的历史记录中获取上一个窗体进行激活了
*/
// get the previous window in our stack
/* 窗体操作记录总数少于2 个,则激活home 窗体*/
if (m_windowHistory.size() < 2)
{ // no previous window history yet - check if we should just activate home
if (GetActiveWindow() != WINDOW_INVALID && GetActiveWindow() != WINDOW_HOME)/* 当前窗体有效,并且不是home 窗体,则激活home 窗体,否则直接返回了*/
{
ClearWindowHistory();
ActivateWindow(WINDOW_HOME);
}
return; /* 返回*/
}
/*
执行到此处时窗体操作栈中的数量肯定是大于等于2 个,因此需要从窗体操作栈中获取前一个窗体
*/
/* 如下三行代码就是从窗体的操作记录表( 窗体操作栈) 中取出当前窗体前一个窗体的id 号*/
m_windowHistory.pop(); /* 将当前激活的窗体出栈*/
int previousWindow = GetActiveWindow(); /* 取出当前窗体的前一个窗体,即当前窗体出栈后栈顶的那个窗体*/
m_windowHistory.push(currentWindow); /* 再将当前激活的窗体入栈*/
CGUIWindow *pNewWindow = GetWindow(previousWindow);/* 根据前一个窗体的id 号取出窗体的指针*/
if (!pNewWindow)/* 没得到前一个窗体的指针则清除窗体操作记录栈,将home 窗体激活*/
{
CLog::Log(LOGERROR, "Unable to activate the previous window");
ClearWindowHistory();
ActivateWindow(WINDOW_HOME);
return;
}
/*
执行到此处时获得到了前一个窗体的指针
*/
// ok to go to the previous window now
//-------------------------------------------------------->>> 调用SetNextWindow 开始
// tell our info manager which window we are going to
g_infoManager.SetNextWindow(previousWindow);
// set our overlay state (enables out animations on window change)
HideOverlay(pNewWindow->GetOverlayState());
// deinitialize our window
CloseWindowSync(pCurrentWindow);
//-------------------------------------------------------->>> 调用SetNextWindow 结束
g_infoManager.SetNextWindow(WINDOW_INVALID);
g_infoManager.SetPreviousWindow(currentWindow);
// remove the current window off our window stack
m_windowHistory.pop();
// ok, initialize the new window
CLog::Log(LOGDEBUG,"CGUIWindowManager::PreviousWindow: Activate new");
CGUIMessage msg2(GUI_MSG_WINDOW_INIT, 0, 0, WINDOW_INVALID, GetActiveWindow());
pNewWindow->OnMessage(msg2);
//.........这里部分代码省略.........
示例13: 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);
}
示例14: PreviousWindow
void CGUIWindowManager::PreviousWindow()
{
// deactivate any window
CSingleLock lock(g_graphicsContext);
CLog::Log(LOGDEBUG,"CGUIWindowManager::PreviousWindow: Deactivate");
int currentWindow = GetActiveWindow();
CGUIWindow *pCurrentWindow = GetWindow(currentWindow);
if (!pCurrentWindow)
return; // no windows or window history yet
// check to see whether our current window has a <previouswindow> tag
if (pCurrentWindow->GetPreviousWindow() != WINDOW_INVALID)
{
//! @todo we may need to test here for the
//! whether our history should be changed
// don't reactivate the previouswindow if it is ourselves.
if (currentWindow != pCurrentWindow->GetPreviousWindow())
ActivateWindow(pCurrentWindow->GetPreviousWindow());
return;
}
// get the previous window in our stack
if (m_windowHistory.size() < 2)
{
// no previous window history yet - check if we should just activate home
if (GetActiveWindow() != WINDOW_INVALID && GetActiveWindow() != WINDOW_HOME)
{
CloseWindowSync(pCurrentWindow);
ClearWindowHistory();
ActivateWindow(WINDOW_HOME);
}
return;
}
m_windowHistory.pop();
int previousWindow = GetActiveWindow();
m_windowHistory.push(currentWindow);
CGUIWindow *pNewWindow = GetWindow(previousWindow);
if (!pNewWindow)
{
CLog::Log(LOGERROR, "Unable to activate the previous window");
CloseWindowSync(pCurrentWindow);
ClearWindowHistory();
ActivateWindow(WINDOW_HOME);
return;
}
// ok to go to the previous window now
// pause game when leaving fullscreen or resume game when entering fullscreen
if (g_application.m_pPlayer->IsPlayingGame())
{
if (previousWindow == WINDOW_FULLSCREEN_VIDEO && g_application.m_pPlayer->IsPaused())
g_application.OnAction(ACTION_PAUSE);
else if (currentWindow == WINDOW_FULLSCREEN_VIDEO && !g_application.m_pPlayer->IsPaused())
g_application.OnAction(ACTION_PAUSE);
}
// tell our info manager which window we are going to
g_infoManager.SetNextWindow(previousWindow);
// deinitialize our window
CloseWindowSync(pCurrentWindow);
g_infoManager.SetNextWindow(WINDOW_INVALID);
g_infoManager.SetPreviousWindow(currentWindow);
// remove the current window off our window stack
m_windowHistory.pop();
// ok, initialize the new window
CLog::Log(LOGDEBUG,"CGUIWindowManager::PreviousWindow: Activate new");
CGUIMessage msg2(GUI_MSG_WINDOW_INIT, 0, 0, WINDOW_INVALID, GetActiveWindow());
pNewWindow->OnMessage(msg2);
g_infoManager.SetPreviousWindow(WINDOW_INVALID);
return;
}
示例15: ActivateWindow_Internal
void CGUIWindowManager::ActivateWindow_Internal(int iWindowID, const vector<CStdString>& params, bool swappingWindows)
{
bool passParams = true;
// translate virtual windows
// virtual music window which returns the last open music window (aka the music start window)
if (iWindowID == WINDOW_MUSIC)
{
iWindowID = g_stSettings.m_iMyMusicStartWindow;
// ensure the music virtual window only returns music files and music library windows
if (iWindowID != WINDOW_MUSIC_NAV)
iWindowID = WINDOW_MUSIC_FILES;
// destination path cannot be used with virtual window
passParams = false;
}
// virtual video window which returns the last open video window (aka the video start window)
if (iWindowID == WINDOW_VIDEOS)
{
iWindowID = g_stSettings.m_iVideoStartWindow;
// ensure the virtual video window only returns video windows
if (iWindowID != WINDOW_VIDEO_NAV)
iWindowID = WINDOW_VIDEO_FILES;
// destination path cannot be used with virtual window
passParams = false;
}
// stop video player when entering home screen
if(iWindowID == WINDOW_HOME && g_application.IsPlayingVideo())
{
CLog::Log(LOGDEBUG,"CGUIWindowManager::ActivateWindow_Internal - [iWindowID=%d=WINDOW_HOME][IsPlayingVideo=TRUE] - Going to stop the video (ev)",iWindowID);
g_application.StopPlaying();
}
// 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);
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->IsDialog())
{ // if we have a dialog, we do a DoModal() rather than activate the window
if (!pNewWindow->IsDialogRunning())
((CGUIDialog *)pNewWindow)->DoModal(iWindowID, (passParams && params.size()) ? params[0] : "");
return;
}
g_infoManager.SetNextWindow(iWindowID);
// set our overlay state
HideOverlay(pNewWindow->GetOverlayState());
// deactivate any window
int currentWindow = GetActiveWindow();
CGUIWindow *pWindow = GetWindow(currentWindow);
if (pWindow)
{
// If we got here from the screen saver, don't close the dialogs as we want to see
// them when we come back
if (!g_application.GetInSlideshowScreensaver())
CloseDialogs();
// Play the window specific deinit sound
g_audioManager.PlayWindowSound(pWindow->GetID(), SOUND_DEINIT);
CGUIMessage msg(GUI_MSG_WINDOW_DEINIT, 0, 0, iWindowID);
pWindow->OnMessage(msg);
}
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.size())
m_windowHistory.pop();
AddToWindowHistory(iWindowID);
g_infoManager.SetPreviousWindow(currentWindow);
g_audioManager.PlayWindowSound(pNewWindow->GetID(), SOUND_INIT);
// Send the init message
CGUIMessage msg(GUI_MSG_WINDOW_INIT, 0, 0, currentWindow, iWindowID);
if (passParams)
msg.SetStringParams(params);
pNewWindow->OnMessage(msg);
// g_infoManager.SetPreviousWindow(WINDOW_INVALID);
}