-
Notifications
You must be signed in to change notification settings - Fork 1
/
SelectOpponentsPanel.cpp
65 lines (49 loc) · 1.87 KB
/
SelectOpponentsPanel.cpp
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
//
// Created by yaroslav on 21.02.19.
//
#include "SelectOpponentsPanel.h"
SelectOpponentsPanel::SelectOpponentsPanel(const wxString & title)
: wxDialog(NULL, -1, title, wxDefaultPosition, wxSize(250, 230))
{
count_of_opponents = 0;
wxPanel *panel = new wxPanel(this, -1);
wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL);
wxStaticBox *st = new wxStaticBox(panel, -1, wxT("Colors"),
wxPoint(5, 5), wxSize(240, 150));
chice1 = new wxRadioButton(panel, -1, wxT("2 users"), wxPoint(15, 30), wxDefaultSize, wxRB_GROUP);
chice2 = new wxRadioButton(panel, -1, wxT("3 users"), wxPoint(15, 80));
// ok
wxButton *okButton = new wxButton(this, ID_OKEY, wxT("Ok"),
wxDefaultPosition, wxSize(70, 30));
Connect(ID_OKEY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SelectOpponentsPanel::Verification));
// close
wxButton *closeButton = new wxButton(this, ID_CLOSE, wxT("Close"),
wxDefaultPosition, wxSize(70, 30));
Connect(ID_CLOSE, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SelectOpponentsPanel::Exit));
hbox->Add(okButton, 1);
hbox->Add(closeButton, 1, wxLEFT, 5);
vbox->Add(panel, 1);
vbox->Add(hbox, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, 10);
SetSizer(vbox);
Centre();
ShowModal();
}
void SelectOpponentsPanel::Verification(wxCommandEvent& WXUNUSED(event))
{
if (this->chice1->GetValue()) {
this->count_of_opponents = 2;
Destroy();
}
else if (this->chice2->GetValue()) {
this->count_of_opponents = 3;
Destroy();
}
}
void SelectOpponentsPanel::Exit(wxCommandEvent& WXUNUSED(event))
{
Destroy();
}
int SelectOpponentsPanel::GetCountOpponents() {
return this->count_of_opponents;
}