SuperTuxKart
options_screen_device.hpp
1 // SuperTuxKart - a fun racing game with go-kart
2 // Copyright (C) 2009-2015 Marianne Gagnon
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 
19 #ifndef HEADER_OPTIONS_SCREEN_DEVICE_HPP
20 #define HEADER_OPTIONS_SCREEN_DEVICE_HPP
21 
22 #include <string>
23 #include <irrString.h>
24 
25 #include "guiengine/screen.hpp"
26 #include "states_screens/dialogs/message_dialog.hpp"
27 
28 namespace GUIEngine { class Widget; class ListWidget; }
29 class DeviceConfig;
30 namespace irr { namespace gui { class STKModifiedSpriteBank; } }
31 
32 
33 struct Input;
34 
35 
41  public GUIEngine::ScreenSingleton<OptionsScreenDevice>,
43 {
45 
46  void updateInputButtons();
47 
48  bool conflictsBetweenKbdConfig(PlayerAction action, PlayerAction from,
49  PlayerAction to);
50 
53 
54  void renameRow(GUIEngine::ListWidget* actions,
55  int idRow,
56  const irr::core::stringw &translatedName,
57  PlayerAction action) const;
58 
59  void addListItem(GUIEngine::ListWidget* actions, PlayerAction pa);
60  void addListItemSubheader(GUIEngine::ListWidget* actions,
61  const char* id,
62  const core::stringw& text);
63 
64 public:
66 
68  void setDevice(DeviceConfig* config) { m_config = config; }
69 
71  virtual void loadedFromFile() OVERRIDE;
72 
74  virtual void eventCallback(GUIEngine::Widget* widget,
75  const std::string& name, const int playerID) OVERRIDE;
76 
79  virtual void unloaded() OVERRIDE;
80 
82  virtual void init() OVERRIDE;
83 
86  virtual bool onEscapePressed() OVERRIDE;
87 
92  void gotSensedInput(const Input& sensedInput);
93 
95  virtual void onConfirm() OVERRIDE;
96 
97  virtual void beforeAddingWidget() OVERRIDE;
98 };
99 
100 #endif
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:31
contains the key bindings information related to one input device
Definition: device_config.hpp:41
Input options screen.
Definition: options_screen_device.hpp:40
virtual void beforeAddingWidget() OVERRIDE
Optional callback invoked very early, before widgets have been added (contrast with init(),...
Definition: options_screen_device.cpp:66
PlayerAction
types of input events / what actions the players can do
Definition: input.hpp:116
virtual void loadedFromFile() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: options_screen_device.cpp:60
Definition: input.hpp:34
virtual void init() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: options_screen_device.cpp:78
virtual void unloaded() OVERRIDE
implement optional callback from parent class GUIEngine::Screen
Definition: options_screen_device.cpp:645
virtual void onConfirm() OVERRIDE
Implement IConfirmDialogListener callback.
Definition: options_screen_device.cpp:661
void setDevice(DeviceConfig *config)
Sets the configuration to be used.
Definition: options_screen_device.hpp:68
A vertical list widget with text entries.
Definition: list_widget.hpp:49
Represents a single GUI screen.
Definition: screen.hpp:94
virtual void eventCallback(GUIEngine::Widget *widget, const std::string &name, const int playerID) OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: options_screen_device.cpp:533
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
DeviceConfig * m_config
The configuration to use.
Definition: options_screen_device.hpp:52
virtual bool onEscapePressed() OVERRIDE
implement optional callback from parent class GUIEngine::Screen
Definition: options_screen_device.cpp:651
void gotSensedInput(const Input &sensedInput)
invoke in "input sensing" mode, when input was sensed.
Definition: options_screen_device.cpp:420