File: application.hpp

package info (click to toggle)
ares 126-3
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 32,600 kB
  • sloc: cpp: 356,508; ansic: 20,394; makefile: 16; sh: 2
file content (70 lines) | stat: -rw-r--r-- 2,286 bytes parent folder | download | duplicates (2)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#if defined(Hiro_Application)
struct Application {
  Application() = delete;

  static auto abort() -> void;
  static auto doMain() -> void;
  static auto doOpenFile(const string& path) -> void;
  static auto exit() -> void;
  static auto font() -> Font;
  static auto locale() -> Locale&;
  static auto modal() -> bool;
  static auto name() -> string;
  static auto onMain(const function<void ()>& callback = {}) -> void;
  static auto onOpenFile(const function<void (const string& path)>& callback = {}) -> void;
  static auto run() -> void;
  static auto scale() -> f32;
  static auto scale(f32 value) -> f32;
  static auto pendingEvents() -> bool;
  static auto processEvents() -> void;
  static auto quit() -> void;
  static auto screenSaver() -> bool;
  static auto setFont(const Font& font = {}) -> void;
  static auto setName(const string& name = "") -> void;
  static auto setScale(f32 scale = 1.0) -> void;
  static auto setScreenSaver(bool screenSaver = true) -> void;
  static auto setToolTips(bool toolTips = true) -> void;
  static auto toolTips() -> bool;
  static auto unscale(f32 value) -> f32;

  struct Cocoa {
    static auto doAbout() -> void;
    static auto doActivate() -> void;
    static auto doPreferences() -> void;
    static auto doQuit() -> void;
    static auto onAbout(const function<void ()>& callback = {}) -> void;
    static auto onActivate(const function<void ()>& callback = {}) -> void;
    static auto onPreferences(const function<void ()>& callback = {}) -> void;
    static auto onQuit(const function<void ()>& callback = {}) -> void;
  };

  struct Namespace : Locale::Namespace {
    Namespace(const string& value) : Locale::Namespace(Application::locale(), value) {}
  };

//private:
  struct State {
    Font font;
    bool initialized = false;
    Locale locale;
    s32 modal = 0;
    string name;
    function<void ()> onMain;
    function<void (const string& path)> onOpenFile;
    bool quit = false;
    f32 scale = 1.0;
    bool screenSaver = true;
    bool toolTips = true;

    struct Cocoa {
      function<void ()> onAbout;
      function<void ()> onActivate;
      function<void ()> onPreferences;
      function<void ()> onQuit;
    } cocoa;
  };

  static auto initialize() -> void;
  static auto state() -> State&;
};
#endif