]> Shamusworld >> Repos - architektonas/blob - src/drawingview.h
Added 'delete selected objects' functionality back.
[architektonas] / src / drawingview.h
1 #ifndef __DRAWINGVIEW_H__
2 #define __DRAWINGVIEW_H__
3
4 #include <QtWidgets>
5 #include <stdint.h>
6 #include "structs.h"
7
8 class Painter;
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                 void RenderObjects(Painter *, Container *);
23                 void DeleteSelectedItems(void);
24
25         public slots:
26                 void AddNewObjectToDocument(Object *);
27                 void HandleActionUpdate(void);
28                 void SetCurrentLayer(int);
29
30         protected:
31                 void paintEvent(QPaintEvent * event);
32                 void resizeEvent(QResizeEvent * event);
33                 void mousePressEvent(QMouseEvent * event);
34                 void mouseMoveEvent(QMouseEvent * event);
35                 void mouseReleaseEvent(QMouseEvent * event);
36                 void wheelEvent(QWheelEvent * event);
37                 void keyPressEvent(QKeyEvent * event);
38                 void keyReleaseEvent(QKeyEvent * event);
39
40         private:
41                 QPoint GetAdjustedMousePosition(QMouseEvent * event);
42                 QPoint GetAdjustedClientPosition(int x, int y);
43
44         public:
45                 bool useAntialiasing;
46                 uint32_t numSelected;
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