SuperTuxKart
Loading...
Searching...
No Matches
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
28namespace GUIEngine { class Widget; }
29namespace irr { namespace gui { class STKModifiedSpriteBank; } }
30
31class GrandPrixData;
32
38 public GUIEngine::Screen,
39 public GUIEngine::ScreenSingleton<EditGPScreen>,
41{
43
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;
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
70public:
71
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 bool onEscapePressed() OVERRIDE;
85
87 virtual void beforeAddingWidget() OVERRIDE;
88
90 virtual void init() OVERRIDE;
91};
92
93#endif
screen where the user can edit a grand prix
Definition: edit_gp_screen.hpp:41
virtual void loadedFromFile() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: edit_gp_screen.cpp:58
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
void onConfirm() OVERRIDE
Implement to be notified of dialog confirmed.
Definition: edit_gp_screen.cpp:202
virtual void init() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: edit_gp_screen.cpp:157
virtual void beforeAddingWidget() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: edit_gp_screen.cpp:146
void onCancel() OVERRIDE
Implement to be notified of dialog cancelled.
Definition: edit_gp_screen.cpp:221
virtual bool onEscapePressed() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: edit_gp_screen.cpp:376
A vertical list widget with text entries.
Definition: list_widget.hpp:50
Declares a class to be a singleton.
Definition: screen.hpp:59
Represents a single GUI screen.
Definition: screen.hpp:97
The nearly-abstract base of all widgets (not fully abstract since a bare Widget can be created for th...
Definition: widget.hpp:143
Simple class that hold the data relevant to a 'grand_prix', aka.
Definition: grand_prix_data.hpp:36
Listener interface to get notified of whether the user chose to confirm or cancel.
Definition: message_dialog.hpp:39
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33