| 1 |
greg |
1.1 |
|
| 2 |
|
|
#ifndef __RvuWidget_H |
| 3 |
|
|
#define __RvuWidget_H |
| 4 |
|
|
|
| 5 |
|
|
#include <QtGui/QWidget> |
| 6 |
|
|
|
| 7 |
|
|
class QPixmap; |
| 8 |
|
|
class QColor; |
| 9 |
|
|
class QMouseEvent; |
| 10 |
|
|
class QPainter; |
| 11 |
|
|
|
| 12 |
|
|
class RvuWidget : public QWidget |
| 13 |
|
|
{ |
| 14 |
|
|
Q_OBJECT |
| 15 |
|
|
|
| 16 |
|
|
public: |
| 17 |
|
|
RvuWidget(QWidget* parent = 0); |
| 18 |
|
|
~RvuWidget(); |
| 19 |
|
|
|
| 20 |
|
|
/** Draw a rectangle to the widget (stored in a QImage). */ |
| 21 |
|
|
void drawRect(int x, int y, int width, int height, const QColor &color); |
| 22 |
|
|
|
| 23 |
|
|
/** Resize the stored QImage to the supplied width and height. */ |
| 24 |
|
|
void resizeImage(int width, int height); |
| 25 |
|
|
|
| 26 |
|
|
void getPosition(int *x, int *y); |
| 27 |
|
|
|
| 28 |
|
|
void setPosition(int x, int y); |
| 29 |
|
|
protected: |
| 30 |
|
|
/** Simple draws the QImage and the crosshairs. */ |
| 31 |
|
|
void paintEvent(QPaintEvent *event); |
| 32 |
|
|
|
| 33 |
|
|
/** Receive mouse events, move the crosshairs on left clicks. */ |
| 34 |
|
|
void mousePressEvent(QMouseEvent *event); |
| 35 |
|
|
|
| 36 |
|
|
/** The QImage that the ray tracing code paints to. */ |
| 37 |
|
|
QPixmap *m_image; |
| 38 |
|
|
QPainter *m_painter; |
| 39 |
|
|
|
| 40 |
|
|
/** X and Y position of the crosshairs. */ |
| 41 |
|
|
int m_x; |
| 42 |
|
|
int m_y; |
| 43 |
|
|
bool m_do_pick; |
| 44 |
|
|
}; |
| 45 |
|
|
|
| 46 |
|
|
#endif |