1 #ifndef RS_ACTIONINTERFACE_H
2 #define RS_ACTIONINTERFACE_H
5 #include "rs_snapper.h"
10 class RS_EntityContainer;
15 * This is the interface that must be implemented for all
16 * action classes. Action classes handle actions such
17 * as drawing lines, moving entities or zooming in.
19 * Inherited from QObject for Qt translation features.
21 * @author Andrew Mustun
23 class RS_ActionInterface: public QObject, public RS_Snapper
25 //huh? no slots/signals here... Q_OBJECT
26 //WHY derive from QObject???
28 //mebbe... Well, that's what he says above. Though it would be just as easy to
29 //prefix a QObject::tr in front of translated strings...
31 RS_ActionInterface(const char * name, RS_EntityContainer & container,
32 GraphicView & graphicView);
33 virtual ~RS_ActionInterface();
35 virtual RS2::ActionType rtti();
37 virtual void init(int status = 0);
38 virtual void mouseMoveEvent(QMouseEvent *);
39 virtual void mousePressEvent(QMouseEvent *);
40 virtual void mouseReleaseEvent(QMouseEvent *);
41 virtual void keyPressEvent(QKeyEvent * e);
42 virtual void keyReleaseEvent(QKeyEvent * e);
43 virtual void coordinateEvent(Vector *);
44 virtual void commandEvent(RS_CommandEvent *);
45 virtual QStringList getAvailableCommands();
46 virtual void setStatus(int status);
47 virtual int getStatus();
48 virtual void trigger();
49 virtual void updateMouseButtonHints();
50 virtual void updateMouseCursor();
51 virtual void updateToolBar();
52 virtual bool isFinished();
53 virtual void setFinished();
54 virtual void finish();
55 virtual void setPredecessor(RS_ActionInterface * pre);
56 virtual void suspend();
57 virtual void resume();
58 virtual void hideOptions();
59 virtual void showOptions();
60 bool checkCommand(const QString & cmd, const QString & str,
61 RS2::ActionType action = RS2::ActionNone);
62 QString command(const QString & cmd);
63 QString msgAvailableCommands();
67 * Current status of the action. After an action has
68 * been created the action status is set to 0. Actions
69 * that are terminated have a status of -1. Other status
70 * numbers can be used to describe the stage this action
71 * is in. E.g. a window zoom consists of selecting the
72 * first corner (status 0), and selecting the second
78 /** Action name. Used internally for debugging */
82 * This flag is set when the action has terminated and
88 * Pointer to the graphic is this container is a graphic.
94 * Pointer to the document (graphic or block) or NULL.
96 RS_Document * document;
99 * Predecessor of this action or NULL.
101 RS_ActionInterface * predecessor;