SuperTuxKart
Loading...
Searching...
No Matches
online_user_search.hpp
1// SuperTuxKart - a fun racing game with go-kart
2// Copyright (C) 2013-2015 Glenn De Jonghe
3//
4// This program is free software; you can redistribute it and/or
5// modify it under the terms of the GNU General Public License
6// as published by the Free Software Foundation; either version 3
7// of the License, or (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program; if not, write to the Free Software
16// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18#ifndef HEADER_ONLINE_USER_SEARCH_HPP
19#define HEADER_ONLINE_USER_SEARCH_HPP
20
21#include "guiengine/screen.hpp"
22#include "guiengine/widgets.hpp"
23#include "online/online_profile.hpp"
24#include "utils/ptr_vector.hpp"
25
26namespace GUIEngine { class Widget; }
27
28namespace Online { class XMLRequest; }
29
35 public GUIEngine::ScreenSingleton<OnlineUserSearch>
36{
38
39private:
42
51
53 irr::core::stringw m_search_string;
55 irr::core::stringw m_last_search_string;
56
58 Online::OnlineProfile::IDList m_users;
59
61 std::shared_ptr<Online::XMLRequest> m_search_request;
62
63 void parseResult(const XMLNode * input);
64 void showList();
65 void search();
66
67
68public:
69
71 virtual void loadedFromFile() OVERRIDE;
72
74 virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
75 const int playerID) OVERRIDE;
76
78 virtual void beforeAddingWidget() OVERRIDE;
79
80 virtual void init() OVERRIDE;
81
82 virtual void tearDown() OVERRIDE;
83
85 virtual void onUpdate(float dt) OVERRIDE;
86
88 void setSearchString(const irr::core::stringw & search_string)
89 {
90 m_search_string = search_string;
91 }
92
93};
94
95#endif
A text button widget.
Definition: button_widget.hpp:41
A button widget with an icon and optionnaly a label beneath.
Definition: icon_button_widget.hpp:44
A vertical list widget with text entries.
Definition: list_widget.hpp:50
Declares a class to be a singleton.
Definition: screen.hpp:59
Represents a single GUI screen.
Definition: screen.hpp:97
A text field widget.
Definition: text_box_widget.hpp:53
Definition: online_user_search.hpp:36
void search()
Called when a search is triggered.
Definition: online_user_search.cpp:168
GUIEngine::TextBoxWidget * m_search_box_widget
Pointer to the search box.
Definition: online_user_search.hpp:48
void showList()
Takes the list of user ids from a query and shows it in the list gui.
Definition: online_user_search.cpp:142
virtual void beforeAddingWidget() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: online_user_search.cpp:68
void parseResult(const XMLNode *input)
Adds the results of the query to the ProfileManager cache.
Definition: online_user_search.cpp:104
Online::OnlineProfile::IDList m_users
The list of all IDs found.
Definition: online_user_search.hpp:58
virtual void eventCallback(GUIEngine::Widget *widget, const std::string &name, const int playerID) OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: online_user_search.cpp:190
virtual void init() OVERRIDE
Called when entering this menu (before widgets are added).
Definition: online_user_search.cpp:76
virtual void tearDown() OVERRIDE
Callback before the screen is removed.
Definition: online_user_search.cpp:86
GUIEngine::IconButtonWidget * m_back_widget
Pointer to the back widget.
Definition: online_user_search.hpp:44
virtual void loadedFromFile() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: online_user_search.cpp:53
GUIEngine::ButtonWidget * m_search_button_widget
Pointer to the search button.
Definition: online_user_search.hpp:46
irr::core::stringw m_last_search_string
Last search string, used to avoid doing the same search again.
Definition: online_user_search.hpp:55
std::shared_ptr< Online::XMLRequest > m_search_request
The online request to search for users.
Definition: online_user_search.hpp:61
GUIEngine::ListWidget * m_user_list_widget
Pointer to the result list.
Definition: online_user_search.hpp:50
void setSearchString(const irr::core::stringw &search_string)
Sets the search string to an initial value.
Definition: online_user_search.hpp:88
virtual void onUpdate(float dt) OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: online_user_search.cpp:217
irr::core::stringw m_search_string
Seach string entered in the search widget.
Definition: online_user_search.hpp:53
utility class used to parse XML files
Definition: xml_node.hpp:48
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33