-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainform.cpp
More file actions
438 lines (345 loc) · 14.3 KB
/
mainform.cpp
File metadata and controls
438 lines (345 loc) · 14.3 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
/////////////////////////////////////////////////////////////////////////////
// Name: mainform.cpp
// Purpose:
// Author: Sergey Talipov
// Modified by:
// Created: 24.04.2025 17:45:31
// RCS-ID:
// Copyright: 15681627-3C745D8E-630127F2
// Licence:
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
////@begin includes
#include "wx/imaglist.h"
////@end includes
#include "mainform.h"
////@begin XPM images
#include "tsnsoft.xpm"
#include "wxwidgets.xpm"
////@end XPM images
#include "CARD.xpm"
#include "BIT.xpm"
#include "QR.xpm"
#include "DOLLAR.xpm"
/*
* MainForm type definition
*/
IMPLEMENT_CLASS( MainForm, wxFrame )
/*
* MainForm event table definition
*/
BEGIN_EVENT_TABLE( MainForm, wxFrame )
////@begin MainForm event table entries
EVT_RADIOBOX( ID_RADIOBOX, MainForm::OnRadioboxSelected )
EVT_LISTBOX( ID_LISTBOX, MainForm::OnListboxSelected )
EVT_CHECKBOX( ID_CHECKBOX, MainForm::OnCheckboxClick )
EVT_CHOICE( ID_CHOICE, MainForm::OnChoiceSelected )
EVT_BUTTON( ID_BUTTON2, MainForm::ResetAll )
EVT_BUTTON( ID_BUTTON1, MainForm::OnClose )
////@end MainForm event table entries
END_EVENT_TABLE()
/*
* MainForm constructors
*/
MainForm::MainForm()
{
Init();
}
MainForm::MainForm( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
Init();
Create( parent, id, caption, pos, size, style );
}
/*
* MainForm creator
*/
bool MainForm::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin MainForm creation
wxFrame::Create( parent, id, caption, pos, size, style );
CreateControls();
SetIcon(GetIconResource(wxT("tsnsoft.xpm")));
Centre();
////@end MainForm creation
return true;
}
/*
* MainForm destructor
*/
MainForm::~MainForm()
{
////@begin MainForm destruction
////@end MainForm destruction
}
/*
* Member initialisation
*/
void MainForm::Init()
{
////@begin MainForm member initialisation
RADIO_TEXT = NULL;
RADIOBOXCHOICE = NULL;
RADIO_IMAGE = NULL;
COMBO_TEXT = NULL;
COMBOBOX_CHOICE = NULL;
COMBO_IMAGE = NULL;
CHECK_TEXT = NULL;
CHECK_PAY = NULL;
CHECK_IMAGE = NULL;
CHOICE_TEXT = NULL;
CHOICE_LIST_BOX = NULL;
CHOICE_IMAGE = NULL;
EXIT = NULL;
////@end MainForm member initialisation
}
/*
* Control creation for MainForm
*/
void MainForm::CreateControls()
{
////@begin MainForm content construction
MainForm* itemFrame1 = this;
wxBoxSizer* itemBoxSizer1 = new wxBoxSizer(wxVERTICAL);
itemFrame1->SetSizer(itemBoxSizer1);
wxNotebook* itemNotebook3 = new wxNotebook( itemFrame1, ID_NOTEBOOK, wxDefaultPosition, wxSize(640, 480), wxBK_DEFAULT );
wxPanel* itemPanel4 = new wxPanel( itemNotebook3, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
itemPanel4->SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
itemPanel4->SetBackgroundColour(wxColour(253, 234, 198));
wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
itemPanel4->SetSizer(itemBoxSizer5);
RADIO_TEXT = new wxStaticText( itemPanel4, wxID_STATIC, wxT("Выберите способ оплаты"), wxDefaultPosition, wxDefaultSize, 0 );
RADIO_TEXT->SetForegroundColour(wxColour(197, 35, 47));
RADIO_TEXT->SetFont(wxFont(12, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxT("Tahoma")));
itemBoxSizer5->Add(RADIO_TEXT, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
itemBoxSizer5->Add(5, 32, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxArrayString RADIOBOXCHOICEStrings;
RADIOBOXCHOICEStrings.Add(wxT("&Наличные"));
RADIOBOXCHOICEStrings.Add(wxT("&Карта"));
RADIOBOXCHOICEStrings.Add(wxT("&Криптовалюта"));
RADIOBOXCHOICEStrings.Add(wxT("&QR-код"));
RADIOBOXCHOICE = new wxRadioBox( itemPanel4, ID_RADIOBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, RADIOBOXCHOICEStrings, 1, wxRA_SPECIFY_ROWS );
RADIOBOXCHOICE->SetSelection(0);
itemBoxSizer5->Add(RADIOBOXCHOICE, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
itemBoxSizer5->Add(5, 16, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
RADIO_IMAGE = new wxStaticBitmap( itemPanel4, wxID_STATIC, itemFrame1->GetBitmapResource(wxT("wxwidgets.xpm")), wxDefaultPosition, wxSize(60, 46), 0 );
itemBoxSizer5->Add(RADIO_IMAGE, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
itemNotebook3->AddPage(itemPanel4, wxT("Radio Button Choice"));
wxPanel* itemPanel1 = new wxPanel( itemNotebook3, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
itemPanel1->SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
itemPanel1->SetBackgroundColour(wxColour(253, 234, 198));
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
itemPanel1->SetSizer(itemBoxSizer2);
COMBO_TEXT = new wxStaticText( itemPanel1, wxID_STATIC, wxT("Выберите способ оплаты"), wxDefaultPosition, wxDefaultSize, 0 );
COMBO_TEXT->SetForegroundColour(wxColour(197, 35, 47));
COMBO_TEXT->SetFont(wxFont(12, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxT("Tahoma")));
itemBoxSizer2->Add(COMBO_TEXT, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxArrayString COMBOBOX_CHOICEStrings;
COMBOBOX_CHOICEStrings.Add(wxT("Наличные"));
COMBOBOX_CHOICEStrings.Add(wxT("Карта"));
COMBOBOX_CHOICEStrings.Add(wxT("Криптовалюта"));
COMBOBOX_CHOICEStrings.Add(wxT("QR-код"));
COMBOBOX_CHOICE = new wxListBox( itemPanel1, ID_LISTBOX, wxDefaultPosition, wxDefaultSize, COMBOBOX_CHOICEStrings, wxLB_SINGLE );
itemBoxSizer2->Add(COMBOBOX_CHOICE, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
itemBoxSizer2->Add(5, 32, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
COMBO_IMAGE = new wxStaticBitmap( itemPanel1, wxID_STATIC, itemFrame1->GetBitmapResource(wxT("wxwidgets.xpm")), wxDefaultPosition, wxSize(60, 46), 0 );
itemBoxSizer2->Add(COMBO_IMAGE, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
itemNotebook3->AddPage(itemPanel1, wxT("Combo Box Choice"));
wxPanel* itemPanel2 = new wxPanel( itemNotebook3, ID_PANEL2, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
itemPanel2->SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
itemPanel2->SetBackgroundColour(wxColour(253, 234, 198));
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL);
itemPanel2->SetSizer(itemBoxSizer4);
CHECK_TEXT = new wxStaticText( itemPanel2, wxID_STATIC, wxT("Будете оплачивать наличными?"), wxDefaultPosition, wxDefaultSize, 0 );
CHECK_TEXT->SetForegroundColour(wxColour(197, 35, 47));
CHECK_TEXT->SetFont(wxFont(12, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxT("Tahoma")));
itemBoxSizer4->Add(CHECK_TEXT, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
itemBoxSizer4->Add(5, 32, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
CHECK_PAY = new wxCheckBox( itemPanel2, ID_CHECKBOX, wxT("Оплата наличными"), wxDefaultPosition, wxDefaultSize, 0 );
CHECK_PAY->SetValue(false);
CHECK_PAY->SetFont(wxFont(12, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxT("Tahoma")));
itemBoxSizer4->Add(CHECK_PAY, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
itemBoxSizer4->Add(5, 16, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
CHECK_IMAGE = new wxStaticBitmap( itemPanel2, wxID_STATIC, itemFrame1->GetBitmapResource(wxT("wxwidgets.xpm")), wxDefaultPosition, wxSize(60, 46), 0 );
itemBoxSizer4->Add(CHECK_IMAGE, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
itemNotebook3->AddPage(itemPanel2, wxT("Check Button Choice"));
wxPanel* itemPanel3 = new wxPanel( itemNotebook3, ID_PANEL3, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
itemPanel3->SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
itemPanel3->SetBackgroundColour(wxColour(253, 234, 198));
wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxVERTICAL);
itemPanel3->SetSizer(itemBoxSizer6);
CHOICE_TEXT = new wxStaticText( itemPanel3, wxID_STATIC, wxT("Выберите оплату"), wxDefaultPosition, wxDefaultSize, 0 );
CHOICE_TEXT->SetForegroundColour(wxColour(197, 35, 47));
CHOICE_TEXT->SetFont(wxFont(12, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxT("Tahoma")));
itemBoxSizer6->Add(CHOICE_TEXT, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
itemBoxSizer6->Add(5, 32, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxArrayString CHOICE_LIST_BOXStrings;
CHOICE_LIST_BOXStrings.Add(wxT("Наличные"));
CHOICE_LIST_BOXStrings.Add(wxT("Карта"));
CHOICE_LIST_BOXStrings.Add(wxT("Криптовалюта"));
CHOICE_LIST_BOXStrings.Add(wxT("QR-Код"));
CHOICE_LIST_BOX = new wxChoice( itemPanel3, ID_CHOICE, wxDefaultPosition, wxDefaultSize, CHOICE_LIST_BOXStrings, 0 );
CHOICE_LIST_BOX->SetStringSelection(wxT("Наличные"));
itemBoxSizer6->Add(CHOICE_LIST_BOX, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
itemBoxSizer6->Add(5, 16, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
CHOICE_IMAGE = new wxStaticBitmap( itemPanel3, wxID_STATIC, itemFrame1->GetBitmapResource(wxT("wxwidgets.xpm")), wxDefaultPosition, wxSize(60, 46), 0 );
itemBoxSizer6->Add(CHOICE_IMAGE, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
itemNotebook3->AddPage(itemPanel3, wxT("Choice"));
itemBoxSizer1->Add(itemNotebook3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer1->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxButton* itemButton6 = new wxButton( itemFrame1, ID_BUTTON2, wxT("Сброс"), wxDefaultPosition, wxSize(128, 32), 0 );
itemBoxSizer3->Add(itemButton6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
itemBoxSizer3->Add(64, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
EXIT = new wxButton( itemFrame1, ID_BUTTON1, wxT("Выйти"), wxDefaultPosition, wxSize(128, 32), 0 );
itemBoxSizer3->Add(EXIT, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
////@end MainForm content construction
}
/*
* Should we show tooltips?
*/
bool MainForm::ShowToolTips()
{
return true;
}
/*
* Get bitmap resources
*/
wxBitmap MainForm::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin MainForm bitmap retrieval
wxUnusedVar(name);
if (name == wxT("wxwidgets.xpm"))
{
wxBitmap bitmap(wxwidgets_xpm);
return bitmap;
}
return wxNullBitmap;
////@end MainForm bitmap retrieval
}
/*
* Get icon resources
*/
wxIcon MainForm::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin MainForm icon retrieval
wxUnusedVar(name);
if (name == wxT("tsnsoft.xpm"))
{
wxIcon icon(tsnsoft_xpm);
return icon;
}
return wxNullIcon;
////@end MainForm icon retrieval
}
/*
* wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_RADIOBOX
*/
void MainForm::OnRadioboxSelected( wxCommandEvent& event )
{
int ChoiceNumber = RADIOBOXCHOICE -> GetSelection();
wxString Selected_Cost = RADIOBOXCHOICE -> GetString(ChoiceNumber);
RADIO_TEXT -> SetLabel(wxT("Выбрано: " + Selected_Cost));
if(ChoiceNumber == 0){
RADIO_IMAGE -> SetBitmap(wxBitmap(DOLLAR_xpm));
}
else if(ChoiceNumber == 1){
RADIO_IMAGE -> SetBitmap(wxBitmap(CARD_xpm));
}
else if(ChoiceNumber == 2){
RADIO_IMAGE -> SetBitmap(wxBitmap(BIT_xpm));
}
else if(ChoiceNumber == 3){
RADIO_IMAGE -> SetBitmap(wxBitmap(QR_xpm));
}
}
/*
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON1
*/
void MainForm::OnClose( wxCommandEvent& event )
{
wxTheApp -> Exit();
}
/*
* wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_LISTBOX
*/
void MainForm::OnListboxSelected( wxCommandEvent& event )
{
int ComboSelection = COMBOBOX_CHOICE -> GetSelection();
wxString Selected = COMBOBOX_CHOICE -> GetString(ComboSelection);
COMBO_TEXT -> SetLabel(wxT("Выбрано: " + Selected));
if(ComboSelection == 0){
COMBO_IMAGE -> SetBitmap(wxBitmap(DOLLAR_xpm));
}
else if(ComboSelection == 1){
COMBO_IMAGE -> SetBitmap(wxBitmap(CARD_xpm));
}
else if(ComboSelection == 2){
COMBO_IMAGE -> SetBitmap(wxBitmap(BIT_xpm));
}
else if(ComboSelection == 3){
COMBO_IMAGE -> SetBitmap(wxBitmap(QR_xpm));
}
}
/*
* wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX
*/
void MainForm::OnCheckboxClick( wxCommandEvent& event )
{
bool Checked = CHECK_PAY -> GetValue();
if(Checked){
CHECK_TEXT -> SetLabel(wxT("Оплата наличными"));
CHECK_IMAGE -> SetBitmap(wxBitmap(DOLLAR_xpm));
}
else{
CHECK_TEXT -> SetLabel(wxT("Оплата картой"));
CHECK_IMAGE -> SetBitmap(wxBitmap(CARD_xpm));
}
}
/*
* wxEVT_COMMAND_CHOICE_SELECTED event handler for ID_CHOICE
*/
void MainForm::OnChoiceSelected( wxCommandEvent& event )
{
int Choice = CHOICE_LIST_BOX -> GetSelection();
wxString CHOICE_Selected = CHOICE_LIST_BOX -> GetString(Choice);
CHOICE_TEXT -> SetLabel(wxT("Выбрано: "+CHOICE_Selected));
if(Choice == 0){
CHOICE_IMAGE -> SetBitmap(wxBitmap(DOLLAR_xpm));
}
else if(Choice == 1){
CHOICE_IMAGE -> SetBitmap(wxBitmap(CARD_xpm));
}
else if(Choice == 2){
CHOICE_IMAGE -> SetBitmap(wxBitmap(BIT_xpm));
}
else if(Choice == 3){
CHOICE_IMAGE -> SetBitmap(wxBitmap(QR_xpm));
}
}
/*
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON2
*/
void MainForm::ResetAll( wxCommandEvent& event )
{
COMBO_IMAGE -> SetBitmap(wxBitmap(wxwidgets_xpm));
CHECK_IMAGE -> SetBitmap(wxBitmap(wxwidgets_xpm));
CHOICE_IMAGE -> SetBitmap(wxBitmap(wxwidgets_xpm));
RADIO_IMAGE -> SetBitmap(wxBitmap(wxwidgets_xpm));
CHOICE_LIST_BOX -> SetSelection(0);
CHECK_PAY -> SetValue(false);
COMBOBOX_CHOICE -> SetSelection(0);
RADIOBOXCHOICE -> SetSelection(0);
CHOICE_TEXT -> SetLabel(wxT("Выберите оплату"));
CHECK_TEXT -> SetLabel(wxT("Будете оплачивать наличными?"));
COMBO_TEXT -> SetLabel(wxT("Выберите оплату"));
RADIO_TEXT -> SetLabel(wxT("Выберите оплату"));
}