本文整理汇总了C++中CGUIControl::OnMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIControl::OnMessage方法的具体用法?C++ CGUIControl::OnMessage怎么用?C++ CGUIControl::OnMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIControl
的用法示例。
在下文中一共展示了CGUIControl::OnMessage方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendControlMessage
bool CGUIControlGroup::SendControlMessage(CGUIMessage &message)
{
// see if a child matches, and send to the child control if so
for (iControls it = m_children.begin();it != m_children.end(); ++it)
{
CGUIControl* control = *it;
if (control->HasVisibleID(message.GetControlId()))
{
if (control->OnMessage(message))
return true;
}
}
// Unhandled - send to all matching invisible controls as well
bool handled(false);
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
CGUIControl* control = *it;
if (control->HasID(message.GetControlId()))
{
if (control->OnMessage(message))
handled = true;
}
}
return handled;
}
示例2: OnMessage
bool CGUIWindowVisualisation::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_GET_VISUALISATION:
case GUI_MSG_VISUALISATION_RELOAD:
case GUI_MSG_PLAYBACK_STARTED:
{
CGUIControl *control = (CGUIControl *)GetControl(CONTROL_VIS);
if (control)
return control->OnMessage(message);
}
break;
case GUI_MSG_VISUALISATION_ACTION:
{
CAction action(message.GetParam1());
return OnAction(action);
}
case GUI_MSG_WINDOW_DEINIT:
{
if (IsActive()) // save any changed settings from the OSD
g_settings.Save();
// check and close any OSD windows
CGUIDialogMusicOSD *pOSD = (CGUIDialogMusicOSD *)g_windowManager.GetWindow(WINDOW_DIALOG_MUSIC_OSD);
if (pOSD && pOSD->IsDialogRunning()) pOSD->Close(true);
CGUIDialogVisualisationPresetList *pList = (CGUIDialogVisualisationPresetList *)g_windowManager.GetWindow(WINDOW_DIALOG_VIS_PRESET_LIST);
if (pList && pList->IsDialogRunning()) pList->Close(true);
}
break;
case GUI_MSG_WINDOW_INIT:
{
// check whether we've come back here from a window during which time we've actually
// stopped playing music
if (message.GetParam1() == WINDOW_INVALID && !g_application.IsPlayingAudio())
{ // why are we here if nothing is playing???
g_windowManager.PreviousWindow();
return true;
}
// hide or show the preset button(s)
g_infoManager.SetShowCodec(m_bShowPreset);
g_infoManager.SetShowInfo(true); // always show the info initially.
CGUIWindow::OnMessage(message);
if (g_infoManager.GetCurrentSongTag())
m_tag = *g_infoManager.GetCurrentSongTag();
if (g_settings.m_bMyMusicSongThumbInVis)
{ // always on
m_initTimer.Stop();
}
else
{
// start display init timer (fade out after 3 secs...)
m_initTimer.StartZero();
}
return true;
}
}
return CGUIWindow::OnMessage(message);
}
示例3: OnMessage
bool CGUIWindowVisualisation::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_GET_VISUALISATION:
case GUI_MSG_VISUALISATION_RELOAD:
case GUI_MSG_PLAYBACK_STARTED:
{
CGUIControl *control = GetControl(CONTROL_VIS);
if (control)
return control->OnMessage(message);
}
break;
case GUI_MSG_VISUALISATION_ACTION:
{
CAction action(message.GetParam1());
return OnAction(action);
}
case GUI_MSG_WINDOW_DEINIT:
{
if (IsActive()) // save any changed settings from the OSD
CServiceBroker::GetSettings().Save();
// close all active modal dialogs
CServiceBroker::GetGUI()->GetWindowManager().CloseInternalModalDialogs(true);
}
break;
case GUI_MSG_WINDOW_INIT:
{
// check whether we've come back here from a window during which time we've actually
// stopped playing music
if (message.GetParam1() == WINDOW_INVALID && !g_application.GetAppPlayer().IsPlayingAudio())
{ // why are we here if nothing is playing???
CServiceBroker::GetGUI()->GetWindowManager().PreviousWindow();
return true;
}
// hide or show the preset button(s)
CGUIInfoManager& infoMgr = CServiceBroker::GetGUI()->GetInfoManager();
infoMgr.GetInfoProviders().GetPlayerInfoProvider().SetShowInfo(true); // always show the info initially.
CGUIWindow::OnMessage(message);
if (infoMgr.GetCurrentSongTag())
m_tag = *infoMgr.GetCurrentSongTag();
if (CServiceBroker::GetSettings().GetBool(CSettings::SETTING_MYMUSIC_SONGTHUMBINVIS))
{ // always on
m_initTimer.Stop();
}
else
{
// start display init timer (fade out after 3 secs...)
m_initTimer.StartZero();
}
return true;
}
}
return CGUIWindow::OnMessage(message);
}
示例4: Character
void CGUIDialogKeyboardGeneric::Character(char ch)
{
if (!ch) return;
std::string character(1, ch);
// send text to edit control
CGUIControl *edit = GetControl(CTL_EDIT);
if (edit)
{
CGUIMessage msg(GUI_MSG_INPUT_TEXT, GetID(), CTL_EDIT);
msg.SetLabel(character);
edit->OnMessage(msg);
}
}
示例5: ControlGroupHasFocus
// returns true if the control group with id groupID has controlID as
// its focused control
bool CGUIWindow::ControlGroupHasFocus(int groupID, int controlID)
{
// 1. Run through and get control with groupID (assume unique)
// 2. Get it's selected item.
CGUIControl *group = GetFirstFocusableControl(groupID);
if (!group) group = (CGUIControl *)GetControl(groupID);
if (group && group->IsGroup())
{
if (controlID == 0)
{ // just want to know if the group is focused
return group->HasFocus();
}
else
{
CGUIMessage message(GUI_MSG_ITEM_SELECTED, GetID(), group->GetID());
group->OnMessage(message);
return (controlID == (int) message.GetParam1());
}
}
return false;
}
示例6: OnMessage
bool CGUIWindow::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_WINDOW_INIT:
{
CLog::Log(LOGDEBUG, "------ Window Init (%s) ------", GetProperty("xmlfile").c_str());
if (m_dynamicResourceAlloc || !m_bAllocated) AllocResources();
OnInitWindow();
return true;
}
break;
case GUI_MSG_WINDOW_DEINIT:
{
CLog::Log(LOGDEBUG, "------ Window Deinit (%s) ------", GetProperty("xmlfile").c_str());
OnDeinitWindow(message.GetParam1());
// now free the window
if (m_dynamicResourceAlloc) FreeResources();
return true;
}
break;
case GUI_MSG_CLICKED:
{
// a specific control was clicked
CLICK_EVENT clickEvent = m_mapClickEvents[ message.GetSenderId() ];
// determine if there are any handlers for this event
if (clickEvent.HasAHandler())
{
// fire the message to all handlers
clickEvent.Fire(message);
}
break;
}
case GUI_MSG_SELCHANGED:
{
// a selection within a specific control has changed
SELECTED_EVENT selectedEvent = m_mapSelectedEvents[ message.GetSenderId() ];
// determine if there are any handlers for this event
if (selectedEvent.HasAHandler())
{
// fire the message to all handlers
selectedEvent.Fire(message);
}
break;
}
case GUI_MSG_FOCUSED:
{ // a control has been focused
if (HasID(message.GetSenderId()))
{
m_focusedControl = message.GetControlId();
return true;
}
break;
}
case GUI_MSG_LOSTFOCUS:
{
// nothing to do at the window level when we lose focus
return true;
}
case GUI_MSG_MOVE:
{
if (HasID(message.GetSenderId()))
return OnMove(message.GetControlId(), message.GetParam1());
break;
}
case GUI_MSG_SETFOCUS:
{
// CLog::Log(LOGDEBUG,"set focus to control:%i window:%i (%i)\n", message.GetControlId(),message.GetSenderId(), GetID());
if ( message.GetControlId() )
{
// first unfocus the current control
CGUIControl *control = GetFocusedControl();
if (control)
{
CGUIMessage msgLostFocus(GUI_MSG_LOSTFOCUS, GetID(), control->GetID(), message.GetControlId());
control->OnMessage(msgLostFocus);
}
// get the control to focus
CGUIControl* pFocusedControl = GetFirstFocusableControl(message.GetControlId());
if (!pFocusedControl) pFocusedControl = (CGUIControl *)GetControl(message.GetControlId());
// and focus it
if (pFocusedControl)
return pFocusedControl->OnMessage(message);
}
return true;
}
break;
case GUI_MSG_EXCLUSIVE_MOUSE:
{
m_exclusiveMouseControl = message.GetSenderId();
return true;
}
break;
//.........这里部分代码省略.........
示例7: switch
bool CGUIControlGroup::OnMessage(CGUIMessage& message)
{
switch (message.GetMessage() )
{
case GUI_MSG_ITEM_SELECT:
{
if (message.GetControlId() == GetID())
{
m_focusedControl = message.GetParam1();
return true;
}
break;
}
case GUI_MSG_ITEM_SELECTED:
{
if (message.GetControlId() == GetID())
{
message.SetParam1(m_focusedControl);
return true;
}
break;
}
case GUI_MSG_FOCUSED:
{ // a control has been focused
m_focusedControl = message.GetControlId();
SetFocus(true);
// tell our parent thatwe have focus
if (m_parentControl)
m_parentControl->OnMessage(message);
return true;
}
case GUI_MSG_SETFOCUS:
{
// first try our last focused control...
if (!m_defaultAlways && m_focusedControl)
{
CGUIControl *control = GetFirstFocusableControl(m_focusedControl);
if (control)
{
CGUIMessage msg(GUI_MSG_SETFOCUS, GetParentID(), control->GetID());
return control->OnMessage(msg);
}
}
// ok, no previously focused control, try the default control first
if (m_defaultControl)
{
CGUIControl *control = GetFirstFocusableControl(m_defaultControl);
if (control)
{
CGUIMessage msg(GUI_MSG_SETFOCUS, GetParentID(), control->GetID());
return control->OnMessage(msg);
}
}
// no success with the default control, so just find one to focus
CGUIControl *control = GetFirstFocusableControl(0);
if (control)
{
CGUIMessage msg(GUI_MSG_SETFOCUS, GetParentID(), control->GetID());
return control->OnMessage(msg);
}
// unsuccessful
return false;
break;
}
case GUI_MSG_LOSTFOCUS:
{
// set all subcontrols unfocused
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
(*it)->SetFocus(false);
if (!HasID(message.GetParam1()))
{ // we don't have the new id, so unfocus
SetFocus(false);
if (m_parentControl)
m_parentControl->OnMessage(message);
}
return true;
}
break;
case GUI_MSG_PAGE_CHANGE:
case GUI_MSG_REFRESH_THUMBS:
case GUI_MSG_REFRESH_LIST:
case GUI_MSG_WINDOW_RESIZE:
{ // send to all child controls (make sure the target is the control id)
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
CGUIMessage msg(message.GetMessage(), message.GetSenderId(), (*it)->GetID(), message.GetParam1());
(*it)->OnMessage(msg);
}
return true;
}
break;
}
bool handled(false);
//not intented for any specific control, send to all childs and our base handler.
if (message.GetControlId() == 0)
{
for (iControls it = m_children.begin();it != m_children.end(); ++it)
{
CGUIControl* control = *it;
handled |= control->OnMessage(message);
//.........这里部分代码省略.........
示例8: OnMessage
bool CGUIDialogKeyboardGeneric::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
switch (iControl)
{
case CTL_BUTTON_DONE:
OnOK();
break;
case CTL_BUTTON_CANCEL:
Close();
break;
case CTL_BUTTON_SHIFT:
OnShift();
break;
case CTL_BUTTON_CAPS:
if (m_keyType == LOWER)
m_keyType = CAPS;
else if (m_keyType == CAPS)
m_keyType = LOWER;
UpdateButtons();
break;
case CTL_BUTTON_LAYOUT:
OnLayout();
break;
case CTL_BUTTON_SYMBOLS:
OnSymbols();
break;
case CTL_BUTTON_LEFT:
MoveCursor( -1);
break;
case CTL_BUTTON_RIGHT:
MoveCursor(1);
break;
case CTL_BUTTON_IP_ADDRESS:
OnIPAddress();
break;
case CTL_BUTTON_CLEAR:
SetEditText("");
break;
case CTL_EDIT:
{
CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), CTL_EDIT);
OnMessage(msg);
// update callback I guess?
if (m_pCharCallback)
{ // we did _something_, so make sure our search message filter is reset
m_pCharCallback(this, msg.GetLabel());
}
m_text = msg.GetLabel();
return true;
}
default:
OnClickButton(iControl);
break;
}
}
break;
case GUI_MSG_SET_TEXT:
case GUI_MSG_INPUT_TEXT_EDIT:
{
// the edit control only handles these messages if it is either focues
// or its specific control ID is set in the message. As neither is the
// case here (focus is on one of the keyboard buttons) we have to force
// the control ID of the message to the control ID of the edit control
// (unfortunately we have to create a whole copy of the message object for that)
CGUIMessage messageCopy(message.GetMessage(), message.GetSenderId(), CTL_EDIT, message.GetParam1(), message.GetParam2(), message.GetItem());
messageCopy.SetLabel(message.GetLabel());
// ensure this goes to the edit control
CGUIControl *edit = GetControl(CTL_EDIT);
if (edit)
edit->OnMessage(messageCopy);
// close the dialog if requested
if (message.GetMessage() == GUI_MSG_SET_TEXT && message.GetParam1() > 0)
OnOK();
return true;
}
}
return CGUIDialog::OnMessage(message);
}
示例9: SetCurrentView
void CGUIViewControl::SetCurrentView(int viewMode, bool bRefresh /* = false */)
{
// grab the previous control
CGUIControl *previousView = NULL;
if (m_currentView >= 0 && m_currentView < (int)m_visibleViews.size())
previousView = m_visibleViews[m_currentView];
UpdateViewVisibility();
// viewMode is of the form TYPE << 16 | ID
VIEW_TYPE type = (VIEW_TYPE)(viewMode >> 16);
int id = viewMode & 0xffff;
// first find a view that matches this view, if possible...
int newView = GetView(type, id);
if (newView < 0) // no suitable view that matches both id and type, so try just type
newView = GetView(type, 0);
if (newView < 0 && type == VIEW_TYPE_BIG_ICON) // try icon view if they want big icon
newView = GetView(VIEW_TYPE_ICON, 0);
if (newView < 0 && type == VIEW_TYPE_BIG_INFO)
newView = GetView(VIEW_TYPE_INFO, 0);
if (newView < 0) // try a list view
newView = GetView(VIEW_TYPE_LIST, 0);
if (newView < 0) // try anything!
newView = GetView(VIEW_TYPE_NONE, 0);
if (newView < 0)
return;
m_currentView = newView;
CGUIControl *pNewView = m_visibleViews[m_currentView];
// make only current control visible...
for (ciViews view = m_allViews.begin(); view != m_allViews.end(); ++view)
(*view)->SetVisible(false);
pNewView->SetVisible(true);
if (!bRefresh && pNewView == previousView)
return; // no need to actually update anything (other than visibility above)
// CLog::Log(LOGDEBUG,"SetCurrentView: Oldview: %i, Newview :%i", m_currentView, viewMode);
bool hasFocus(false);
int item = -1;
if (previousView)
{ // have an old view - let's clear it out and hide it.
hasFocus = previousView->HasFocus();
item = GetSelectedItem(previousView);
CGUIMessage msg(GUI_MSG_LABEL_RESET, m_parentWindow, previousView->GetID());
previousView->OnMessage(msg);
}
// Update it with the contents
UpdateContents(pNewView, item);
// and focus if necessary
if (hasFocus)
{
CGUIMessage msg(GUI_MSG_SETFOCUS, m_parentWindow, pNewView->GetID(), 0);
g_windowManager.SendMessage(msg, m_parentWindow);
}
UpdateViewAsControl(((IGUIContainer *)pNewView)->GetLabel());
}
示例10: OnMessage
bool CGUIWindow::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_WINDOW_LOAD:
{
Initialize();
return true;
}
break;
case GUI_MSG_WINDOW_INIT:
{
CLog::Log(LOGDEBUG, "------ Window Init (%s) ------", GetProperty("xmlfile").c_str());
if (m_dynamicResourceAlloc || !m_bAllocated) AllocResources(false);
OnInitWindow();
return true;
}
break;
case GUI_MSG_WINDOW_DEINIT:
{
CLog::Log(LOGDEBUG, "------ Window Deinit (%s) ------", GetProperty("xmlfile").c_str());
OnDeinitWindow(message.GetParam1());
// now free the window
if (m_dynamicResourceAlloc) FreeResources();
return true;
}
break;
case GUI_MSG_UNFOCUS_ALL:
{
//unfocus the current focused control in this window
CGUIControl *control = GetFocusedControl();
if(control)
{
//tell focused control that it has lost the focus
CGUIMessage msgLostFocus(GUI_MSG_LOSTFOCUS, GetID(), control->GetID(), control->GetID());
control->OnMessage(msgLostFocus);
CLog::Log(LOGDEBUG, "Unfocus WindowID: %i, ControlID: %i",GetID(), control->GetID());
}
return true;
}
case GUI_MSG_FOCUSED:
{ // a control has been focused
if (HasID(message.GetSenderId()))
{
m_focusedControl = message.GetControlId();
return true;
}
break;
}
case GUI_MSG_LOSTFOCUS:
{
// nothing to do at the window level when we lose focus
return true;
}
case GUI_MSG_MOVE:
{
if (HasID(message.GetSenderId()))
return OnMove(message.GetControlId(), message.GetParam1());
break;
}
case GUI_MSG_SETFOCUS:
{
// CLog::Log(LOGDEBUG,"set focus to control:%i window:%i (%i)\n", message.GetControlId(),message.GetSenderId(), GetID());
if ( message.GetControlId() )
{
// first unfocus the current control
CGUIControl *control = GetFocusedControl();
if (control)
{
CGUIMessage msgLostFocus(GUI_MSG_LOSTFOCUS, GetID(), control->GetID(), message.GetControlId());
control->OnMessage(msgLostFocus);
}
// get the control to focus
CGUIControl* pFocusedControl = GetFirstFocusableControl(message.GetControlId());
if (!pFocusedControl) pFocusedControl = GetControl(message.GetControlId());
// and focus it
if (pFocusedControl)
return pFocusedControl->OnMessage(message);
}
return true;
}
break;
case GUI_MSG_EXCLUSIVE_MOUSE:
{
m_exclusiveMouseControl = message.GetSenderId();
return true;
}
break;
case GUI_MSG_GESTURE_NOTIFY:
{
CAction action(ACTION_GESTURE_NOTIFY, 0, static_cast<float>(message.GetParam1()), static_cast<float>(message.GetParam2()), 0, 0);
EVENT_RESULT result = OnMouseAction(action);
auto res = new int(result);
message.SetPointer(static_cast<void*>(res));
//.........这里部分代码省略.........
示例11: OnMessage
bool CGUIDialogKeyboardGeneric::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
switch (iControl)
{
case CTL_BUTTON_DONE:
OnOK();
break;
case CTL_BUTTON_CANCEL:
Close();
break;
case CTL_BUTTON_SHIFT:
OnShift();
break;
case CTL_BUTTON_CAPS:
if (m_keyType == LOWER)
m_keyType = CAPS;
else if (m_keyType == CAPS)
m_keyType = LOWER;
UpdateButtons();
break;
case CTL_BUTTON_SYMBOLS:
OnSymbols();
break;
case CTL_BUTTON_LEFT:
MoveCursor( -1);
break;
case CTL_BUTTON_RIGHT:
MoveCursor(1);
break;
case CTL_BUTTON_IP_ADDRESS:
OnIPAddress();
break;
case CTL_BUTTON_CLEAR:
SetEditText("");
break;
case CTL_EDIT:
{
CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), CTL_EDIT);
OnMessage(msg);
// update callback I guess?
if (m_pCharCallback)
{ // we did _something_, so make sure our search message filter is reset
m_pCharCallback(this, msg.GetLabel());
}
m_text = msg.GetLabel();
return true;
}
default:
OnClickButton(iControl);
break;
}
}
break;
case GUI_MSG_SET_TEXT:
case GUI_MSG_INPUT_TEXT:
case GUI_MSG_INPUT_TEXT_EDIT:
{
// ensure this goes to the edit control
CGUIControl *edit = GetControl(CTL_EDIT);
if (edit)
edit->OnMessage(message);
// close the dialog if requested
if (message.GetMessage() == GUI_MSG_SET_TEXT && message.GetParam1() > 0)
OnOK();
return true;
}
}
return CGUIDialog::OnMessage(message);
}
示例12: ProcessMessage
//.........这里部分代码省略.........
break;
case TMSG_PLAYLISTPLAYER_NEXT:
g_playlistPlayer.PlayNext();
break;
case TMSG_PLAYLISTPLAYER_PREV:
g_playlistPlayer.PlayPrevious();
break;
// Window messages below here...
case TMSG_DIALOG_DOMODAL: //doModel of window
{
CGUIDialog* pDialog = (CGUIDialog*)g_windowManager.GetWindow(pMsg->dwParam1);
if (!pDialog) return ;
pDialog->DoModal();
}
break;
case TMSG_DIALOG_PROGRESS_SHOWMODAL:
{
CGUIDialogProgress* pDialog = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
if (!pDialog) return ;
pDialog->StartModal();
}
break;
case TMSG_WRITE_SCRIPT_OUTPUT:
{
//send message to window 2004 (CGUIWindowScriptsInfo)
CGUIMessage msg(GUI_MSG_USER, 0, 0);
msg.SetLabel(pMsg->strParam);
CGUIWindow* pWindowScripts = g_windowManager.GetWindow(WINDOW_SCRIPTS_INFO);
if (pWindowScripts) pWindowScripts->OnMessage(msg);
}
break;
case TMSG_NETWORKMESSAGE:
{
g_application.getNetwork().NetworkMessage((CNetwork::EMESSAGE)pMsg->dwParam1, (int)pMsg->dwParam2);
}
break;
case TMSG_GUI_DO_MODAL:
{
CGUIDialog *pDialog = (CGUIDialog *)pMsg->lpVoid;
if (pDialog)
pDialog->DoModal_Internal((int)pMsg->dwParam1, pMsg->strParam);
}
break;
case TMSG_GUI_SHOW:
{
CGUIDialog *pDialog = (CGUIDialog *)pMsg->lpVoid;
if (pDialog)
pDialog->Show_Internal();
}
break;
case TMSG_GUI_ACTION:
{
if (pMsg->lpVoid)
{
if (pMsg->dwParam1 == WINDOW_INVALID)
g_application.OnAction(*(CAction *)pMsg->lpVoid);
else