Qt frontend build: fix use of XFLAGS
[sgt-puzzles/ydirson.git] / qt.h
blob77dff7602c8b85f2926d9c7ca48672006c4e04ab
1 #include <QtCore/QObject>
2 #include <QtGui/QMainWindow>
4 extern "C" {
5 #include "puzzles.h"
8 class Canvas;
9 class Timer;
11 struct frontend {
12 QMainWindow *window;
13 Canvas *area;
14 QPixmap *pixmap;
15 QPainter *painter;
16 int w, h;
17 midend *me;
18 QColor *colours;
19 int ncolours;
20 int bbox_l, bbox_r, bbox_u, bbox_d;
21 Timer *timer;
22 int pw, ph; /* pixmap size (w, h are area size) */
23 int ox, oy; /* offset of pixmap in drawing area */
26 class Canvas: public QWidget
28 Q_OBJECT;
29 frontend* fe;
30 public:
31 Canvas(frontend* fe);
32 virtual QSize sizeHint() const;
33 void do_resize(const QSize & size);
34 protected:
35 void paintEvent (QPaintEvent *event);
36 void resizeEvent (QResizeEvent *event);
37 void mousePressEvent (QMouseEvent *event);
38 void mouseReleaseEvent (QMouseEvent *event);
39 void mouseMoveEvent (QMouseEvent *event);
42 class PuzzleWindow: public QMainWindow {
43 Q_OBJECT;
44 frontend *fe;
45 public:
46 PuzzleWindow(QWidget *parent=0, Qt::WFlags fl=0);
47 public slots:
48 void newGame();
49 void restart();
50 void undo();
51 void redo();
52 void solve();
53 void about();
54 void preset(QObject*);
57 // Simple QObject wrapper around game_params
58 class GameParams: public QObject {
59 Q_OBJECT;
60 public:
61 GameParams(game_params *params)
62 : params(params) {};
63 game_params *params;