void OnlineProfileFriends::eventCallback(Widget* widget, const std::string& name, const int playerID) { OnlineProfileBase::eventCallback( widget, name, playerID); if (name == m_search_button_widget->m_properties[GUIEngine::PROP_ID]) { OnlineUserSearch * instance = OnlineUserSearch::getInstance(); instance->setSearchString(m_search_box_widget->getText().trim()); StateManager::get()->replaceTopMostScreen(instance); } else if (name == m_friends_list_widget->m_properties[GUIEngine::PROP_ID]) { m_selected_friend_index = m_friends_list_widget->getSelectionID(); new UserInfoDialog(m_visiting_profile->getFriends()[m_selected_friend_index]); } } // eventCallback
/** Called when an event occurs (i.e. user clicks on something). */ void OnlineProfileFriends::eventCallback(Widget* widget, const std::string& name, const int playerID) { OnlineProfileBase::eventCallback( widget, name, playerID); if (name == m_search_button_widget->m_properties[GUIEngine::PROP_ID]) { OnlineUserSearch * instance = OnlineUserSearch::getInstance(); instance->setSearchString(m_search_box_widget->getText().trim()); StateManager::get()->replaceTopMostScreen(instance); } else if (name == m_friends_list_widget->m_properties[GUIEngine::PROP_ID]) { std::string str_selection = m_friends_list_widget->getSelectionInternalName(); int id; if (StringUtils::parseString(str_selection, &id)) { new UserInfoDialog(id); } } } // eventCallback