///////////////////////////////////////////////////////////////////////////// // Name: test.cpp // Author: XX // Created: XX/XX/XX // Copyright: ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ #pragma implementation "test.cpp" #endif // For compilers that support precompilation #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif // Include private headers #include "test.h" // WDR: class implementations //---------------------------------------------------------------------------- // MyDialog //---------------------------------------------------------------------------- // WDR: event table for MyDialog BEGIN_EVENT_TABLE(MyDialog,wxDialog) END_EVENT_TABLE() MyDialog::MyDialog( wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style ) : wxDialog( parent, id, title, position, size, style|wxRESIZE_BORDER ) { MyDialogFunc( this, TRUE ); CentreOnParent(); } bool MyDialog::Validate() { return TRUE; } bool MyDialog::TransferDataToWindow() { return TRUE; } bool MyDialog::TransferDataFromWindow() { return TRUE; } // WDR: handler implementations for MyDialog //------------------------------------------------------------------------------ // MyFrame //------------------------------------------------------------------------------ // WDR: event table for MyFrame BEGIN_EVENT_TABLE(MyFrame,wxFrame) EVT_MENU(ID_ABOUT, MyFrame::OnAbout) EVT_MENU(ID_QUIT, MyFrame::OnQuit) EVT_CLOSE(MyFrame::OnCloseWindow) EVT_MENU( ID_TEST, MyFrame::OnTest ) END_EVENT_TABLE() MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style ) : wxFrame( parent, id, title, position, size, style ) { CreateMyMenuBar(); CreateStatusBar(1); SetStatusText( _T("Welcome!") ); // insert main window here } void MyFrame::CreateMyMenuBar() { #ifdef __WXMAC__ wxApp::s_macAboutMenuItemId = ID_ABOUT; #endif SetMenuBar( MyMenuBarFunc() ); } // WDR: handler implementations for MyFrame void MyFrame::OnTest( wxCommandEvent &WXUNUSED(event) ) { MyDialog dialog( this, -1, _T("Test") ); dialog.ShowModal(); } void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) ) { wxMessageDialog dialog( this, _T("Welcome to SuperApp 1.0\n(C)opyright Joe Hacker"), _T("About SuperApp"), wxOK|wxICON_INFORMATION ); dialog.ShowModal(); } void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) ) { Close( TRUE ); } void MyFrame::OnCloseWindow( wxCloseEvent &WXUNUSED(event) ) { // if ! saved changes -> return Destroy(); } //------------------------------------------------------------------------------ // MyApp //------------------------------------------------------------------------------ IMPLEMENT_APP(MyApp) MyApp::MyApp() { } bool MyApp::OnInit() { MyFrame *frame = new MyFrame( NULL, -1, _T("SuperApp"), wxPoint(20,20), wxSize(500,340) ); frame->Show( TRUE ); return TRUE; } int MyApp::OnExit() { return 0; }