// Adapted from an example by Dr Gee (CUED) #include #include #include #include long language = wxLANGUAGE_DEFAULT; wxLocale* locale; void initLanguageSupport() { locale = new wxLocale( language); std::cout << "default language=" << locale->GetSystemLanguage <IsAvailable(language)) { locale->AddCatalogLookupPathPrefix(_(".")); if(locale->AddCatalog(_("foo"))) std::cerr << "AddCatalog succeeded\n"; else std::cerr << "AddCatalog failed\n"; if(! locale->IsOk() ) std::cerr << "selected language is wrong" << std::endl; } else { std::cout << "The selected language is not supported by your system." << "Try installing support for this language." << std::endl; } } class MyFrame: public wxFrame { public: MyFrame(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size); private: void OnExit(wxCommandEvent& event) { Close(true); }; void OnButton1(wxCommandEvent& event) { std::cout << "Button 1 Pressed" << std::endl; }; void OnButton2(wxCommandEvent& event) { std::cout << "Button 2 Pressed" << std::endl; }; DECLARE_EVENT_TABLE() }; BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(wxID_EXIT, MyFrame::OnExit) EVT_BUTTON(1, MyFrame::OnButton1) EVT_BUTTON(2, MyFrame::OnButton2) END_EVENT_TABLE() MyFrame::MyFrame(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size): wxFrame(parent, wxID_ANY, title, pos, size) { initLanguageSupport(); wxMenu *fileMenu = new wxMenu; // The '&' in the next line underlines the succeeding character fileMenu->Append(wxID_EXIT, _("&Quit")); wxMenuBar *menuBar = new wxMenuBar; menuBar->Append(fileMenu, _("&File")); SetMenuBar(menuBar); wxBoxSizer *button_sizer = new wxBoxSizer(wxHORIZONTAL); button_sizer->Add(new wxButton(this, 1, _("button 1")), 0, wxALL, 10); button_sizer->Add(new wxButton(this, 2, _("button 2")), 0, wxALL, 10); button_sizer->Add(new wxStaticText(this, wxID_ANY, _("Some Text")), 0, wxTOP|wxLEFT|wxRIGHT, 10); SetSizer(button_sizer); } class MyApp: public wxApp { public: bool OnInit() { char **tmp1; int tmp2 = 0; glutInit(&tmp2, tmp1); MyFrame *frame = new MyFrame(NULL, _("Testing"), wxDefaultPosition, wxSize(250, 150)); frame->Show(true); return(true); // enter the GUI event loop }; }; IMPLEMENT_APP(MyApp)