]> Shamusworld >> Repos - architektonas/blob - src/actions/rs_actiondrawline.h
Initial import
[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 //No slots/signals...   //Q_OBJECT
17
18         public:
19                 /**
20                 * Action States.
21                 */
22                 enum Status
23                 {
24                         SetStartpoint = 0,   /**< Setting the startpoint.  */
25                         SetEndpoint          /**< Setting the endpoint. */
26                 };
27
28         public:
29                 RS_ActionDrawLine(RS_EntityContainer & container, RS_GraphicView & graphicView);
30                 virtual ~RS_ActionDrawLine();
31
32                 virtual RS2::ActionType rtti();
33                 static QAction * createGUIAction(RS2::ActionType /*type*/, QObject * /*parent*/);
34                 void reset();
35
36                 virtual void init(int status = 0);
37                 virtual void trigger();
38
39                 virtual void mouseMoveEvent(QMouseEvent * e);
40                 virtual void mouseReleaseEvent(QMouseEvent * e);
41
42                 virtual void coordinateEvent(RS_CoordinateEvent * e);
43                 virtual void commandEvent(RS_CommandEvent * e);
44                 virtual QStringList getAvailableCommands();
45
46                 virtual void showOptions();
47                 virtual void hideOptions();
48
49                 virtual void updateMouseButtonHints();
50                 virtual void updateMouseCursor();
51                 virtual void updateToolBar();
52
53                 void close();
54                 void undo();
55
56         private:
57                 void ClearHistory(void);
58
59         protected:
60                 /**
61                  * Line data defined so far.
62                  */
63                 RS_LineData data;
64                 /**
65                  * Start point of the series of lines. Used for close function.
66                  */
67                 Vector start;
68                 /**
69                  * Point history (for undo)
70                  */
71 //              Q3PtrList<Vector> history;
72                 QList<Vector *> history;
73 };
74
75 #endif