The source file does not seem to be attached so here is the source code
base.h
#ifndef __BASE_H
#define __BASE_H
class MainApp: public wxApp
{
public:
virtual bool OnInit();
};
class MainFrame: public wxFrame
{
public:
MainFrame(const wxString &title, const wxPoint &pos, const wxSize &size);
void OnQuit(wxCommandEvent &event);
private:
DECLARE_EVENT_TABLE()
};
enum
{
MainWin_Quit = wxID_HIGHEST+1
};
BEGIN_EVENT_TABLE(MainFrame, wxFrame)
EVT_MENU(MainWin_Quit, MainFrame::OnQuit)
END_EVENT_TABLE()
#endif base.cpp
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include "base.h"
IMPLEMENT_APP(MainApp)
bool MainApp::OnInit()
{
MainFrame *win = new MainFrame("Frame", wxPoint (100, 100),
wxSize(450, 340));
win->Show(TRUE);
SetTopWindow(win);
return TRUE;
}
MainFrame::MainFrame(const wxString &title, const wxPoint &pos, const wxSize &size)
: wxFrame((wxFrame *) NULL, -1, title, pos, size)
{
wxMenu *FileMenu = new wxMenu;
wxMenuBar *MenuBar = new wxMenuBar;
FileMenu->Append(MainWin_Quit, "&Quit");
MenuBar->Append(FileMenu, "&File");
SetMenuBar(MenuBar);
CreateStatusBar(2);
SetStatusText("Hello World!");
}
void MainFrame::OnQuit(wxCommandEvent & WXUNUSED(event))
{
Close(TRUE);
} |