SuperTuxKart
online_profile_friends.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 
19 #ifndef __HEADER_ONLINE_PROFILE_FRIENDS_HPP__
20 #define __HEADER_ONLINE_PROFILE_FRIENDS_HPP__
21 
22 #include <string>
23 #include <irrString.h>
24 
25 #include "guiengine/screen.hpp"
26 #include "guiengine/widgets.hpp"
27 #include "states_screens/online/online_profile_base.hpp"
28 #include "online/profile_manager.hpp"
29 
30 
31 namespace GUIEngine { class Widget; }
32 
33 
38  public GUIEngine::ScreenSingleton<OnlineProfileFriends>,
40 
41 {
42 private:
44 
47  GUIEngine::ButtonWidget *m_search_button_widget;
48  GUIEngine::TextBoxWidget *m_search_box_widget;
49 
50  bool m_waiting_for_friends;
51 
53  static int m_sort_column;
54 
55  static bool m_sort_desc;
56 
57  static bool m_sort_default;
58 
59  void displayResults();
60  static bool compareFriends(int f1, int f2);
61 public:
63 
65  virtual void loadedFromFile() OVERRIDE;
66 
68  virtual void eventCallback(GUIEngine::Widget* widget,
69  const std::string& name,
70  const int playerID) OVERRIDE;
71 
73  virtual void init() OVERRIDE;
74 
75  virtual void onUpdate(float delta) OVERRIDE;
76  virtual void beforeAddingWidget() OVERRIDE;
77  virtual void onColumnClicked(int column_id, bool sort_desc, bool sort_default) OVERRIDE;
78 
79  // ------------------------------------------------------------------------
81  void refreshFriendsList() {m_waiting_for_friends = true; }
82 };
83 
84 #endif
OnlineProfileFriends()
Constructor for a display of all friends.
Definition: online_profile_friends.cpp:44
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:31
virtual void eventCallback(GUIEngine::Widget *widget, const std::string &name, const int playerID) OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: online_profile_friends.cpp:100
A text field widget.
Definition: text_box_widget.hpp:52
void refreshFriendsList()
Triggers a reload of the friend list next time this menu is shown.
Definition: online_profile_friends.hpp:81
Online profile base screen.
Definition: online_profile_base.hpp:37
static int m_sort_column
Which column to use for sorting.
Definition: online_profile_friends.hpp:53
virtual void beforeAddingWidget() OVERRIDE
Callback before widgets are added.
Definition: online_profile_friends.cpp:68
void displayResults()
Displays the friends from a given profile.
Definition: online_profile_friends.cpp:196
virtual void onUpdate(float delta) OVERRIDE
Called each frame to check if results have arrived.
Definition: online_profile_friends.cpp:254
virtual void init() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: online_profile_friends.cpp:83
virtual void loadedFromFile() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: online_profile_friends.cpp:52
Online profile overview screen.
Definition: online_profile_friends.hpp:37
Definition: list_widget.hpp:36
A vertical list widget with text entries.
Definition: list_widget.hpp:49
A text button widget.
Definition: button_widget.hpp:40
Declares a class to be a singleton.
Definition: screen.hpp:57
GUIEngine::ListWidget * m_friends_list_widget
Pointer to the various widgets on the screen.
Definition: online_profile_friends.hpp:46