SuperTuxKart
server_info_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_SERVER_INFO_DIALOG_HPP
20 #define HEADER_SERVER_INFO_DIALOG_HPP
21 
22 #include "guiengine/modaldialog.hpp"
23 #include "utils/types.hpp"
24 
25 namespace GUIEngine
26 {
27  class LabelWidget;
28  class RibbonWidget;
29  class IconButtonWidget;
30  class TextBoxWidget;
31 }
32 
33 #include <memory>
34 #include <irrString.h>
35 
36 class Server;
37 
42 {
43 
44 private:
45  bool m_self_destroy, m_join_server;
46 
47  const std::shared_ptr<Server> m_server;
48 
49  GUIEngine::RibbonWidget *m_options_widget;
50 
53 
56 
57  GUIEngine::IconButtonWidget *m_bookmark_widget;
58 
61 
62  video::ITexture* m_bookmark_icon;
63 
64  video::ITexture* m_remove_icon;
65 
66  void updateBookmarkStatus(bool change_bookmark);
67 public:
68  ServerInfoDialog(std::shared_ptr<Server> server);
70 
72  GUIEngine::EventPropagation processEvent(const std::string& eventSource);
73  virtual void beforeAddingWidgets();
74 
75  virtual bool onEscapePressed();
76  virtual void onUpdate(float dt);
77  void requestJoin();
78 }; // class ServerInfoDialog
79 
80 #endif
A button widget with an icon and optionnaly a label beneath.
Definition: icon_button_widget.hpp:44
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 sign in.
Definition: server_info_dialog.hpp:42
GUIEngine::TextBoxWidget * m_password
Specify server password if needed.
Definition: server_info_dialog.hpp:60
virtual bool onEscapePressed()
Override to change what happens on escape pressed.
Definition: server_info_dialog.cpp:234
GUIEngine::IconButtonWidget * m_cancel_widget
The cancel button.
Definition: server_info_dialog.hpp:55
GUIEngine::EventPropagation processEvent(const std::string &eventSource)
Returns whether to block event propagation (usually, you will want to block events you processed)
Definition: server_info_dialog.cpp:194
virtual void onUpdate(float dt)
Override to be notified of updates.
Definition: server_info_dialog.cpp:242
virtual void beforeAddingWidgets()
Optional callback invoked very early, before widgets have been added (contrast with init(),...
Definition: server_info_dialog.cpp:315
GUIEngine::IconButtonWidget * m_join_widget
The join button.
Definition: server_info_dialog.hpp:52
void onEnterPressedInternal()
When the player pressed enter, select 'join' as default.
Definition: server_info_dialog.cpp:222
ServerInfoDialog(std::shared_ptr< Server > server)
Dialog constructor.
Definition: server_info_dialog.cpp:55
Definition: server.hpp:44
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33
Declares the general types that are used by the network.