SuperTuxKart
grand_prix_editor_screen.hpp
1 // SuperTuxKart - a fun racing game with go-kart
2 // Copyright (C) 2014-2015 Marc Coll
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_GRAND_PRIX_EDITOR_SCREEN_HPP
19 #define HEADER_GRAND_PRIX_EDITOR_SCREEN_HPP
20 
21 #include "guiengine/screen.hpp"
22 #include "race/grand_prix_data.hpp"
23 #include "states_screens/dialogs/message_dialog.hpp"
24 
25 
26 namespace GUIEngine { class Widget; class LabelWidget; }
27 
28 class GrandPrixData;
29 
35  public GUIEngine::Screen,
36  public GUIEngine::ScreenSingleton<GrandPrixEditorScreen>,
38 {
40 
42 
43  void setSelection(const GrandPrixData* gpdata);
44  void loadGPList();
45  void loadTrackList(const std::string& gpname);
46  void showEditScreen(GrandPrixData* gp);
47  void enableButtons();
48 
49  void setNewGPWithName(const irr::core::stringw& newName);
50  void onConfirm() OVERRIDE;
51 
52  static const core::stringw getGroupName(enum GrandPrixData::GPGroupType group);
53 
54  GrandPrixData* m_selection;
55  std::string m_action;
56  enum GrandPrixData::GPGroupType m_gpgroup;
57 
58 public:
59 
61  virtual void beforeAddingWidget() OVERRIDE;
62 
64  virtual void loadedFromFile() OVERRIDE;
65 
67  virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
68  const int playerID) OVERRIDE;
69 
71  virtual void init() OVERRIDE;
72 
75 };
76 
77 #endif
screen where the user can edit his own grand prix
Definition: grand_prix_editor_screen.hpp:34
static bool validateName(GUIEngine::LabelWidget *, GUIEngine::TextBoxWidget *)
Global function to validate grand prix names.
Definition: grand_prix_editor_screen.cpp:343
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:31
virtual void init() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: grand_prix_editor_screen.cpp:145
A text field widget.
Definition: text_box_widget.hpp:52
virtual void beforeAddingWidget() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: grand_prix_editor_screen.cpp:48
virtual void loadedFromFile() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: grand_prix_editor_screen.cpp:63
A simple label widget.
Definition: label_widget.hpp:35
Represents a single GUI screen.
Definition: screen.hpp:94
Declares a class to be a singleton.
Definition: screen.hpp:57
Listener interface to get notified of whether the user chose to confirm or cancel.
Definition: message_dialog.hpp:38
The nearly-abstract base of all widgets (not fully abstract since a bare Widget can be created for th...
Definition: widget.hpp:138
void onConfirm() OVERRIDE
Implement to be notified of dialog confirmed.
Definition: grand_prix_editor_screen.cpp:310
GPGroupType
Used to classify GPs into groups.
Definition: grand_prix_data.hpp:45
virtual void eventCallback(GUIEngine::Widget *widget, const std::string &name, const int playerID) OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: grand_prix_editor_screen.cpp:77
Simple class that hold the data relevant to a 'grand_prix', aka.
Definition: grand_prix_data.hpp:35