]> Shamusworld >> Repos - architektonas/blob - src/actions/rs_actiondrawlinerectangle.h
Refactoring: Moved RS_GraphicView to GraphicView.
[architektonas] / src / actions / rs_actiondrawlinerectangle.h
1 #ifndef RS_ACTIONDRAWLINERECTANGLE_H
2 #define RS_ACTIONDRAWLINERECTANGLE_H
3
4 #include "rs_line.h"
5 #include "rs_previewactioninterface.h"
6 #include "vector.h"
7
8 /**
9  * This action class can handle user events to draw
10  * rectangles with two corners given.
11  *
12  * @author Andrew Mustun
13  */
14 class RS_ActionDrawLineRectangle: public RS_PreviewActionInterface
15 {
16         public:
17                 /**
18                  * Action States.
19                  */
20                 enum Status {
21                         SetCorner1,      /**< Setting the 1st corner.  */
22                         SetCorner2       /**< Setting the 2nd corner. */
23                 };
24
25         public:
26                 RS_ActionDrawLineRectangle(RS_EntityContainer & container, GraphicView & graphicView);
27                 ~RS_ActionDrawLineRectangle();
28
29                 void reset();
30                 virtual void init(int status = 0);
31                 virtual void trigger();
32                 virtual void mouseMoveEvent(QMouseEvent * e);
33                 virtual void mouseReleaseEvent(QMouseEvent * e);
34                 void preparePreview();
35                 virtual void coordinateEvent(Vector * e);
36                 virtual void commandEvent(RS_CommandEvent * e);
37                 virtual QStringList getAvailableCommands();
38                 virtual void updateMouseButtonHints();
39                 virtual void updateMouseCursor();
40                 virtual void updateToolBar();
41
42         protected:
43                 /**
44                  * Line data for the 4 lines.
45                  */
46                 RS_LineData data[4];
47                 /**
48                  * 1st corner.
49                  */
50                 Vector corner1;
51                 /**
52                  * 2nd corner.
53                  */
54                 Vector corner2;
55 };
56
57 #endif