]> Shamusworld >> Repos - architektonas/blob - src/actions/rs_actiondrawline.h
Refactoring: Moved RS_GraphicView to GraphicView.
[architektonas] / src / actions / rs_actiondrawline.h
1 #ifndef RS_ACTIONDRAWLINE_H
2 #define RS_ACTIONDRAWLINE_H
3
4 #include <QtCore>
5 #include "rs_previewactioninterface.h"
6 #include "rs_line.h"
7
8 /**
9  * This action class can handle user events to draw
10  * simple lines with the start- and endpoint given.
11  *
12  * @author Andrew Mustun
13  */
14 class RS_ActionDrawLine: public RS_PreviewActionInterface
15 {
16         public:
17                 /**
18                  * Action States.
19                  */
20                 enum Status
21                 {
22                         SetStartpoint = 0,   /**< Setting the startpoint.  */
23                         SetEndpoint          /**< Setting the endpoint. */
24                 };
25
26         public:
27                 RS_ActionDrawLine(RS_EntityContainer & container, GraphicView & graphicView);
28                 virtual ~RS_ActionDrawLine();
29
30                 virtual RS2::ActionType rtti();
31                 void reset();
32                 virtual void init(int status = 0);
33                 virtual void trigger();
34                 virtual void mouseMoveEvent(QMouseEvent * e);
35                 virtual void mouseReleaseEvent(QMouseEvent * e);
36                 virtual void coordinateEvent(Vector * e);
37                 virtual void commandEvent(RS_CommandEvent * e);
38                 virtual QStringList getAvailableCommands();
39                 virtual void showOptions();
40                 virtual void hideOptions();
41                 virtual void updateMouseButtonHints();
42                 virtual void updateMouseCursor();
43                 virtual void updateToolBar();
44                 void close();
45                 void undo();
46
47         private:
48                 void ClearHistory(void);
49
50         protected:
51                 /**
52                  * Line data defined so far.
53                  */
54                 RS_LineData data;
55                 /**
56                  * Start point of the series of lines. Used for close function.
57                  */
58                 Vector start;
59                 /**
60                  * Point history (for undo)
61                  */
62                 QList<Vector *> history;
63 };
64
65 #endif