SuperTuxKart
recovery_dialog.hpp
1 // SuperTuxKart - a fun racing game with go-kart
2 // Copyright (C) 2013-2015 Glenn De Jonghe
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_RECOVERY_DIALOG_HPP
20 #define HEADER_RECOVERY_DIALOG_HPP
21 
22 #include "guiengine/modaldialog.hpp"
23 
24 namespace GUIEngine
25 {
26  class IconButtonWidget; class LabelWidget; class RibbonWidget;
27  class TextBoxWidget;
28 }
29 namespace Online
30 {
31  class XMLRequest;
32 }
33 
39 {
40 public:
41  enum Phase
42  {
43  Input = 1,
44  Info = 2,
45  };
47  virtual ~RecoveryDialog();
48 
50  GUIEngine::EventPropagation processEvent(const std::string& eventSource);
51 
52  virtual void onUpdate(float dt);
53  virtual bool onEscapePressed();
54 
55 private:
56  Phase m_phase;
57  bool m_self_destroy;
58  bool m_show_recovery_input;
59  bool m_show_recovery_info;
60 
61  std::shared_ptr<Online::XMLRequest> m_recovery_request;
62 
63  GUIEngine::TextBoxWidget * m_username_widget;
64  GUIEngine::TextBoxWidget * m_email_widget;
65 
66  GUIEngine::LabelWidget * m_info_widget;
67 
68  GUIEngine::RibbonWidget * m_options_widget;
69  GUIEngine::IconButtonWidget * m_submit_widget;
70  GUIEngine::IconButtonWidget * m_cancel_widget;
71 
72  void showRecoveryInput();
73  void showRecoveryInfo();
74  void processInput();
75 };
76 
77 #endif
A button widget with an icon and optionnaly a label beneath.
Definition: icon_button_widget.hpp:44
A simple label widget.
Definition: label_widget.hpp:41
Abstract base class representing a modal dialog.
Definition: modaldialog.hpp:56
A static text/icons/tabs bar widget.
Definition: ribbon_widget.hpp:66
A text field widget.
Definition: text_box_widget.hpp:53
Dialog that allows a user to recover his account.
Definition: recovery_dialog.hpp:39
void onEnterPressedInternal()
Called when the user pressed enter.
Definition: recovery_dialog.cpp:174
GUIEngine::EventPropagation processEvent(const std::string &eventSource)
Handle a user event.
Definition: recovery_dialog.cpp:146
virtual bool onEscapePressed()
Let esc act as cancel.
Definition: recovery_dialog.cpp:108
virtual void onUpdate(float dt)
This is called every frame and checks if an outstanding recovery request was finished.
Definition: recovery_dialog.cpp:188
virtual ~RecoveryDialog()
Destructor, destroys the recovery request.
Definition: recovery_dialog.cpp:53
RecoveryDialog()
Constructor for the recovery dialog.
Definition: recovery_dialog.cpp:42
void showRecoveryInput()
Shows the input screen to get the account name and email address.
Definition: recovery_dialog.cpp:60
void showRecoveryInfo()
Informs the user that an email will be sent.
Definition: recovery_dialog.cpp:89
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33
Definition: input.hpp:35