summaryrefslogtreecommitdiffstats
path: root/Project/main.cpp
blob: 515b43315fd93458c86927a9c3d00eeb53144adb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#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)
    {
        // Load computer settings.
        locale->Init(locale->GetSystemLanguage(), wxLOCALE_DONT_LOAD_DEFAULT);

        wxFileName fn(wxStandardPaths::Get().GetExecutablePath());
        wxString langPath = fn.GetPath() + "\\..\\data\\lang";
        locale->AddCatalogLookupPathPrefix(langPath);
        // Load translation catalogs.
        locale->AddCatalog(wxT("pt_BR"), wxLANGUAGE_PORTUGUESE_BRAZILIAN);
    }

    virtual bool OnInit()
    {
        // Add png image handler
        wxImage::AddHandler(new wxPNGHandler);

        wxLocale* locale = new wxLocale();
        LoadCatalogs(locale);

        MainFrame* mainFrame = new MainFrame(NULL, locale);
        SetTopWindow(mainFrame);
        return GetTopWindow()->Show();
    }
};

DECLARE_APP(MainApp)
IMPLEMENT_APP(MainApp)