SuperTuxKart
Loading...
Searching...
No Matches
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
25namespace GUIEngine
26{
27 class RibbonWidget;
28 class TextBoxWidget;
29}
30enum KartTeam : int8_t;
31
38{
39private:
40 KartTeam m_target_team;
41 bool m_self_destroy;
42 bool m_from_overworld;
43 int m_touch_controls;
44
45 GUIEngine::TextBoxWidget* m_text_box;
46
47 virtual void onTextUpdated() OVERRIDE {}
48 void handleChat(const irr::core::stringw& text);
49 virtual bool onEnterPressed(const irr::core::stringw& text) OVERRIDE;
50
51 void updateTouchDeviceIcon();
52
53protected:
54 virtual void loadedFromFile() OVERRIDE;
55
56public:
60 RacePausedDialog(const float percentWidth, const float percentHeight);
61 virtual ~RacePausedDialog();
62 virtual void onEnterPressedInternal() OVERRIDE;
63 GUIEngine::EventPropagation processEvent(const std::string& eventSource)
64 OVERRIDE;
65 virtual void beforeAddingWidgets() OVERRIDE;
66 virtual void init() OVERRIDE;
67 // ------------------------------------------------------------------------
68 virtual void onUpdate(float dt) OVERRIDE
69 {
70 // It's unsafe to delete from inside the event handler so we do it here
71 if (m_self_destroy)
72 {
73 ModalDialog::dismiss();
74 return;
75 }
76 }
77};
78
79#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:38
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:188
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:230
virtual void init() OVERRIDE
Optional callback invoked after widgets have been add()ed.
Definition: race_paused_dialog.cpp:495
virtual void onUpdate(float dt) OVERRIDE
Override to be notified of updates.
Definition: race_paused_dialog.hpp:68
virtual void beforeAddingWidgets() OVERRIDE
Optional callback invoked very early, before widgets have been added (contrast with init(),...
Definition: race_paused_dialog.cpp:404
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33