1 | // Aseprite UI Library |
---|---|
2 | // Copyright (C) 2022 Igara Studio S.A. |
3 | // |
4 | // This file is released under the terms of the MIT license. |
5 | // Read LICENSE.txt for more information. |
6 | |
7 | #ifdef HAVE_CONFIG_H |
8 | #include "config.h" |
9 | #endif |
10 | |
11 | #include "ui/app_state.h" |
12 | |
13 | #include "ui/manager.h" |
14 | |
15 | namespace ui { |
16 | |
17 | AppState g_state = AppState::kNormal; |
18 | |
19 | void set_app_state(AppState state) |
20 | { |
21 | g_state = state; |
22 | |
23 | if (state == AppState::kClosingWithException) { |
24 | if (auto man = ui::Manager::getDefault()) |
25 | man->_closingAppWithException(); |
26 | } |
27 | } |
28 | |
29 | AppState get_app_state() |
30 | { |
31 | return g_state; |
32 | } |
33 | |
34 | bool is_app_state_closing() |
35 | { |
36 | return (g_state == AppState::kClosing || |
37 | g_state == AppState::kClosingWithException); |
38 | } |
39 | |
40 | } // namespace ui |
41 |