SuperTuxKart
Loading...
Searching...
No Matches
network_player_dialog.hpp
1// SuperTuxKart - a fun racing game with go-kart
2// Copyright (C) 2018 SuperTuxKart-Team
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_NETWORK_USER_DIALOG_HPP
20#define HEADER_NETWORK_USER_DIALOG_HPP
21
22#include "guiengine/modaldialog.hpp"
23#include "utils/types.hpp"
24
25#include <string>
26#include <irrString.h>
27#include <memory>
28
29namespace GUIEngine
30{
31 class IconButtonWidget;
32 class LabelWidget;
33 class RibbonWidget;
34}
35
36class RankingCallback;
37enum HandicapLevel : uint8_t;
38
44{
45private:
46 const uint32_t m_host_id;
47
48 const uint32_t m_online_id;
49
50 const uint8_t m_local_id;
51
52 HandicapLevel m_handicap;
53
54 const core::stringw m_name;
55
56 const std::string m_country_code;
57
58 const bool m_allow_change_team;
59
60 bool m_self_destroy, m_open_report_textbox;
61
62 std::shared_ptr<RankingCallback> m_ranking_callback;
63
64 GUIEngine::RibbonWidget* m_options_widget;
65
66 GUIEngine::LabelWidget* m_desc_widget;
67
68 GUIEngine::LabelWidget* m_info_widget;
69
70 GUIEngine::IconButtonWidget* m_friend_widget;
71
72 GUIEngine::IconButtonWidget* m_kick_widget;
73
74 GUIEngine::IconButtonWidget* m_change_team_widget;
75
76 GUIEngine::IconButtonWidget* m_cancel_widget;
77
78 GUIEngine::IconButtonWidget* m_handicap_widget;
79
80 GUIEngine::IconButtonWidget* m_report_widget;
81public:
82 NetworkPlayerDialog(uint32_t host_id, uint32_t online_id, uint8_t local_id,
83 const core::stringw& name,
84 const std::string& country_code,
85 bool allow_change_team, HandicapLevel h)
86 : ModalDialog(0.8f,0.8f), m_host_id(host_id), m_online_id(online_id),
87 m_local_id(local_id), m_handicap(h),
88 m_name(name), m_country_code(country_code),
89 m_allow_change_team(allow_change_team), m_self_destroy(false),
90 m_open_report_textbox(false)
91 {
92 loadFromFile("online/user_info_dialog.stkgui");
93 }
94 // ------------------------------------------------------------------------
96 // ------------------------------------------------------------------------
97 virtual void beforeAddingWidgets();
98 // ------------------------------------------------------------------------
99 void onEnterPressedInternal() { m_self_destroy = true; }
100 // ------------------------------------------------------------------------
101 GUIEngine::EventPropagation processEvent(const std::string& source);
102 // ------------------------------------------------------------------------
103 virtual bool onEscapePressed();
104 // ------------------------------------------------------------------------
105 virtual void onUpdate(float dt);
106 // ------------------------------------------------------------------------
107 virtual void init();
108
109};
110
111#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:36
Abstract base class representing a modal dialog.
Definition: modaldialog.hpp:56
void loadFromFile(const char *xmlFile)
Load a XML file to create the dialog from.
Definition: modaldialog.cpp:69
ModalDialog(const float percentWidth, const float percentHeight, ModalDialogLocation location=MODAL_DIALOG_LOCATION_CENTER)
Creates a modal dialog with given percentage of screen width and height.
Definition: modaldialog.cpp:54
A static text/icons/tabs bar widget.
Definition: ribbon_widget.hpp:60
Dialog that handle player in network lobby.
Definition: network_player_dialog.hpp:44
GUIEngine::EventPropagation processEvent(const std::string &source)
Returns whether to block event propagation (usually, you will want to block events you processed)
Definition: network_player_dialog.cpp:222
virtual bool onEscapePressed()
Override to change what happens on escape pressed.
Definition: network_player_dialog.cpp:285
virtual void onUpdate(float dt)
Override to be notified of updates.
Definition: network_player_dialog.cpp:175
virtual void beforeAddingWidgets()
Optional callback invoked very early, before widgets have been added (contrast with init(),...
Definition: network_player_dialog.cpp:45
virtual void init()
Optional callback invoked after widgets have been add()ed.
Definition: network_player_dialog.cpp:168
Definition: ranking_callback.hpp:31
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33
HandicapLevel
Handicap per player.
Definition: remote_kart_info.hpp:42
Declares the general types that are used by the network.