diff options
author | Thales1330 <thaleslima.ufu@gmail.com> | 2016-08-19 09:20:19 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-19 09:20:19 -0300 |
commit | ae95a3dbc230e2fc1e2e02e0ee920dc908f3ef2f (patch) | |
tree | e05100d4711e4050985e3d550bf9053a3c22942f /Project/main.cpp | |
parent | b23b552bac7a5c5a5e934ab3181180877bf93a72 (diff) | |
parent | 05525745c0b0d189484da3c45f95356d7558e2cf (diff) | |
download | PSP.git-ae95a3dbc230e2fc1e2e02e0ee920dc908f3ef2f.tar.gz PSP.git-ae95a3dbc230e2fc1e2e02e0ee920dc908f3ef2f.tar.xz PSP.git-ae95a3dbc230e2fc1e2e02e0ee920dc908f3ef2f.zip |
Merge pull request #1 from Thales1330/wip/svnprob
Wip/svnprob
Diffstat (limited to 'Project/main.cpp')
-rw-r--r-- | Project/main.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/Project/main.cpp b/Project/main.cpp new file mode 100644 index 0000000..106ca82 --- /dev/null +++ b/Project/main.cpp @@ -0,0 +1,51 @@ +#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: + 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...) + + 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"); + + 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(); + } +}; + +DECLARE_APP(MainApp) +IMPLEMENT_APP(MainApp) |