1 #ifndef DRAWING_WINDOW_H
2 #define DRAWING_WINDOW_H
7 class DrawingWindowPrivate;
9 class DrawingWindow: public QWidget {
11 typedef void (*ThreadFunction)(DrawingWindow &);
13 static const int DEFAULT_WIDTH = 640;
14 static const int DEFAULT_HEIGHT = 480;
16 DrawingWindow(ThreadFunction fun,
17 int width = DEFAULT_WIDTH, int height = DEFAULT_HEIGHT);
18 DrawingWindow(QWidget *parent,
20 int width = DEFAULT_WIDTH, int height = DEFAULT_HEIGHT);
21 DrawingWindow(QWidget *parent, Qt::WindowFlags flags,
23 int width = DEFAULT_WIDTH, int height = DEFAULT_HEIGHT);
30 void setColor(float red, float green, float blue);
31 void setBgColor(float red, float green, float blue);
35 void drawPoint(int x, int y);
36 void drawLine(int x1, int y1, int x2, int y2);
37 void drawRect(int x1, int y1, int x2, int y2);
39 bool sync(unsigned long time = ULONG_MAX);
41 void sleep(unsigned long secs);
42 void msleep(unsigned long msecs);
43 void usleep(unsigned long usecs);
46 void closeEvent(QCloseEvent *ev);
47 void customEvent(QEvent *ev);
48 void keyPressEvent(QKeyEvent *ev);
49 void paintEvent(QPaintEvent *ev);
50 void showEvent(QShowEvent *ev);
51 void timerEvent(QTimerEvent *ev);
54 DrawingWindowPrivate * const d;
56 friend class DrawingWindowPrivate;
59 #endif // !DRAWING_WINDOW_H