-
Notifications
You must be signed in to change notification settings - Fork 17
/
GroWidget.h
78 lines (61 loc) · 2.31 KB
/
GroWidget.h
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
71
72
73
74
75
76
77
78
/////////////////////////////////////////////////////////////////////////////////////////
//
// gro is protected by the UW OPEN SOURCE LICENSE, which is summarized here.
// Please see the file LICENSE.txt for the complete license.
//
// THE SOFTWARE (AS DEFINED BELOW) AND HARDWARE DESIGNS (AS DEFINED BELOW) IS PROVIDED
// UNDER THE TERMS OF THIS OPEN SOURCE LICENSE (“LICENSE”). THE SOFTWARE IS PROTECTED
// BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THIS SOFTWARE OTHER THAN AS
// AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
//
// BY EXERCISING ANY RIGHTS TO THE SOFTWARE AND/OR HARDWARE PROVIDED HERE, YOU ACCEPT AND
// AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE
// CONSIDERED A CONTRACT, THE UNIVERSITY OF WASHINGTON (“UW”) GRANTS YOU THE RIGHTS
// CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
//
// TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
//
//
#ifndef GROWIDGET_H
#define GROWIDGET_H
#include <QPixmap>
#include <QWidget>
#include "GroThread.h"
class GroWidget : public QWidget
{
Q_OBJECT
public:
explicit GroWidget(int ac, char ** av, QWidget *parent = 0);
~GroWidget();
void startStop(void);
void step(void) { grothread.step(); }
void open ( QString path );
void showCenteredMessage ( QString msg );
void snapshot ( QString path );
void moreCells ( void );
void zoom ( float z ) { grothread.set_zoom ( z ); }
QSize sizeHint ( void ) { return QSize(800,800); }
QSize minimumSizeHint ( void ) { return QSize(100,100); }
GroThread::STATE getThreadState ( void ) { return grothread.get_state(); }
void dump ( QString filename );
signals:
void messageFromGro ( QString msg, bool clear = false );
private slots:
void updatePixmap(const QImage &image);
void handleStateChange ( void );
void passMessage(std::string msg, bool clear = false);
protected:
void paintEvent(QPaintEvent *);
void resizeEvent(QResizeEvent * );
void mousePressEvent(QMouseEvent *);
void mouseReleaseEvent(QMouseEvent *);
void mouseMoveEvent(QMouseEvent *);
private:
GroThread grothread;
QPixmap pixmap;
QString status_string;
QPoint down, up, current;
bool is_down, error_flag;
QImage error_image;
};
#endif // GROWIDGET_H