39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
#include "ui/cFrame.h"
|
|
|
|
enum { ID_Hello = 1 };
|
|
|
|
cFrame::cFrame() : wxMDIParentFrame(nullptr, wxID_ANY, "Hello World") {
|
|
auto *menuFile = new wxMenu;
|
|
menuFile->Append(ID_Hello, "&Hello...\tCtrl-H",
|
|
"Help string shown in status bar for this menu item");
|
|
menuFile->AppendSeparator();
|
|
menuFile->Append(wxID_EXIT);
|
|
|
|
auto *menuHelp = new wxMenu;
|
|
menuHelp->Append(wxID_ABOUT);
|
|
|
|
auto *menuBar = new wxMenuBar;
|
|
menuBar->Append(menuFile, "&File");
|
|
menuBar->Append(menuHelp, "&Help");
|
|
|
|
SetMenuBar(menuBar);
|
|
|
|
CreateStatusBar();
|
|
SetStatusText("Welcome to wxWidgets!");
|
|
|
|
Bind(wxEVT_MENU, &cFrame::OnHello, this, ID_Hello);
|
|
Bind(wxEVT_MENU, &cFrame::OnAbout, this, wxID_ABOUT);
|
|
Bind(wxEVT_MENU, &cFrame::OnExit, this, wxID_EXIT);
|
|
}
|
|
|
|
void cFrame::OnExit(wxCommandEvent &event) { Close(true); }
|
|
|
|
void cFrame::OnAbout(wxCommandEvent &event) {
|
|
wxMessageBox("This is a wxWidgets Hello World example", "About Hello World",
|
|
wxOK | wxICON_INFORMATION);
|
|
}
|
|
|
|
void cFrame::OnHello(wxCommandEvent &event) {
|
|
wxLogMessage("Hello world from wxWidgets!");
|
|
}
|