diff --git a/TyroApp.cpp b/TyroApp.cpp index 2b03f39..1cba7c3 100644 --- a/TyroApp.cpp +++ b/TyroApp.cpp @@ -20,7 +20,13 @@ bool TyroApp::OnInit() { TyroFrame* frame = new TyroFrame(0L, _("wxWidgets Application Template")); - frame->Show(); + frame->Show(true); return true; } + +int TyroApp::OnExit(wxCommandEvent &WXUNUSED(event)) +{ + close(true); + return 1; +} diff --git a/TyroApp.h b/TyroApp.h index 08ef2c3..82d620c 100644 --- a/TyroApp.h +++ b/TyroApp.h @@ -14,8 +14,10 @@ class TyroApp : public wxApp { + friend class TyroFrame; public: virtual bool OnInit(); + virtual int OnExit(wxCommandEvent &WXUNUSED(event)); }; #endif // TYROAPP_H diff --git a/TyroMac.cbp b/TyroMac.cbp new file mode 100644 index 0000000..729976e --- /dev/null +++ b/TyroMac.cbp @@ -0,0 +1,52 @@ + + + + + + diff --git a/TyroMain.cpp b/TyroMain.cpp index 7ed1633..bc29ad4 100644 --- a/TyroMain.cpp +++ b/TyroMain.cpp @@ -43,34 +43,33 @@ wxString wxbuildinfo(wxbuildinfoformat format) BEGIN_EVENT_TABLE(TyroFrame, wxFrame) EVT_CLOSE(TyroFrame::OnClose) - EVT_MENU(idMenuQuit, TyroFrame::OnQuit) - EVT_MENU(idMenuAbout, TyroFrame::OnAbout) + EVT_MENU(wxID_EXIT, TyroFrame::OnQuit) + EVT_MENU(wxID_ABOUT, TyroFrame::OnAbout) END_EVENT_TABLE() TyroFrame::TyroFrame(wxFrame *frame, const wxString& title) : wxFrame(frame, -1, title) { -#if wxUSE_MENUS - // create a menu bar +// create a menu bar wxMenuBar* mbar = new wxMenuBar(); wxMenu* fileMenu = new wxMenu(_T("")); - fileMenu->Append(idMenuQuit, _("&Quit\tAlt-F4"), _("Quit the application")); + + fileMenu->Append(wxID_EXIT, _("&Quit\tAlt-F4"), _("Quit the application")); mbar->Append(fileMenu, _("&File")); wxMenu* helpMenu = new wxMenu(_T("")); - helpMenu->Append(idMenuAbout, _("&About\tF1"), _("Show info about this application")); + helpMenu->Append(wxID_ABOUT, _("&About\tF1"), _("Show info about this application")); mbar->Append(helpMenu, _("&Help")); - SetMenuBar(mbar); -#endif // wxUSE_MENUS +#ifdef __WXMAC__ + wxMenuBar::MacSetCommonMenuBar(mbar); +#endif // __WXMAC__ +SetMenuBar(mbar); -#if wxUSE_STATUSBAR // create a status bar with some information about the used wxWidgets version CreateStatusBar(2); - SetStatusText(_("Hello Code::Blocks user!"),0); + SetStatusText(_(""),0); SetStatusText(wxbuildinfo(short_f), 1); -#endif // wxUSE_STATUSBAR - } diff --git a/TyroMain.h b/TyroMain.h index e007bc9..1319fb5 100644 --- a/TyroMain.h +++ b/TyroMain.h @@ -14,6 +14,7 @@ #include #endif +#include #include "TyroApp.h" class TyroFrame: public wxFrame