]> Shamusworld >> Repos - architektonas/blob - src/drawingview.h
21220e88a99c4479e28a525ef481638204b480fe
[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 HandleActionUpdate(void);
25                 void SetCurrentLayer(int);
26
27         protected:
28                 void paintEvent(QPaintEvent * event);
29                 void resizeEvent(QResizeEvent * event);
30                 void mousePressEvent(QMouseEvent * event);
31                 void mouseMoveEvent(QMouseEvent * event);
32                 void mouseReleaseEvent(QMouseEvent * event);
33                 void keyPressEvent(QKeyEvent * event);
34                 void keyReleaseEvent(QKeyEvent * event);
35
36         private:
37                 QPoint GetAdjustedMousePosition(QMouseEvent * event);
38                 QPoint GetAdjustedClientPosition(int x, int y);
39
40         public:
41                 bool useAntialiasing;
42
43         private:
44                 QPixmap gridBackground;
45                 double scale;                                                   // Window scaling factor
46                 int32_t offsetX, offsetY;                               // Window offsets
47         public:
48                 Container document;
49                 uint32_t gridPixels;                                    // Grid size in pixels
50         private:
51                 bool collided;
52 //Should this go into Object's class variables???
53 //maybe, maybe not... :-P
54 //              bool rotateTool;
55 //              double rx, ry;
56                 bool scrollDrag;
57                 Vector oldPoint;
58 //              bool addLineTool;
59 //              bool addCircleTool;
60 //              bool addDimensionTool;
61
62         public:
63                 Action * toolAction;
64
65 //      public:
66 //              static Container document;
67 };
68
69 #endif  // __DRAWINGVIEW_H__
70