a553f267 |
1 | //----------------------------------------------------------------------------- |
212ef3a0 |
2 | // Copyright (C) 2009 Michael Gernoth <michael at gernoth.net> |
3 | // |
a553f267 |
4 | // This code is licensed to you under the terms of the GNU GPL, version 2 or, |
5 | // at your option, any later version. See the LICENSE.txt file for the text of |
6 | // the license. |
7 | //----------------------------------------------------------------------------- |
8 | // GUI functions |
9 | //----------------------------------------------------------------------------- |
10 | |
6658905f |
11 | #include "proxgui.h" |
12 | #include "proxguiqt.h" |
13 | |
14 | static ProxGuiQT *gui = NULL; |
15 | |
16 | extern "C" void ShowGraphWindow(void) |
17 | { |
7fe9b0b7 |
18 | if (!gui) |
19 | return; |
20 | |
21 | gui->ShowGraphWindow(); |
6658905f |
22 | } |
23 | |
24 | extern "C" void HideGraphWindow(void) |
25 | { |
7fe9b0b7 |
26 | if (!gui) |
27 | return; |
28 | |
29 | gui->HideGraphWindow(); |
6658905f |
30 | } |
31 | |
32 | extern "C" void RepaintGraphWindow(void) |
33 | { |
7fe9b0b7 |
34 | if (!gui) |
35 | return; |
6658905f |
36 | |
7fe9b0b7 |
37 | gui->RepaintGraphWindow(); |
6658905f |
38 | } |
39 | |
40 | extern "C" void MainGraphics(void) |
41 | { |
7fe9b0b7 |
42 | if (!gui) |
43 | return; |
6658905f |
44 | |
7fe9b0b7 |
45 | gui->MainLoop(); |
6658905f |
46 | } |
47 | |
48 | extern "C" void InitGraphics(int argc, char **argv) |
49 | { |
50 | #ifdef Q_WS_X11 |
7fe9b0b7 |
51 | bool useGUI = getenv("DISPLAY") != 0; |
6658905f |
52 | #else |
7fe9b0b7 |
53 | bool useGUI = true; |
6658905f |
54 | #endif |
7fe9b0b7 |
55 | if (!useGUI) |
56 | return; |
6658905f |
57 | |
7fe9b0b7 |
58 | gui = new ProxGuiQT(argc, argv); |
6658905f |
59 | } |
60 | |
61 | extern "C" void ExitGraphics(void) |
62 | { |
7fe9b0b7 |
63 | if (!gui) |
64 | return; |
65 | |
66 | delete gui; |
67 | gui = NULL; |
6658905f |
68 | } |