X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/66de8e7a1be8a943d82838094acec88a34534566..5c5ab9ebc3a7dd441c9e3b25cb3daf8f733c374f:/samples/minimal/minimal.cpp diff --git a/samples/minimal/minimal.cpp b/samples/minimal/minimal.cpp index a7778131b8..84a4ff0a09 100644 --- a/samples/minimal/minimal.cpp +++ b/samples/minimal/minimal.cpp @@ -5,8 +5,8 @@ // Modified by: // Created: 04/01/98 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Copyright: (c) Julian Smart +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -38,7 +38,7 @@ // ressources // ---------------------------------------------------------------------------- // the application icon -#ifdef __WXGTK__ +#if defined(__WXGTK__) || defined(__WXMOTIF__) #include "mondrian.xpm" #endif @@ -84,12 +84,7 @@ enum { // menu items Minimal_Quit = 1, - Minimal_About, - Minimal_Test1, - Minimal_Test2, - - // controls start here (the numbers are, of course, arbitrary) - Minimal_Text = 1000, + Minimal_About }; // ---------------------------------------------------------------------------- @@ -145,26 +140,42 @@ bool MyApp::OnInit() MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) : wxFrame((wxFrame *)NULL, -1, title, pos, size) { +#ifdef __WXMAC__ + // we need this in order to allow the about menu relocation, since ABOUT is not the default id of the about menu + wxApp::s_macAboutMenuItemId = Minimal_About ; +#endif + // set the frame icon SetIcon(wxICON(mondrian)); // create a menu bar - wxMenu *menuFile = new wxMenu; - - menuFile->Append(Minimal_About, "&About..."); + wxMenu *menuFile = new wxMenu("", wxMENU_TEAROFF); + +#ifdef __WXMAC__ + // since the about should be in the help menu for auto-relocation we have to do a little more... + wxMenu *helpMenu = new wxMenu("", wxMENU_TEAROFF); + helpMenu->Append(Minimal_About, "&About...\tCntrl+A", "Show about dialog"); +#else + menuFile->Append(Minimal_About, "&About...\tCtrl-A", "Show about dialog"); menuFile->AppendSeparator(); - menuFile->Append(Minimal_Quit, "E&xit"); +#endif + menuFile->Append(Minimal_Quit, "E&xit\tAlt-X", "Quit this program"); // now append the freshly created menu to the menu bar... - wxMenuBar *menuBar = new wxMenuBar; + wxMenuBar *menuBar = new wxMenuBar(); menuBar->Append(menuFile, "&File"); +#ifdef __WXMAC__ + menuBar->Append(helpMenu, "&Help"); +#endif // ... and attach this menu bar to the frame SetMenuBar(menuBar); +#if wxUSE_STATUSBAR // create a status bar just for fun (by default with 1 pane only) CreateStatusBar(2); SetStatusText("Welcome to wxWindows!"); +#endif // wxUSE_STATUSBAR } @@ -178,6 +189,17 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { - wxMessageBox("This is a minimal sample\nA second line in the message box", - "About Minimal", wxOK | wxICON_INFORMATION, this); + wxString msg; + msg.Printf( _T("This is the about dialog of minimal sample.\n") + _T("Welcome to %s") +#ifdef wxBETA_NUMBER + _T(" (beta %d)!") +#endif // wxBETA_NUMBER + , wxVERSION_STRING +#ifdef wxBETA_NUMBER + , wxBETA_NUMBER +#endif // wxBETA_NUMBER + ); + + wxMessageBox(msg, "About Minimal", wxOK | wxICON_INFORMATION, this); }