| 1 | //----------------------------------------------------------------------------- |
| 2 | // Copyright (C) 2009 Michael Gernoth <michael at gernoth.net> |
| 3 | // |
| 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 | |
| 11 | #include "proxgui.h" |
| 12 | #include "proxguiqt.h" |
| 13 | |
| 14 | static ProxGuiQT *gui = NULL; |
| 15 | |
| 16 | extern "C" void ShowGraphWindow(void) |
| 17 | { |
| 18 | if (!gui) |
| 19 | return; |
| 20 | |
| 21 | gui->ShowGraphWindow(); |
| 22 | } |
| 23 | |
| 24 | extern "C" void HideGraphWindow(void) |
| 25 | { |
| 26 | if (!gui) |
| 27 | return; |
| 28 | |
| 29 | gui->HideGraphWindow(); |
| 30 | } |
| 31 | |
| 32 | extern "C" void RepaintGraphWindow(void) |
| 33 | { |
| 34 | if (!gui) |
| 35 | return; |
| 36 | |
| 37 | gui->RepaintGraphWindow(); |
| 38 | } |
| 39 | |
| 40 | extern "C" void MainGraphics(void) |
| 41 | { |
| 42 | if (!gui) |
| 43 | return; |
| 44 | |
| 45 | gui->MainLoop(); |
| 46 | } |
| 47 | |
| 48 | extern "C" void InitGraphics(int argc, char **argv) |
| 49 | { |
| 50 | #ifdef Q_WS_X11 |
| 51 | bool useGUI = getenv("DISPLAY") != 0; |
| 52 | #else |
| 53 | bool useGUI = true; |
| 54 | #endif |
| 55 | if (!useGUI) |
| 56 | return; |
| 57 | |
| 58 | gui = new ProxGuiQT(argc, argv); |
| 59 | } |
| 60 | |
| 61 | extern "C" void ExitGraphics(void) |
| 62 | { |
| 63 | if (!gui) |
| 64 | return; |
| 65 | |
| 66 | delete gui; |
| 67 | gui = NULL; |
| 68 | } |