This repository has been archived by the owner on Jun 26, 2024. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 1
Files
/
testMain.cpp
114 lines (98 loc) · 3.65 KB
/
testMain.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
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
/***************************************************************
* Name: testMain.cpp
* Purpose: Code for Application Frame
* Author: Michael Agarkov (michaelagarkov@outlook.com)
* Created: 2024-06-26
* Copyright: Michael Agarkov (https://github.com/MichaelAgarkov)
* License: 0BSD
**************************************************************/
#include "wx_pch.h"
#include "testMain.h"
#include <wx/msgdlg.h>
#include "version.h"
//(*InternalHeaders(testFrame)
#include <wx/intl.h>
#include <wx/string.h>
//*)
//helper functions
enum wxbuildinfoformat {
short_f, long_f
};
wxString wxbuildinfo(wxbuildinfoformat format) {
wxString wxbuild(wxVERSION_STRING);
if (format == long_f ) {
#if defined(__WXMSW__)
wxbuild << _T("-Windows");
#elif defined(__UNIX__)
wxbuild << _T("-Linux");
#endif
#if wxUSE_UNICODE
wxbuild << _T("-Unicode build");
#else
wxbuild << _T("-ANSI build");
#endif // wxUSE_UNICODE
}
return wxbuild;
}
//(*IdInit(testFrame)
const long testFrame::ID_BUTTON1 = wxNewId();
const long testFrame::ID_PANEL1 = wxNewId();
const long testFrame::ID_NOTEBOOK1 = wxNewId();
const long testFrame::idMenuQuit = wxNewId();
const long testFrame::idMenuAbout = wxNewId();
const long testFrame::ID_STATUSBAR1 = wxNewId();
//*)
BEGIN_EVENT_TABLE(testFrame,wxFrame)
//(*EventTable(testFrame)
//*)
END_EVENT_TABLE()
testFrame::testFrame(wxWindow* parent,wxWindowID id) {
//(*Initialize(testFrame)
wxMenu* Menu1;
wxMenu* Menu2;
wxMenuBar* MenuBar1;
wxMenuItem* MenuItem1;
wxMenuItem* MenuItem2;
Create(parent, id, _("Test program"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("id"));
Notebook1 = new wxNotebook(this, ID_NOTEBOOK1, wxPoint(152,280), wxDefaultSize, 0, _T("ID_NOTEBOOK1"));
Panel1 = new wxPanel(Notebook1, ID_PANEL1, wxPoint(121,225), wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
Button1 = new wxButton(Panel1, ID_BUTTON1, _("Click me!"), wxPoint(8,8), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
Notebook1->AddPage(Panel1, _("Test123"), false);
MenuBar1 = new wxMenuBar();
Menu1 = new wxMenu();
MenuItem1 = new wxMenuItem(Menu1, idMenuQuit, _("Quit\tAlt-F4"), _("Quit the application"), wxITEM_NORMAL);
Menu1->Append(MenuItem1);
MenuBar1->Append(Menu1, _("&File"));
Menu2 = new wxMenu();
MenuItem2 = new wxMenuItem(Menu2, idMenuAbout, _("About\tF1"), _("Show info about this application"), wxITEM_NORMAL);
Menu2->Append(MenuItem2);
MenuBar1->Append(Menu2, _("Help"));
SetMenuBar(MenuBar1);
StatusBar1 = new wxStatusBar(this, ID_STATUSBAR1, 0, _T("ID_STATUSBAR1"));
int __wxStatusBarWidths_1[1] = { -1 };
int __wxStatusBarStyles_1[1] = { wxSB_NORMAL };
StatusBar1->SetFieldsCount(1,__wxStatusBarWidths_1);
StatusBar1->SetStatusStyles(1,__wxStatusBarStyles_1);
SetStatusBar(StatusBar1);
Center();
Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&testFrame::OnButton1Click);
Connect(idMenuQuit,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&testFrame::OnQuit);
Connect(idMenuAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&testFrame::OnAbout);
//*)
}
testFrame::~testFrame() {
//(*Destroy(testFrame)
//*)
}
void testFrame::OnQuit(wxCommandEvent& event) {
Close();
}
void testFrame::OnAbout(wxCommandEvent& event) {
wxString msg = "Test program\nVersion ";
msg << AutoVersion::UBUNTU_VERSION_STYLE;
msg << "\n\nBy Michael Agarkov";
wxMessageBox(msg, _("Welcome to..."));
}
void testFrame::OnButton1Click(wxCommandEvent& event) {
wxMessageBox(wxString("Hello, world!"), _("This is a wxMessageBox!"));
}