]> Shamusworld >> Repos - architektonas/blob - src/drawingview.h
3531291ac5bb4b1f51d84b65068032ebd6394171
[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 #include "structs.h"
9
10 class Painter;
11
12 class DrawingView: public QWidget
13 {
14         Q_OBJECT
15
16         public:
17                 DrawingView(QWidget * parent = NULL);
18
19         public:
20 //              void SetToolActive(Action * action);
21                 void SetGridSize(uint32_t);
22                 void UpdateGridBackground(void);
23                 Point SnapPointToGrid(Point);
24                 void RenderObjects(Painter *, Container *);
25
26         public slots:
27                 void AddNewObjectToDocument(Object *);
28                 void HandleActionUpdate(void);
29                 void SetCurrentLayer(int);
30
31         protected:
32                 void paintEvent(QPaintEvent * event);
33                 void resizeEvent(QResizeEvent * event);
34                 void mousePressEvent(QMouseEvent * event);
35                 void mouseMoveEvent(QMouseEvent * event);
36                 void mouseReleaseEvent(QMouseEvent * event);
37                 void wheelEvent(QWheelEvent * event);
38                 void keyPressEvent(QKeyEvent * event);
39                 void keyReleaseEvent(QKeyEvent * event);
40
41         private:
42                 QPoint GetAdjustedMousePosition(QMouseEvent * event);
43                 QPoint GetAdjustedClientPosition(int x, int y);
44
45         public:
46                 bool useAntialiasing;
47
48         private:
49                 QPixmap gridBackground;
50                 double scale;                                                   // Window scaling factor
51                 int32_t offsetX, offsetY;                               // Window offsets
52         public:
53                 Container document;
54                 uint32_t gridPixels;                                    // Grid size in pixels
55         private:
56                 bool collided;
57                 bool scrollDrag;
58                 Vector oldPoint;
59
60         public:
61 //              Action * toolAction;
62
63 //      public:
64 //              static Container document;
65 };
66
67 #endif  // __DRAWINGVIEW_H__
68