obs-app.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /******************************************************************************
  2. Copyright (C) 2013 by Hugh Bailey <[email protected]>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ******************************************************************************/
  14. #pragma once
  15. #include <wx/app.h>
  16. #include "obs-wrappers.hpp"
  17. class OBSAppBase : public wxApp {
  18. public:
  19. virtual ~OBSAppBase();
  20. };
  21. class OBSApp : public OBSAppBase {
  22. ConfigFile globalConfig;
  23. TextLookup textLookup;
  24. wxFrame *dummyWindow;
  25. bool InitGlobalConfig();
  26. bool InitGlobalConfigDefaults();
  27. bool InitConfigDefaults();
  28. bool InitLocale();
  29. public:
  30. virtual bool OnInit();
  31. virtual int OnExit();
  32. virtual void CleanUp();
  33. inline config_t GlobalConfig() {return globalConfig;}
  34. inline const char *GetString(const char *lookupVal)
  35. {
  36. return textLookup.GetString(lookupVal);
  37. }
  38. };
  39. wxDECLARE_APP(OBSApp);
  40. inline config_t GetGlobalConfig() {return wxGetApp().GlobalConfig();}
  41. #define Str(lookupVal) wxGetApp().GetString(lookupVal)
  42. #define WXStr(lookupVal) wxString(Str(lookupVal), wxConvUTF8)