SuperTuxKart
race_paused_dialog.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 #ifndef HEADER_RACE_PAUSED_DIALOG_HPP
19 #define HEADER_RACE_PAUSED_DIALOG_HPP
20 
21 #include "guiengine/modaldialog.hpp"
22 #include "guiengine/widgets/text_box_widget.hpp"
23 #include "utils/cpp2011.hpp"
24 
25 namespace GE
26 {
27  class GEVulkanDriver;
28 }
29 
30 namespace GUIEngine
31 {
32  class RibbonWidget;
33  class TextBoxWidget;
34 }
35 enum KartTeam : int8_t;
36 
43 {
44 private:
45  KartTeam m_target_team;
46  bool m_self_destroy;
47  bool m_from_overworld;
48  int m_touch_controls;
49 
50  GUIEngine::TextBoxWidget* m_text_box;
51  GE::GEVulkanDriver* m_vk_pbr_toggle;
52 
53  virtual void onTextUpdated() OVERRIDE {}
54  void handleChat(const irr::core::stringw& text);
55  virtual bool onEnterPressed(const irr::core::stringw& text) OVERRIDE;
56 
57  void updateTouchDeviceIcon();
58 
59 protected:
60  virtual void loadedFromFile() OVERRIDE;
61 
62 public:
66  RacePausedDialog(const float percentWidth, const float percentHeight);
67  virtual ~RacePausedDialog();
68  virtual void onEnterPressedInternal() OVERRIDE;
69  GUIEngine::EventPropagation processEvent(const std::string& eventSource)
70  OVERRIDE;
71  virtual void beforeAddingWidgets() OVERRIDE;
72  virtual void init() OVERRIDE;
73  // ------------------------------------------------------------------------
74  virtual void onUpdate(float dt) OVERRIDE
75  {
76  // It's unsafe to delete from inside the event handler so we do it here
77  if (m_self_destroy)
78  {
79  ModalDialog::dismiss();
80  return;
81  }
82  }
83 };
84 
85 #endif
Definition: text_box_widget.hpp:42
Abstract base class representing a modal dialog.
Definition: modaldialog.hpp:56
A text field widget.
Definition: text_box_widget.hpp:53
Dialog shown when the race is paused.
Definition: race_paused_dialog.hpp:43
virtual void loadedFromFile() OVERRIDE
Callback invoked when the dialog was loaded from the XML file (if the constructor that takes a XML fi...
Definition: race_paused_dialog.cpp:201
GUIEngine::EventPropagation processEvent(const std::string &eventSource) OVERRIDE
Returns whether to block event propagation (usually, you will want to block events you processed)
Definition: race_paused_dialog.cpp:255
RacePausedDialog(const float percentWidth, const float percentHeight)
Creates a modal dialog with given percentage of screen width and height.
Definition: race_paused_dialog.cpp:67
virtual void init() OVERRIDE
Optional callback invoked after widgets have been add()ed.
Definition: race_paused_dialog.cpp:551
virtual void onUpdate(float dt) OVERRIDE
Override to be notified of updates.
Definition: race_paused_dialog.hpp:74
virtual void beforeAddingWidgets() OVERRIDE
Optional callback invoked very early, before widgets have been added (contrast with init(),...
Definition: race_paused_dialog.cpp:447
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33