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