]> Shamusworld >> Repos - architektonas/blob - src/drawingview.h
Converted codebase from Qt4 to Qt5.
[architektonas] / src / drawingview.h
1 #ifndef __DRAWINGVIEW_H__
2 #define __DRAWINGVIEW_H__
3
4 #include <QtWidgets>
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 wheelEvent(QWheelEvent * event);
34                 void keyPressEvent(QKeyEvent * event);
35                 void keyReleaseEvent(QKeyEvent * event);
36
37         private:
38                 QPoint GetAdjustedMousePosition(QMouseEvent * event);
39                 QPoint GetAdjustedClientPosition(int x, int y);
40
41         public:
42                 bool useAntialiasing;
43
44         private:
45                 QPixmap gridBackground;
46                 double scale;                                                   // Window scaling factor
47                 int32_t offsetX, offsetY;                               // Window offsets
48         public:
49                 Container document;
50                 uint32_t gridPixels;                                    // Grid size in pixels
51         private:
52                 bool collided;
53 //Should this go into Object's class variables???
54 //maybe, maybe not... :-P
55 //              bool rotateTool;
56 //              double rx, ry;
57                 bool scrollDrag;
58                 Vector oldPoint;
59 //              bool addLineTool;
60 //              bool addCircleTool;
61 //              bool addDimensionTool;
62
63         public:
64                 Action * toolAction;
65
66 //      public:
67 //              static Container document;
68 };
69
70 #endif  // __DRAWINGVIEW_H__
71