SuperTuxKart
enter_address_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_ENTER_ADDRESS_DIALOG_HPP
19 #define HEADER_ENTER_ADDRESS_DIALOG_HPP
20 
21 #include "guiengine/modaldialog.hpp"
22 #include "utils/cpp2011.hpp"
23 #include <memory>
24 
25 class Server;
26 namespace GUIEngine
27 {
28  class LabelWidget;
29  class ListWidget;
30  class TextBoxWidget;
31 }
32 
38 {
39 private:
40  GUIEngine::LabelWidget* m_title;
41  GUIEngine::TextBoxWidget* m_text_field;
42  std::shared_ptr<Server>* m_entered_server;
43  bool m_self_destroy;
44  GUIEngine::ListWidget* m_list;
45  // ------------------------------------------------------------------------
46  void loadList();
47  // ------------------------------------------------------------------------
48  bool validate();
49  // ------------------------------------------------------------------------
50 public:
51  EnterAddressDialog(std::shared_ptr<Server>* entered_server);
52  // ------------------------------------------------------------------------
54  // ------------------------------------------------------------------------
55  virtual void onUpdate(float dt) OVERRIDE;
56  // ------------------------------------------------------------------------
57  virtual void onEnterPressedInternal() OVERRIDE;
58  // ------------------------------------------------------------------------
59  GUIEngine::EventPropagation processEvent(const std::string& event_source)
60  OVERRIDE;
61  // ------------------------------------------------------------------------
62  GUIEngine::TextBoxWidget* getTextField() const { return m_text_field; }
63 };
64 #endif
Dialog that shows up when user wants to enter server address.
Definition: enter_address_dialog.hpp:38
GUIEngine::EventPropagation processEvent(const std::string &event_source) OVERRIDE
Returns whether to block event propagation (usually, you will want to block events you processed)
Definition: enter_address_dialog.cpp:85
virtual void onUpdate(float dt) OVERRIDE
Override to be notified of updates.
Definition: enter_address_dialog.cpp:63
A simple label widget.
Definition: label_widget.hpp:41
A vertical list widget with text entries.
Definition: list_widget.hpp:50
Abstract base class representing a modal dialog.
Definition: modaldialog.hpp:56
A text field widget.
Definition: text_box_widget.hpp:53
Definition: server.hpp:44
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33