-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverdialog.hpp
83 lines (73 loc) · 2.49 KB
/
serverdialog.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
sueca - An implementation of the Portuguese game "Sueca" in C++ and wxWidgets
Copyright (C) 2003-2024 Rodrigo Araujo
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef _SERVERDIALOG_HPP_
#define _SERVERDIALOG_HPP_ 1
// Forward declarations
class ServerDialog;
#include <wx/list.h>
#include <wx/sizer.h>
#include <wx/dialog.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/hashmap.h>
#include <wx/stattext.h>
#include "chatpanel.hpp"
#include "serverhandler.hpp"
#include "netserverplayer.hpp"
class Position
{
public:
NetServerPlayer* player;
wxStaticText* label;
GamePos* gpos;
Position( wxStaticText* initlabel, GamePos* initgpos ):
player( NULL ), label( initlabel ), gpos( initgpos ) {}
};
WX_DECLARE_STRING_HASH_MAP( Position*, PosMap );
// Server creation dialog
class ServerDialog: public wxDialog
{
public:
ServerDialog( wxWindow* parent );
void ReLayout();
protected:
friend class ServerHandler;
PosMap positions;
ChatPanel* chat;
wxWindowList disconnectedlist;
wxWindowList connectedlist;
Position* GetPlayerPosition( const Player* player );
void SetPosition( Position* pos, NetServerPlayer* pl );
private:
bool ip_enabled;
wxBoxSizer* main_sizer;
wxTextCtrl* ip_entry;
wxTextCtrl* port_entry;
wxButton* ok_button;
wxButton* listen_button;
void OnIpEnabled( wxCommandEvent& event );
void EndListen();
void OnListen( wxCommandEvent& event );
Player* GetPlayerForPos( wxString posname );
void OnBegin( wxCommandEvent& event );
void OnCancel( wxCommandEvent& event ) { Done(); }
void OnClose( wxCloseEvent& event ) { Done(); }
void Done( bool cancel = true );
void OnChatMessage( ChatPanelMsgEvt& event );
Position* GetNotMatchingPos( wxString& posstr, Player* player );
DECLARE_EVENT_TABLE();
};
#endif // _SERVERDIALOG_HPP_