]> Shamusworld >> Repos - architektonas/blob - src/actions/actiondrawline.h
Last checkin before major refactor...
[architektonas] / src / actions / actiondrawline.h
1 #ifndef __ACTIONDRAWLINE_H__
2 #define __ACTIONDRAWLINE_H__
3
4 #include <QtCore>
5 #include "actioninterface.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 James Hammons
13  * @author Andrew Mustun
14  */
15 class ActionDrawLine: public ActionInterface
16 {
17         public:
18                 /**
19                  * Action States.
20                  */
21                 enum Status
22                 {
23                         SetStartpoint = 0,   /**< Setting the startpoint.  */
24                         SetEndpoint          /**< Setting the endpoint. */
25                 };
26
27         public:
28                 ActionDrawLine(RS_EntityContainer & container, GraphicView & graphicView);
29                 virtual ~ActionDrawLine();
30
31                 virtual RS2::ActionType rtti();
32                 void reset();
33                 virtual void init(int status = 0);
34                 virtual void trigger();
35                 virtual void mouseMoveEvent(QMouseEvent * e);
36                 virtual void mouseReleaseEvent(QMouseEvent * e);
37                 virtual void coordinateEvent(Vector * e);
38                 virtual void commandEvent(RS_CommandEvent * e);
39                 virtual QStringList getAvailableCommands();
40                 virtual void showOptions();
41                 virtual void hideOptions();
42                 virtual void updateMouseButtonHints();
43                 virtual void updateMouseCursor();
44                 virtual void updateToolBar();
45                 void close();
46                 void undo();
47
48         private:
49                 void ClearHistory(void);
50
51         protected:
52                 /**
53                  * Line data defined so far.
54                  */
55                 RS_LineData data;
56                 /**
57                  * Start point of the series of lines. Used for close function.
58                  */
59                 Vector start;
60                 /**
61                  * Point history (for undo)
62                  */
63                 QList<Vector *> history;
64 };
65
66 #endif  // __ACTIONDRAWLINE_H__