SuperTuxKart
gp_info_screen.hpp
1 // SuperTuxKart - a fun racing game with go-kart
2 // Copyright (C) 2009-2015 Marianne Gagnon
3 // (C) 2014-2015 Joerg Henrichs
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 
20 #ifndef HEADER_GP_INFO_SCREEN_HPP
21 #define HEADER_GP_INFO_SCREEN_HPP
22 
23 #include "guiengine/screen.hpp"
24 #include "race/grand_prix_data.hpp"
25 
26 #include <vector>
27 
28 class GrandPrixData;
29 
30 namespace GUIEngine
31 {
32  class IconButtonWidget;
33  class SpinnerWidget;
34 }
35 
41  public GUIEngine::ScreenSingleton<GPInfoScreen>
42 {
43 private:
46 
49 
52 
55 
57  std::string m_group_name;
58 
60  std::vector<std::string> m_group_names;
61 
64 
66  int getMaxNumTracks(std::string group);
67 
68 protected: // Necessary for RandomGPInfoScreen
69  float m_curr_time;
70 
73 
78  void addTracks();
79  void addScreenshot();
80  void updateRandomGP();
82 
83 public:
84  GPInfoScreen();
87  virtual ~GPInfoScreen() {}
88 
89  void onEnterPressedInternal();
90  virtual void eventCallback(GUIEngine::Widget *, const std::string &name,
91  const int player_id) OVERRIDE;
92  virtual void loadedFromFile() OVERRIDE;
93  virtual void init() OVERRIDE;
94  virtual void beforeAddingWidget() OVERRIDE;
95 
96  virtual void onUpdate(float dt) OVERRIDE;
97 
98  void setGP(const std::string &gp_ident);
99 }; // GPInfoScreen
100 
101 #endif
A spinner or gauge widget (to select numbers / percentages).
Definition: spinner_widget.hpp:39
GUIEngine::SpinnerWidget * m_num_tracks_spinner
Spinner for number of tracks (in case of random GP).
Definition: gp_info_screen.hpp:51
Dialog that shows information about a specific grand prix.
Definition: gp_info_screen.hpp:40
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:31
virtual void onUpdate(float dt) OVERRIDE
Called every update.
Definition: gp_info_screen.cpp:375
GUIEngine::SpinnerWidget * m_ai_kart_spinner
Spinner for number of AI karts.
Definition: gp_info_screen.hpp:54
int getMaxNumTracks(std::string group)
Get number of available tracks for random GPs.
Definition: gp_info_screen.cpp:399
GPReverseType
Used to define the reverse setting when creating a random GP: No reverse, all reverse (if available o...
Definition: grand_prix_data.hpp:88
GPInfoScreen()
Constructor, initialised some variables which might be used before loadedFromFile is called.
Definition: gp_info_screen.cpp:54
void addTracks()
display all the tracks according to the current gp For a normal gp info dialog, it just creates a lab...
Definition: gp_info_screen.cpp:264
void addScreenshot()
Creates a screenshot widget in the placeholder of the GUI.
Definition: gp_info_screen.cpp:281
std::vector< std::string > m_group_names
The untranslated group names, used as internal IDs.
Definition: gp_info_screen.hpp:60
virtual void eventCallback(GUIEngine::Widget *, const std::string &name, const int player_id) OVERRIDE
Handle user input.
Definition: gp_info_screen.cpp:300
std::string m_group_name
The currently selected group name.
Definition: gp_info_screen.hpp:57
GUIEngine::SpinnerWidget * m_reverse_spinner
Spinner for reverse mode.
Definition: gp_info_screen.hpp:48
Represents a single GUI screen.
Definition: screen.hpp:94
GrandPrixData::GPReverseType getReverse() const
Converts the currently selected reverse status into a value of type GPReverseType .
Definition: gp_info_screen.cpp:112
GrandPrixData m_gp
The grand prix data.
Definition: gp_info_screen.hpp:72
virtual ~GPInfoScreen()
Places the focus back on the selected GP, in the case that the dialog was cancelled and we're returni...
Definition: gp_info_screen.hpp:87
Declares a class to be a singleton.
Definition: screen.hpp:57
virtual void init() OVERRIDE
Called before the screen is shown.
Definition: gp_info_screen.cpp:163
GUIEngine::SpinnerWidget * m_group_spinner
Spinner for the different track groups.
Definition: gp_info_screen.hpp:45
void setGP(const std::string &gp_ident)
Sets the GP to be displayed.
Definition: gp_info_screen.cpp:94
virtual void loadedFromFile() OVERRIDE
Called when the stkgui file is read.
Definition: gp_info_screen.cpp:66
int m_max_num_tracks
Number of available tracks.
Definition: gp_info_screen.hpp:63
The nearly-abstract base of all widgets (not fully abstract since a bare Widget can be created for th...
Definition: widget.hpp:138
virtual void beforeAddingWidget() OVERRIDE
Optional callback invoked very early, before widgets have been added (contrast with init(),...
Definition: gp_info_screen.cpp:126
Simple class that hold the data relevant to a 'grand_prix', aka.
Definition: grand_prix_data.hpp:35