| 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 (QT) |
| 9 | //----------------------------------------------------------------------------- |
| 10 | |
| 11 | #include <QApplication> |
| 12 | #include <QPushButton> |
| 13 | #include <QObject> |
| 14 | #include <QWidget> |
| 15 | #include <QPainter> |
| 16 | |
| 17 | class ProxWidget : public QWidget |
| 18 | { |
| 19 | Q_OBJECT; |
| 20 | |
| 21 | private: |
| 22 | int GraphStart; |
| 23 | double GraphPixelsPerPoint; |
| 24 | int CursorAPos; |
| 25 | int CursorBPos; |
| 26 | |
| 27 | public: |
| 28 | ProxWidget(QWidget *parent = 0); |
| 29 | |
| 30 | protected: |
| 31 | void paintEvent(QPaintEvent *event); |
| 32 | void closeEvent(QCloseEvent *event); |
| 33 | void mouseMoveEvent(QMouseEvent *event); |
| 34 | void mousePressEvent(QMouseEvent *event) { mouseMoveEvent(event); } |
| 35 | void keyPressEvent(QKeyEvent *event); |
| 36 | }; |
| 37 | |
| 38 | class ProxGuiQT : public QObject |
| 39 | { |
| 40 | Q_OBJECT; |
| 41 | |
| 42 | private: |
| 43 | QApplication *plotapp; |
| 44 | ProxWidget *plotwidget; |
| 45 | int argc; |
| 46 | char **argv; |
| 47 | void (*main_func)(void); |
| 48 | |
| 49 | public: |
| 50 | ProxGuiQT(int argc, char **argv); |
| 51 | ~ProxGuiQT(void); |
| 52 | void ShowGraphWindow(void); |
| 53 | void RepaintGraphWindow(void); |
| 54 | void HideGraphWindow(void); |
| 55 | void MainLoop(void); |
| 56 | |
| 57 | private slots: |
| 58 | void _ShowGraphWindow(void); |
| 59 | void _RepaintGraphWindow(void); |
| 60 | void _HideGraphWindow(void); |
| 61 | |
| 62 | signals: |
| 63 | void ShowGraphWindowSignal(void); |
| 64 | void RepaintGraphWindowSignal(void); |
| 65 | void HideGraphWindowSignal(void); |
| 66 | }; |