]> Shamusworld >> Repos - architektonas/blob - src/drawingview.h
Beginning to make the Layer widget functional.
[architektonas] / src / drawingview.h
1 #ifndef __DRAWINGVIEW_H__
2 #define __DRAWINGVIEW_H__
3
4 #include <QtGui>
5 #include <stdint.h>
6 #include "action.h"
7 #include "container.h"
8
9 class DrawingView: public QWidget
10 {
11         Q_OBJECT
12
13         public:
14                 DrawingView(QWidget * parent = NULL);
15
16         public:
17                 void SetRotateToolActive(bool state = true);
18                 void SetToolActive(Action * action);
19                 void SetGridSize(uint32_t);
20                 void UpdateGridBackground(void);
21
22         public slots:
23                 void AddNewObjectToDocument(Object *);
24                 void SetCurrentLayer(int);
25
26         protected:
27                 void paintEvent(QPaintEvent * event);
28                 void resizeEvent(QResizeEvent * event);
29                 void mousePressEvent(QMouseEvent * event);
30                 void mouseMoveEvent(QMouseEvent * event);
31                 void mouseReleaseEvent(QMouseEvent * event);
32                 void keyPressEvent(QKeyEvent * event);
33                 void keyReleaseEvent(QKeyEvent * event);
34
35         private:
36                 QPoint GetAdjustedMousePosition(QMouseEvent * event);
37                 QPoint GetAdjustedClientPosition(int x, int y);
38
39         public:
40                 bool useAntialiasing;
41
42         private:
43                 QPixmap gridBackground;
44                 double scale;                                                   // Window scaling factor
45                 int32_t offsetX, offsetY;                               // Window offsets
46         public:
47                 Container document;
48                 uint32_t gridPixels;                                    // Grid size in pixels
49         private:
50                 bool collided;
51 //Should this go into Object's class variables???
52 //maybe, maybe not... :-P
53                 bool rotateTool;
54                 double rx, ry;
55                 bool scrollDrag;
56                 Vector oldPoint;
57 //              bool addLineTool;
58 //              bool addCircleTool;
59 //              bool addDimensionTool;
60
61         public:
62                 Action * toolAction;
63 };
64
65 #endif  // __DRAWINGVIEW_H__