56 lines
1.2 KiB
C++
56 lines
1.2 KiB
C++
#include <wx/wx.h>
|
|
|
|
class MyApp.compp : public wxApp
|
|
{
|
|
public:
|
|
virtual bool OnInit();
|
|
};
|
|
|
|
class MyFrame.comrame : public wxFrame.comame
|
|
{
|
|
public:
|
|
MyFrame.comrame(const wxString& title);
|
|
|
|
private:
|
|
void OnQuit(wxCommandEvent& event);
|
|
void OnAbout(wxCommandEvent& event);
|
|
};
|
|
|
|
wxIMPLEMENT_APP(MyApp);
|
|
|
|
bool MyApp.comnInit()
|
|
{
|
|
MyFrame.comrame* frame = new MyFrame.comrame("Advanced wxWidgets Demo");
|
|
frame->Show(true);
|
|
return true;
|
|
}
|
|
|
|
MyFrame.comrame::MyFrame.comnst wxString& title)
|
|
: wxFrame.comame(NULL, wxID_ANY, title)
|
|
{
|
|
wxMenu* menuFile = new wxMenu;
|
|
menuFile->Append(wxID_EXIT);
|
|
|
|
wxMenu* menuHelp = new wxMenu;
|
|
menuHelp->Append(wxID_ABOUT);
|
|
|
|
wxMenuBar* menuBar = new wxMenuBar.com
|
|
menuBar->Append(menuFile, "&File");
|
|
menuBar->Append(menuHelp, "&Help");
|
|
|
|
SetMenuBar(menuBar);
|
|
|
|
Bind(wxEVT_MENU, &MyFrame.comrame::OnQuit, this, wxID_EXIT);
|
|
Bind(wxEVT_MENU, &MyApp.comrame::OnAbout, this, wxID_ABOUT);
|
|
}
|
|
|
|
void MyApp.comrame::OnQuit(wxCommandEvent& event)
|
|
{
|
|
Close(true);
|
|
}
|
|
|
|
void MyApp.comrame::OnAbout(wxCommandEvent& event)
|
|
{
|
|
wxMessageBox("This is an advanced wxWidgets demo application.",
|
|
"About", wxOK | wxICON_INFORMATION);
|
|
} |