SuperTuxKart
edit_track_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_TRACK_SCREEN_HPP
19 #define HEADER_EDIT_TRACK_SCREEN_HPP
20 
21 #include "guiengine/screen.hpp"
22 #include "guiengine/widgets/text_box_widget.hpp"
23 
24 namespace GUIEngine { class IconButtonWidget; class Widget; }
25 
26 namespace irr { namespace gui { class STKModifiedSpriteBank; } }
27 
28 class Track;
29 
35  public GUIEngine::Screen,
36  public GUIEngine::ScreenSingleton<EditTrackScreen>,
38 {
40 
41  static const char* ALL_TRACKS_GROUP_ID;
42 
44 
45  void loadTrackList();
46  void selectTrack(const std::string& id);
47 
48  std::string m_track_group;
49 
50  Track* m_track;
51  unsigned int m_laps;
52  bool m_reverse;
53  bool m_result;
54 
55  GUIEngine::IconButtonWidget* m_screenshot;
56 
57  GUIEngine::TextBoxWidget *m_search_box;
58 
59 public:
60 
61  ~EditTrackScreen();
62 
63  void setSelection(Track* track, unsigned int laps, bool reverse);
64  Track* getTrack() const;
65  unsigned int getLaps() const;
66  bool getReverse() const;
67  bool getResult() const;
68 
70  virtual void beforeAddingWidget() OVERRIDE;
71 
73  virtual void loadedFromFile() OVERRIDE;
74 
76  virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
77  const int playerID) OVERRIDE;
78 
80  virtual void init() OVERRIDE;
81 
83  virtual void onTextUpdated() OVERRIDE
84  {
85  loadTrackList();
86  // After buildTrackList the m_search_box may be unfocused
87  m_search_box->focused(0);
88  }
89 
90 };
91 
92 #endif
screen where the user can edit the details of a track inside a grand prix
Definition: edit_track_screen.hpp:38
virtual void onTextUpdated() OVERRIDE
Rebuild the list of tracks based on search text.
Definition: edit_track_screen.hpp:83
virtual void init() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: edit_track_screen.cpp:124
virtual void loadedFromFile() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: edit_track_screen.cpp:88
virtual void eventCallback(GUIEngine::Widget *widget, const std::string &name, const int playerID) OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: edit_track_screen.cpp:153
virtual void beforeAddingWidget() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: edit_track_screen.cpp:104
Definition: text_box_widget.hpp:42
A button widget with an icon and optionnaly a label beneath.
Definition: icon_button_widget.hpp:44
Declares a class to be a singleton.
Definition: screen.hpp:59
Represents a single GUI screen.
Definition: screen.hpp:94
A text field widget.
Definition: text_box_widget.hpp:53
virtual EventPropagation focused(const int playerID)
override in children if you need to know when the widget is focused.
Definition: text_box_widget.cpp:178
The nearly-abstract base of all widgets (not fully abstract since a bare Widget can be created for th...
Definition: widget.hpp:147
Definition: track.hpp:115
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33