本文整理汇总了C++中CGUIMessage::GetParam2方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIMessage::GetParam2方法的具体用法?C++ CGUIMessage::GetParam2怎么用?C++ CGUIMessage::GetParam2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIMessage
的用法示例。
在下文中一共展示了CGUIMessage::GetParam2方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnMessage
bool CGUIEditControl::OnMessage(CGUIMessage &message)
{
if (message.GetMessage() == GUI_MSG_SET_TYPE)
{
SetInputType((INPUT_TYPE)message.GetParam1(), (int)message.GetParam2());
return true;
}
else if (message.GetMessage() == GUI_MSG_ITEM_SELECTED)
{
message.SetLabel(GetLabel2());
return true;
}
else if (message.GetMessage() == GUI_MSG_SET_TEXT &&
((message.GetControlId() <= 0 && HasFocus()) || (message.GetControlId() == GetID())))
{
SetLabel2(message.GetLabel());
UpdateText();
}
else if (message.GetMessage() == GUI_MSG_INPUT_TEXT_EDIT && HasFocus())
{
g_charsetConverter.utf8ToW(message.GetLabel(), m_edit);
m_editOffset = message.GetParam1();
m_editLength = message.GetParam2();
UpdateText(false);
return true;
}
return CGUIButtonControl::OnMessage(message);
}
示例2: OnMessage
bool CGUIEditControl::OnMessage(CGUIMessage &message)
{
if (message.GetMessage() == GUI_MSG_SET_TYPE)
{
SetInputType((INPUT_TYPE)message.GetParam1(), (int)message.GetParam2());
return true;
}
else if (message.GetMessage() == GUI_MSG_ITEM_SELECTED)
{
message.SetLabel(GetLabel2());
return true;
}
else if (message.GetMessage() == GUI_MSG_SETFOCUS ||
message.GetMessage() == GUI_MSG_LOSTFOCUS)
{
m_smsTimer.Stop();
}
else if (message.GetMessage() == GUI_MSG_SET_TEXT &&
((message.GetControlId() <= 0 && HasFocus()) || (message.GetControlId() == GetID())))
{
SetLabel2(message.GetLabel());
UpdateText();
}
return CGUIButtonControl::OnMessage(message);
}
示例3: OnMessage
bool CGUIEditControl::OnMessage(CGUIMessage &message)
{
if (message.GetMessage() == GUI_MSG_SET_TYPE)
{
SetInputType((INPUT_TYPE)message.GetParam1(), (int)message.GetParam2());
return true;
}
else if (message.GetMessage() == GUI_MSG_ITEM_SELECTED)
{
message.SetLabel(GetLabel2());
return true;
}
else if (message.GetMessage() == GUI_MSG_SETFOCUS)
{
m_smsTimer.Stop();
ANNOUNCEMENT::CAnnouncementManager::Announce(ANNOUNCEMENT::AF_GUI, "xbmc", "KeyboardDisplay");
}
else if (message.GetMessage() == GUI_MSG_LOSTFOCUS)
{
m_smsTimer.Stop();
ANNOUNCEMENT::CAnnouncementManager::Announce(ANNOUNCEMENT::AF_GUI, "xbmc", "KeyboardHide");
}
return CGUIButtonControl::OnMessage(message);
}
示例4: OnMessage
bool CGUIWindowSettingsCategory::OnMessage(CGUIMessage &message)
{
switch (message.GetMessage())
{
case GUI_MSG_WINDOW_INIT:
{
m_iSection = (int)message.GetParam2() - (int)CGUIDialogSettingsManagerBase::GetID();
CGUIDialogSettingsManagerBase::OnMessage(message);
m_returningFromSkinLoad = false;
if (!message.GetStringParam(0).empty())
FocusCategory(message.GetStringParam(0));
return true;
}
case GUI_MSG_FOCUSED:
{
if (!m_returningFromSkinLoad)
CGUIDialogSettingsManagerBase::OnMessage(message);
return true;
}
case GUI_MSG_LOAD_SKIN:
{
if (IsActive())
m_returningFromSkinLoad = true;
break;
}
case GUI_MSG_NOTIFY_ALL:
{
if (message.GetParam1() == GUI_MSG_WINDOW_RESIZE)
{
if (IsActive() && CDisplaySettings::GetInstance().GetCurrentResolution() != g_graphicsContext.GetVideoResolution())
{
CDisplaySettings::GetInstance().SetCurrentResolution(g_graphicsContext.GetVideoResolution(), true);
CreateSettings();
}
}
break;
}
}
return CGUIDialogSettingsManagerBase::OnMessage(message);
}
示例5: OnMessage
bool CGUIScrollBar::OnMessage(CGUIMessage& message)
{
switch (message.GetMessage())
{
case GUI_MSG_ITEM_SELECT:
SetValue(message.GetParam1());
return true;
case GUI_MSG_LABEL_RESET:
SetRange(message.GetParam1(), message.GetParam2());
return true;
case GUI_MSG_PAGE_UP:
Move(-1);
return true;
case GUI_MSG_PAGE_DOWN:
Move(1);
return true;
}
return CGUIControl::OnMessage(message);
}
示例6: OnMessage
bool CGUIWindowHome::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_NOTIFY_ALL:
if (message.GetParam1() == GUI_MSG_WINDOW_RESET || message.GetParam1() == GUI_MSG_REFRESH_THUMBS)
{
int updateRA = (message.GetSenderId() == GetID()) ? message.GetParam2() : (Video | Audio | Totals);
if (IsActive())
AddRecentlyAddedJobs(updateRA);
else
m_updateRA |= updateRA;
}
break;
default:
break;
}
return CGUIWindow::OnMessage(message);
}
示例7: OnMessage
bool CGUISpinControl::OnMessage(CGUIMessage& message)
{
if (CGUIControl::OnMessage(message) )
return true;
if (message.GetControlId() == GetID() )
{
switch (message.GetMessage())
{
case GUI_MSG_ITEM_SELECT:
if (SPIN_CONTROL_TYPE_PAGE == m_iType)
{
m_currentItem = message.GetParam1();
return true;
}
SetValue( message.GetParam1());
if (message.GetParam2() == SPIN_BUTTON_DOWN || message.GetParam2() == SPIN_BUTTON_UP)
m_iSelect = message.GetParam2();
return true;
break;
case GUI_MSG_LABEL_RESET:
if (SPIN_CONTROL_TYPE_PAGE == m_iType)
{
m_itemsPerPage = message.GetParam1();
m_numItems = message.GetParam2();
return true;
}
{
Clear();
return true;
}
break;
case GUI_MSG_SHOWRANGE:
if (message.GetParam1() )
m_bShowRange = true;
else
m_bShowRange = false;
break;
case GUI_MSG_SET_LABELS:
if (message.GetPointer())
{
const vector< pair<string, int> > *labels = (const vector< pair<string, int> > *)message.GetPointer();
Clear();
for (vector< pair<string, int> >::const_iterator i = labels->begin(); i != labels->end(); ++i)
AddLabel(i->first, i->second);
SetValue( message.GetParam1());
}
break;
case GUI_MSG_LABEL_ADD:
{
AddLabel(message.GetLabel(), message.GetParam1());
return true;
}
break;
case GUI_MSG_ITEM_SELECTED:
{
message.SetParam1( GetValue() );
message.SetParam2(m_iSelect);
if (m_iType == SPIN_CONTROL_TYPE_TEXT)
{
if ( m_iValue >= 0 && m_iValue < (int)m_vecLabels.size() )
message.SetLabel( m_vecLabels[m_iValue]);
}
return true;
}
case GUI_MSG_PAGE_UP:
if (CanMoveUp())
MoveUp();
return true;
case GUI_MSG_PAGE_DOWN:
if (CanMoveDown())
MoveDown();
return true;
case GUI_MSG_MOVE_OFFSET:
{
int count = (int)message.GetParam1();
while (count < 0)
{
MoveUp();
count++;
}
while (count > 0)
{
MoveDown();
count--;
}
return true;
}
}
}
return false;
//.........这里部分代码省略.........
示例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: OnMessage
bool CGUIDialogVideoBookmarks::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_WINDOW_DEINIT:
{
CUtil::DeleteVideoDatabaseDirectoryCache();
Clear();
}
break;
case GUI_MSG_WINDOW_INIT:
{
// don't init this dialog if we don't playback a file
if (!g_application.m_pPlayer->IsPlaying())
return false;
CGUIWindow::OnMessage(message);
Update();
return true;
}
break;
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
if (iControl == CONTROL_ADD_BOOKMARK)
{
AddBookmark();
Update();
}
else if (iControl == CONTROL_CLEAR_BOOKMARKS)
{
ClearBookmarks();
}
else if (iControl == CONTROL_ADD_EPISODE_BOOKMARK)
{
AddEpisodeBookmark();
Update();
}
else if (m_viewControl.HasControl(iControl)) // list/thumb control
{
int iItem = m_viewControl.GetSelectedItem();
int iAction = message.GetParam1();
if (iAction == ACTION_DELETE_ITEM)
{
Delete(iItem);
}
else if (iAction == ACTION_SELECT_ITEM || iAction == ACTION_MOUSE_LEFT_CLICK)
{
GotoBookmark(iItem);
}
}
}
break;
case GUI_MSG_SETFOCUS:
{
if (m_viewControl.HasControl(message.GetControlId()) && m_viewControl.GetCurrentControl() != message.GetControlId())
{
m_viewControl.SetFocused();
return true;
}
}
break;
case GUI_MSG_REFRESH_LIST:
{
switch (message.GetParam1())
{
case 0:
OnRefreshList();
break;
case 1:
UpdateItem(message.GetParam2());
break;
default:
break;
}
}
break;
}
return CGUIDialog::OnMessage(message);
}
示例10: OnMessage
bool CGUIWindowSettingsCategory::OnMessage(CGUIMessage &message)
{
switch (message.GetMessage())
{
case GUI_MSG_WINDOW_INIT:
{
m_delayedSetting.reset();
if (message.GetParam1() != WINDOW_INVALID && !m_returningFromSkinLoad)
{ // coming to this window first time (ie not returning back from some other window)
// so we reset our section and control states
m_iCategory = 0;
ResetControlStates();
}
m_resetSetting = new CSettingAction(RESET_SETTING_ID);
m_resetSetting->SetLabel(10041);
m_resetSetting->SetHelp(10045);
m_dummyCategory = new CSettingCategory(EMPTY_CATEGORY_ID);
m_dummyCategory->SetLabel(10046);
m_dummyCategory->SetHelp(10047);
m_iSection = (int)message.GetParam2() - (int)CGUIWindow::GetID();
CGUIWindow::OnMessage(message);
m_returningFromSkinLoad = false;
return true;
}
case GUI_MSG_WINDOW_DEINIT:
{
// cancel any delayed changes
if (m_delayedSetting != NULL)
{
m_delayedTimer.Stop();
CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), GetID());
OnMessage(message);
}
CGUIWindow::OnMessage(message);
FreeControls();
return true;
}
case GUI_MSG_FOCUSED:
{
CGUIWindow::OnMessage(message);
if (!m_returningFromSkinLoad)
{
int focusedControl = GetFocusedControlID();
// cancel any delayed changes if the focused control has changed
if (m_delayedSetting != NULL && m_delayedSetting->GetID() != focusedControl)
{
m_delayedTimer.Stop();
CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), m_delayedSetting->GetID(), 1); // param1 = 1 for "reset the control if it's invalid"
g_windowManager.SendThreadMessage(message, GetID());
}
// update the value of the previous setting (in case it was invalid)
else if (m_iSetting >= CONTROL_START_CONTROL && m_iSetting < (int)(CONTROL_START_CONTROL + m_settingControls.size()))
{
CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), m_iSetting, 1); // param1 = 1 for "reset the control if it's invalid"
g_windowManager.SendThreadMessage(message, GetID());
}
CVariant description;
// check if we have changed the category and need to create new setting controls
if (focusedControl >= CONTROL_START_BUTTONS && focusedControl < (int)(CONTROL_START_BUTTONS + m_categories.size()))
{
int categoryIndex = focusedControl - CONTROL_START_BUTTONS;
const CSettingCategory* category = m_categories.at(categoryIndex);
if (categoryIndex != m_iCategory)
{
if (!category->CanAccess())
{
// unable to go to this category - focus the previous one
SET_CONTROL_FOCUS(CONTROL_START_BUTTONS + m_iCategory, 0);
return false;
}
m_iCategory = categoryIndex;
CreateSettings();
}
description = category->GetHelp();
}
else if (focusedControl >= CONTROL_START_CONTROL && focusedControl < (int)(CONTROL_START_CONTROL + m_settingControls.size()))
{
m_iSetting = focusedControl;
CSetting *setting = GetSettingControl(focusedControl)->GetSetting();
if (setting != NULL)
description = setting->GetHelp();
}
// set the description of the currently focused category/setting
if (description.isInteger() ||
(description.isString() && !description.empty()))
SetDescription(description);
}
return true;
//.........这里部分代码省略.........
示例11: 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));
//.........这里部分代码省略.........
示例12: OnMessage
//.........这里部分代码省略.........
m_vecItems->m_strPath="";
}
}
}
return true;
}
else if (message.GetParam1()==GUI_MSG_UPDATE_SOURCES)
{ // State of the sources changed, so update our view
if (m_vecItems->IsVirtualDirectoryRoot() && IsActive())
{
int iItem = m_viewControl.GetSelectedItem();
Update(m_vecItems->m_strPath);
m_viewControl.SetSelectedItem(iItem);
}
return true;
}
else if (message.GetParam1()==GUI_MSG_UPDATE && IsActive())
{
if (message.GetStringParam().size())
{
m_vecItems->m_strPath = message.GetStringParam();
SetHistoryForPath(m_vecItems->m_strPath);
}
Update(m_vecItems->m_strPath);
}
else if (message.GetParam1()==GUI_MSG_UPDATE_ITEM && message.GetItem())
{
CFileItemPtr newItem = boost::static_pointer_cast<CFileItem>(message.GetItem());
if (IsActive())
m_vecItems->UpdateItem(newItem.get());
else if (newItem)
{ // need to remove the disc cache
CFileItemList items;
CUtil::GetDirectory(newItem->m_strPath, items.m_strPath);
items.RemoveDiscCache();
}
}
else if (message.GetParam1()==GUI_MSG_UPDATE_PATH)
{
if (message.GetStringParam() == m_vecItems->m_strPath && IsActive())
Update(m_vecItems->m_strPath);
}
else
return CGUIWindow::OnMessage(message);
return true;
}
break;
case GUI_MSG_PLAYBACK_STARTED:
case GUI_MSG_PLAYBACK_ENDED:
case GUI_MSG_PLAYBACK_STOPPED:
case GUI_MSG_PLAYLIST_CHANGED:
case GUI_MSG_PLAYLISTPLAYER_STOPPED:
case GUI_MSG_PLAYLISTPLAYER_STARTED:
case GUI_MSG_PLAYLISTPLAYER_CHANGED:
{ // send a notify all to all controls on this window
CGUIMessage msg(GUI_MSG_NOTIFY_ALL, GetID(), 0, GUI_MSG_REFRESH_LIST);
OnMessage(msg);
break;
}
case GUI_MSG_CHANGE_VIEW_MODE:
{
int viewMode = 0;
if (message.GetParam1()) // we have an id
viewMode = m_viewControl.GetViewModeByID(message.GetParam1());
else if (message.GetParam2())
viewMode = m_viewControl.GetNextViewMode((int)message.GetParam2());
if (m_guiState.get())
m_guiState->SaveViewAsControl(viewMode);
UpdateButtons();
return true;
}
break;
case GUI_MSG_CHANGE_SORT_METHOD:
{
if (m_guiState.get())
{
if (message.GetParam1())
m_guiState->SetCurrentSortMethod((int)message.GetParam1());
else if (message.GetParam2())
m_guiState->SetNextSortMethod((int)message.GetParam2());
}
UpdateFileList();
return true;
}
break;
case GUI_MSG_CHANGE_SORT_DIRECTION:
{
if (m_guiState.get())
m_guiState->SetNextSortOrder();
UpdateFileList();
return true;
}
break;
}
return CGUIWindow::OnMessage(message);
}
示例13: OnMessage
//.........这里部分代码省略.........
int iControl = message.GetSenderId();
#ifndef _BOXEE_
if (iControl == CONTROL_BTNPARTYMODE)
{
if (g_partyModeManager.IsEnabled())
g_partyModeManager.Disable();
else
{
if (!g_partyModeManager.Enable())
{
SET_CONTROL_SELECTED(GetID(),CONTROL_BTNPARTYMODE,false);
return false;
}
// Playlist directory is the root of the playlist window
if (m_guiState.get()) m_guiState->SetPlaylistDirectory("playlistmusic://");
return true;
}
UpdateButtons();
}
else
#endif
if (iControl == CONTROL_BTNMANUALINFO)
{
OnManualAlbumInfo();
return true;
}
else if (iControl == CONTROL_BTN_FILTER)
{
if (GetControl(iControl)->GetControlType() == CGUIControl::GUICONTROL_EDIT)
{ // filter updated
CGUIMessage selected(GUI_MSG_ITEM_SELECTED, GetID(), CONTROL_BTN_FILTER);
OnMessage(selected);
m_filter = selected.GetLabel();
OnFilterItems();
return true;
}
if (m_filter.IsEmpty())
CGUIDialogKeyboard::ShowAndGetFilter(m_filter, false);
else
{
m_filter.Empty();
OnFilterItems();
}
return true;
}
else if (iControl == CONTROL_SEARCH)
{
if (m_searchWithEdit)
{
// search updated - reset timer
m_searchTimer.StartZero();
// grab our search string
CGUIMessage selected(GUI_MSG_ITEM_SELECTED, GetID(), CONTROL_SEARCH);
OnMessage(selected);
m_search = selected.GetLabel();
return true;
}
CGUIDialogKeyboard::ShowAndGetFilter(m_search, true);
return true;
}
}
break;
case GUI_MSG_PLAYBACK_STOPPED:
case GUI_MSG_PLAYBACK_ENDED:
case GUI_MSG_PLAYLISTPLAYER_STOPPED:
case GUI_MSG_PLAYBACK_STARTED:
{
#ifndef _BOXEE_
SET_CONTROL_SELECTED(GetID(),CONTROL_BTNPARTYMODE, g_partyModeManager.IsEnabled());
#endif
}
break;
case GUI_MSG_NOTIFY_ALL:
{
if (message.GetParam1() == GUI_MSG_FILTER_ITEMS && IsActive())
{
if (message.GetParam2() == 1) // append
m_filter += message.GetStringParam();
else if (message.GetParam2() == 2)
{ // delete
if (m_filter.size())
m_filter = m_filter.Left(m_filter.size() - 1);
}
else
m_filter = message.GetStringParam();
OnFilterItems();
return true;
}
if (message.GetParam1() == GUI_MSG_SEARCH_UPDATE && IsActive())
{
// search updated - reset timer
m_searchTimer.StartZero();
m_search = message.GetStringParam();
}
}
}
return CGUIWindowMusicBase::OnMessage(message);
}
示例14: OnMessage
bool CGUIWindowSettingsCategory::OnMessage(CGUIMessage &message)
{
switch (message.GetMessage())
{
case GUI_MSG_WINDOW_INIT:
{
m_delayedSetting.reset();
if (message.GetParam1() != WINDOW_INVALID && !m_returningFromSkinLoad)
{ // coming to this window first time (ie not returning back from some other window)
// so we reset our section and control states
m_iCategory = 0;
ResetControlStates();
}
m_iSection = (int)message.GetParam2() - (int)CGUIWindow::GetID();
CGUIWindow::OnMessage(message);
m_returningFromSkinLoad = false;
return true;
}
case GUI_MSG_WINDOW_DEINIT:
{
// cancel any delayed changes
if (m_delayedSetting != NULL)
{
m_delayedTimer.Stop();
CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), GetID());
OnMessage(message);
}
CGUIWindow::OnMessage(message);
FreeControls();
return true;
}
case GUI_MSG_FOCUSED:
{
CGUIWindow::OnMessage(message);
if (!m_returningFromSkinLoad)
{
int focusedControl = GetFocusedControlID();
// cancel any delayed changes if the focused control has changed
if (m_delayedSetting != NULL && m_delayedSetting->GetID() != focusedControl)
{
m_delayedTimer.Stop();
CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), GetID(), 1); // param1 = 1 for "reset the control if it's invalid"
OnMessage(message);
}
// check if we have changed the category and need to create new setting controls
if (focusedControl >= CONTROL_START_BUTTONS && focusedControl < (int)(CONTROL_START_BUTTONS + m_categories.size()) &&
focusedControl - CONTROL_START_BUTTONS != m_iCategory)
{
if (!m_categories[focusedControl - CONTROL_START_BUTTONS]->CanAccess())
{
// unable to go to this category - focus the previous one
SET_CONTROL_FOCUS(CONTROL_START_BUTTONS + m_iCategory, 0);
return false;
}
m_iCategory = focusedControl - CONTROL_START_BUTTONS;
CreateSettings();
}
}
return true;
}
case GUI_MSG_CLICKED:
{
BaseSettingControlPtr control = GetSettingControl(message.GetSenderId());
if (control != NULL)
OnClick(control);
break;
}
case GUI_MSG_LOAD_SKIN:
{
if (IsActive())
m_returningFromSkinLoad = true;
break;
}
case GUI_MSG_UPDATE_ITEM:
{
if (m_delayedSetting != NULL)
{
// first get the delayed setting and reset its member variable
// to avoid handling the delayed setting twice in case the OnClick()
// performed later causes the window to be deinitialized (e.g. when
// changing the language)
BaseSettingControlPtr delayedSetting = m_delayedSetting;
m_delayedSetting.reset();
// if updating the setting fails and param1 has been specifically set
// we need to call OnSettingChanged() to restore a valid value in the
// setting control
if (!delayedSetting->OnClick() && message.GetParam1() != 0)
OnSettingChanged(delayedSetting->GetSetting());
//.........这里部分代码省略.........
示例15: OnMessage
//.........这里部分代码省略.........
// base class has opened the database, do our check
DisplayEmptyDatabaseMessage(m_musicdatabase.GetSongsCount() <= 0);
if (m_bDisplayEmptyDatabaseMessage)
{
// no library - make sure we focus on a known control, and default to the root.
SET_CONTROL_FOCUS(CONTROL_BTNTYPE, 0);
m_vecItems->m_strPath = "";
SetHistoryForPath("");
Update("");
}
return true;
}
break;
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
if (iControl == CONTROL_BTNPARTYMODE)
{
if (g_partyModeManager.IsEnabled())
g_partyModeManager.Disable();
else
{
if (!g_partyModeManager.Enable())
{
SET_CONTROL_SELECTED(GetID(),CONTROL_BTNPARTYMODE,false);
return false;
}
// Playlist directory is the root of the playlist window
if (m_guiState.get()) m_guiState->SetPlaylistDirectory("playlistmusic://");
return true;
}
UpdateButtons();
}
else if (iControl == CONTROL_BTNMANUALINFO)
{
OnManualAlbumInfo();
return true;
}
else if (iControl == CONTROL_BTN_FILTER)
{
if (m_filter.IsEmpty())
CGUIDialogKeyboard::ShowAndGetFilter(m_filter, false);
else
{
m_filter.Empty();
OnFilterItems();
}
return true;
}
else if (iControl == CONTROL_BTNSEARCH)
{
OnSearch();
return true;
}
}
break;
case GUI_MSG_PLAYBACK_STOPPED:
case GUI_MSG_PLAYBACK_ENDED:
case GUI_MSG_PLAYLISTPLAYER_STOPPED:
case GUI_MSG_PLAYBACK_STARTED:
{
SET_CONTROL_SELECTED(GetID(),CONTROL_BTNPARTYMODE, g_partyModeManager.IsEnabled());
}
break;
case GUI_MSG_NOTIFY_ALL:
{
if (message.GetParam1() == GUI_MSG_FILTER_ITEMS && IsActive())
{
if (message.GetParam2() == 1) // append
m_filter += message.GetStringParam();
else if (message.GetParam2() == 2)
{ // delete
if (m_filter.size())
m_filter = m_filter.Left(m_filter.size() - 1);
}
else
m_filter = message.GetStringParam();
OnFilterItems();
return true;
}
if (message.GetParam1() == GUI_MSG_SEARCH_UPDATE && IsActive())
{
m_search = message.GetStringParam();
CUtil::URLEncode(m_search);
if (!m_search.IsEmpty())
{
CStdString path = "musicsearch://" + m_search + "/";
m_history.ClearPathHistory();
Update(path);
}
}
}
}
return CGUIWindowMusicBase::OnMessage(message);
}