SuperTuxKart
edit_gp_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_EDIT_GP_SCREEN_HPP
19 #define HEADER_EDIT_GP_SCREEN_HPP
20 
21 #include "guiengine/screen.hpp"
22 #include "guiengine/widgets/list_widget.hpp"
23 #include "states_screens/dialogs/message_dialog.hpp"
24 
25 #include <vector>
26 
27 
28 namespace GUIEngine { class Widget; }
29 namespace irr { namespace gui { class STKModifiedSpriteBank; } }
30 
31 class GrandPrixData;
32 
37 class EditGPScreen :
38  public GUIEngine::Screen,
39  public GUIEngine::ScreenSingleton<EditGPScreen>,
41 {
43 
44  EditGPScreen();
45 
46  void onConfirm() OVERRIDE;
47  void onCancel() OVERRIDE;
48 
49  void loadList(const int selected);
50  void setModified(const bool modified);
51  void setSelected(const int selected);
52  void edit();
53  bool save();
54  void back();
55 
56  bool canMoveUp() const;
57  bool canMoveDown() const;
58 
59  void enableButtons();
60 
61  GrandPrixData* m_gp;
62  GUIEngine::ListWidget* m_list;
63  irr::gui::STKModifiedSpriteBank* m_icon_bank;
64  std::vector<int> m_icons;
65  int m_selected;
66  bool m_modified;
67 
68  std::string m_action;
69 
70 public:
71 
72  ~EditGPScreen();
73 
74  void setSelectedGP(GrandPrixData* gp);
75 
77  virtual void loadedFromFile() OVERRIDE;
78 
80  virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
81  const int playerID) OVERRIDE;
82 
84  virtual void beforeAddingWidget() OVERRIDE;
85 
87  virtual void init() OVERRIDE;
88 };
89 
90 #endif
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:31
virtual void loadedFromFile() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: edit_gp_screen.cpp:58
virtual void init() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: edit_gp_screen.cpp:157
virtual void eventCallback(GUIEngine::Widget *widget, const std::string &name, const int playerID) OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: edit_gp_screen.cpp:65
virtual void beforeAddingWidget() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: edit_gp_screen.cpp:146
screen where the user can edit a grand prix
Definition: edit_gp_screen.hpp:37
void onConfirm() OVERRIDE
Implement to be notified of dialog confirmed.
Definition: edit_gp_screen.cpp:202
A vertical list widget with text entries.
Definition: list_widget.hpp:49
Represents a single GUI screen.
Definition: screen.hpp:94
Declares a class to be a singleton.
Definition: screen.hpp:57
void onCancel() OVERRIDE
Implement to be notified of dialog cancelled.
Definition: edit_gp_screen.cpp:221
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
Simple class that hold the data relevant to a 'grand_prix', aka.
Definition: grand_prix_data.hpp:35