SuperTuxKart
high_score_selection.hpp
1 //
2 // SuperTuxKart - a fun racing game with go-kart
3 // Copyright (C) 2016 SuperTuxKart-Team
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 3
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 
19 #ifndef HEADER_HIGH_SCORE_SELECTION_HPP
20 #define HEADER_HIGH_SCORE_SELECTION_HPP
21 
22 #include "guiengine/screen.hpp"
23 #include "guiengine/widgets/list_widget.hpp"
24 #include "race/race_manager.hpp"
25 #include "states_screens/dialogs/message_dialog.hpp"
26 
27 namespace GUIEngine { class ListWidget; class RibbonWidget; class Widget; }
28 
34  public GUIEngine::ScreenSingleton<HighScoreSelection>,
37 
38 {
40 
41 private:
44 
45  GUIEngine::ListWidget* m_high_scores_list_widget;
46  GUIEngine::RibbonWidget* m_mode_tabs;
47  bool m_active_mode_is_linear;
48  bool m_reverse_sort;
49  RaceManager::MajorRaceModeType m_major_mode;
50  RaceManager::MinorRaceModeType m_active_mode;
51  int m_selected_index;
52 
53  irr::gui::STKModifiedSpriteBank *m_icon_bank;
54 
59 
60  void defaultSort();
61 
62 public:
63  irr::gui::STKModifiedSpriteBank* getIconBank() { return m_icon_bank; }
64 
65  int getUnknownKartIcon() { return m_icon_unknown_kart; }
66 
67  void refresh(bool forced_update = true, bool update_columns = false);
68 
70  void loadList();
71 
72  void onDeleteHighscores();
73 
74  void onClearHighscores();
75 
76  const RaceManager::MinorRaceModeType getActiveMode() { return m_active_mode; }
77 
78  const bool isActiveModeLinear() { return m_active_mode_is_linear; }
79 
81  virtual void loadedFromFile() OVERRIDE;
82 
84  virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
85  const int playerID) OVERRIDE;
86 
88  virtual void beforeAddingWidget() OVERRIDE;
89 
90  virtual void onColumnClicked(int column_id, bool sort_desc, bool sort_default) OVERRIDE;
91 
92  virtual void init() OVERRIDE;
93 
94  virtual void tearDown() OVERRIDE;
95 
96  virtual void unloaded() OVERRIDE;
97 
99  virtual void onConfirm() OVERRIDE;
100 
101 }; // HighScoreSelection
102 
103 #endif
Definition: list_widget.hpp:37
A vertical list widget with text entries.
Definition: list_widget.hpp:50
A static text/icons/tabs bar widget.
Definition: ribbon_widget.hpp:66
Declares a class to be a singleton.
Definition: screen.hpp:59
Represents a single GUI screen.
Definition: screen.hpp:94
HighScoreSelection.
Definition: high_score_selection.hpp:38
virtual void loadedFromFile() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: high_score_selection.cpp:101
void defaultSort()
Apply the default sorting to the high score list.
Definition: high_score_selection.cpp:444
virtual void beforeAddingWidget() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: high_score_selection.cpp:134
virtual void onColumnClicked(int column_id, bool sort_desc, bool sort_default) OVERRIDE
Change the sort order if a column was clicked.
Definition: high_score_selection.cpp:391
int m_icon_lock
Icon for locked replays.
Definition: high_score_selection.hpp:58
void refresh(bool forced_update=true, bool update_columns=false)
Triggers a refresh of the high score list.
Definition: high_score_selection.cpp:75
void loadList()
Load the addons into the main list.
Definition: high_score_selection.cpp:183
virtual void onConfirm() OVERRIDE
Implement IConfirmDialogListener callback.
Definition: high_score_selection.cpp:365
HighScoreSelection()
Constructor, which loads the stkgui file.
Definition: high_score_selection.cpp:47
virtual void unloaded() OVERRIDE
Callback invoked when this screen is being unloaded.
Definition: high_score_selection.cpp:66
virtual void init() OVERRIDE
Callback invoked when entering this menu (after the widgets have been added).
Definition: high_score_selection.cpp:167
int m_icon_unknown_kart
Icon for unknown karts.
Definition: high_score_selection.hpp:56
virtual void eventCallback(GUIEngine::Widget *widget, const std::string &name, const int playerID) OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: high_score_selection.cpp:278
virtual void tearDown() OVERRIDE
Callback invoked before leaving this menu.
Definition: high_score_selection.cpp:60
~HighScoreSelection()
Destructor.
Definition: high_score_selection.cpp:55
Listener interface to get notified of whether the user chose to confirm or cancel.
Definition: message_dialog.hpp:39
MinorRaceModeType
Minor variants to the major types of race.
Definition: race_manager.hpp:111
MajorRaceModeType
The major types or races supported in STK.
Definition: race_manager.hpp:94
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33