diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2016-07-30 00:29:03 -0300 |
---|---|---|
committer | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2016-07-30 00:29:03 -0300 |
commit | 3a246308dcd76f70a1b6c3e6b08f0d597b255dba (patch) | |
tree | 62f42b83f39ffb0b32db5c658e0e1da428b8e6c6 /Project/main.cpp | |
parent | d1b893e6757270b0f246a7657d7b6701dcea3b87 (diff) | |
download | PSP.git-3a246308dcd76f70a1b6c3e6b08f0d597b255dba.tar.gz PSP.git-3a246308dcd76f70a1b6c3e6b08f0d597b255dba.tar.xz PSP.git-3a246308dcd76f70a1b6c3e6b08f0d597b255dba.zip |
Adding the basics graphics elements
The base is done, bus under contruction
Diffstat (limited to 'Project/main.cpp')
-rw-r--r-- | Project/main.cpp | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/Project/main.cpp b/Project/main.cpp index 5953806..106ca82 100644 --- a/Project/main.cpp +++ b/Project/main.cpp @@ -1,24 +1,49 @@ #include <wx/app.h> #include <wx/event.h> #include <wx/image.h> +#include <wx/stdpaths.h> #include "MainFrame.h" // Define the MainApp class MainApp : public wxApp { -public: + public: MainApp() {} virtual ~MainApp() {} + void LoadCatalogs(wxLocale* locale) + { + locale->Init( + locale->GetSystemLanguage(), + wxLOCALE_DONT_LOAD_DEFAULT); // captura as propriedades locais do computador (idioma, numeração, etc...) - virtual bool OnInit() { - // Add the common image handlers - wxImage::AddHandler( new wxPNGHandler ); - wxImage::AddHandler( new wxJPEGHandler ); + wxString langPath = wxStandardPaths::Get().GetExecutablePath(); + // remove o nome do executável + for(int i = langPath.size(); i >= 0; i--) { + if(langPath[i] == '/' || langPath[i] == '\\') { + langPath.Truncate(i + 1); + break; + } + } + langPath += wxT("data\\lang"); - MainFrame *mainFrame = new MainFrame(NULL); - SetTopWindow(mainFrame); - return GetTopWindow()->Show(); + locale->AddCatalogLookupPathPrefix(langPath); + // Carregar catálogos de tradução + locale->AddCatalog(wxT("pt_BR"), wxLANGUAGE_PORTUGUESE_BRAZILIAN); + } + + virtual bool OnInit() + { + // Add the common image handlers + wxImage::AddHandler(new wxPNGHandler); + wxImage::AddHandler(new wxJPEGHandler); + + wxLocale* locale = new wxLocale(); + LoadCatalogs(locale); + + MainFrame* mainFrame = new MainFrame(NULL, locale); + SetTopWindow(mainFrame); + return GetTopWindow()->Show(); } }; |