#include <wx/wx.h>

class MyFrame : public wxFrame {       // Declare our main frame class
public:
   MyFrame(const wxString& title);     // Constructor
   void OnQuit(wxCommandEvent& event); // Event handlers
private:
   DECLARE_EVENT_TABLE()               // This class handles events
};

BEGIN_EVENT_TABLE( MyFrame, wxFrame )  // Event table for MyFrame
EVT_MENU( wxID_EXIT, MyFrame::OnQuit )
END_EVENT_TABLE()

void MyFrame::OnQuit( wxCommandEvent& event ) {
   Close(); // Destroy the frame
}

MyFrame::MyFrame( const wxString& title ) :
   wxFrame( NULL, wxID_ANY, title ) {
   CreateStatusBar( 2 );               // Create a status bar
   SetStatusText( wxT( "Welcome to wxWidgets!" ) );
}

class MyApp : public wxApp {           // Declare the application class
public:
   virtual bool OnInit();              // Called on application startup
};

bool MyApp::OnInit() {                 // Initialize the application
   MyFrame *frame =                    // Create the main application window
      new MyFrame( wxT( "Minimal wxWidgets App" ) ); 
   frame->Show(true);                  // Show it
   return true;                        // Start the event loop
}

DECLARE_APP( MyApp )                   // Implements MyApp& GetApp()

IMPLEMENT_APP( MyApp )                 // Give wxWidgets the means to create a MyApp object
