X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4cbcfb73a037462ccf4d54b3e50c58e37cc61aa9..f1d5aa4eca541a2f90044a63f555985d6bd4adf3:/samples/minimal/minimal.cpp diff --git a/samples/minimal/minimal.cpp b/samples/minimal/minimal.cpp index 394c1242b5..80bf766199 100644 --- a/samples/minimal/minimal.cpp +++ b/samples/minimal/minimal.cpp @@ -16,10 +16,10 @@ // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- - + // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" - + #ifdef __BORLANDC__ #pragma hdrstop #endif @@ -119,8 +119,13 @@ IMPLEMENT_APP(MyApp) // 'Main program' equivalent: the program execution "starts" here bool MyApp::OnInit() { + // call the base class initialization method, currently it only parses a + // few common command-line options but it could be do more in the future + if ( !wxApp::OnInit() ) + return false; + // create the main application window - MyFrame *frame = new MyFrame(_T("Minimal wxWidgets App")); + MyFrame *frame = new MyFrame("Minimal wxWidgets App"); // and show it (the frames, unlike simple controls, are not shown when // created initially) @@ -149,30 +154,23 @@ MyFrame::MyFrame(const wxString& title) // the "About" item should be in the help menu wxMenu *helpMenu = new wxMenu; - helpMenu->Append(Minimal_About, _T("&About...\tF1"), _T("Show about dialog")); + helpMenu->Append(Minimal_About, "&About...\tF1", "Show about dialog"); - fileMenu->Append(Minimal_Quit, _T("E&xit\tAlt-X"), _T("Quit this program")); + fileMenu->Append(Minimal_Quit, "E&xit\tAlt-X", "Quit this program"); // now append the freshly created menu to the menu bar... wxMenuBar *menuBar = new wxMenuBar(); - menuBar->Append(fileMenu, _T("&File")); - menuBar->Append(helpMenu, _T("&Help")); + menuBar->Append(fileMenu, "&File"); + menuBar->Append(helpMenu, "&Help"); // ... and attach this menu bar to the frame SetMenuBar(menuBar); #endif // wxUSE_MENUS - wxPanel *p = new wxPanel(this); - new wxStaticText(p, -1, _T("Foo"), wxPoint(10, 10)); - wxStaticText *text = new wxStaticText(p, -1, _T("This is a very, very, extremely and even more than you could have thought it long string"), wxPoint(10, 40)); - text->Wrap(150); - - (new wxTextCtrl(p, -1, _T("Hi"), wxPoint(10, 70)))->SetEditable(false); - #if wxUSE_STATUSBAR // create a status bar just for fun (by default with 1 pane only) CreateStatusBar(2); - SetStatusText(_T("Welcome to wxWidgets!")); + SetStatusText("Welcome to wxWidgets!"); #endif // wxUSE_STATUSBAR } @@ -187,9 +185,16 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { - wxString msg; - msg.Printf( _T("This is the About dialog of the minimal sample.\n") - _T("Welcome to %s"), wxVERSION_STRING); - - wxMessageBox(msg, _T("About Minimal"), wxOK | wxICON_INFORMATION, this); + wxMessageBox(wxString::Format + ( + "Welcome to %s!\n" + "\n" + "This is the minimal wxWidgets sample\n" + "running under %s.", + wxVERSION_STRING, + wxGetOsDescription() + ), + "About wxWidgets minimal sample", + wxOK | wxICON_INFORMATION, + this); }