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 // http://www.w3.org/TR/SVG/types.html#ColorKeywords
31 void setColor(float red, float green, float blue);
32 void setColor(const char *name);
33 void setBgColor(float red, float green, float blue);
34 void setBgColor(const char *name);
38 void drawPoint(int x, int y);
39 void drawLine(int x1, int y1, int x2, int y2);
40 void drawRect(int x1, int y1, int x2, int y2);
41 void fillRect(int x1, int y1, int x2, int y2);
42 void drawCircle(int x, int y, int r);
43 void fillCircle(int x, int y, int r);
45 bool sync(unsigned long time = ULONG_MAX);
47 void sleep(unsigned long secs);
48 void msleep(unsigned long msecs);
49 void usleep(unsigned long usecs);
52 void closeEvent(QCloseEvent *ev);
53 void customEvent(QEvent *ev);
54 void keyPressEvent(QKeyEvent *ev);
55 void paintEvent(QPaintEvent *ev);
56 void showEvent(QShowEvent *ev);
57 void timerEvent(QTimerEvent *ev);
60 DrawingWindowPrivate * const d;
62 friend class DrawingWindowPrivate;
65 #endif // !DRAWING_WINDOW_H