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???
29 RS_ActionInterface(const char * name, RS_EntityContainer & container,
30 RS_GraphicView & graphicView);
31 virtual ~RS_ActionInterface();
33 virtual RS2::ActionType rtti();
35 virtual void init(int status = 0);
36 virtual void mouseMoveEvent(QMouseEvent *);
37 virtual void mousePressEvent(QMouseEvent *);
38 virtual void mouseReleaseEvent(QMouseEvent *);
39 virtual void keyPressEvent(QKeyEvent * e);
40 virtual void keyReleaseEvent(QKeyEvent * e);
41 // virtual void coordinateEvent(RS_CoordinateEvent *);
42 virtual void coordinateEvent(Vector *);
43 virtual void commandEvent(RS_CommandEvent *);
44 virtual QStringList getAvailableCommands();
45 virtual void setStatus(int status);
46 virtual int getStatus();
47 virtual void trigger();
48 virtual void updateMouseButtonHints();
49 virtual void updateMouseCursor();
50 virtual void updateToolBar();
51 virtual bool isFinished();
52 virtual void setFinished();
53 virtual void finish();
54 virtual void setPredecessor(RS_ActionInterface * pre);
55 virtual void suspend();
56 virtual void resume();
57 virtual void hideOptions();
58 virtual void showOptions();
59 bool checkCommand(const QString & cmd, const QString & str,
60 RS2::ActionType action = RS2::ActionNone);
61 QString command(const QString & cmd);
62 QString msgAvailableCommands();
66 * Current status of the action. After an action has
67 * been created the action status is set to 0. Actions
68 * that are terminated have a status of -1. Other status
69 * numbers can be used to describe the stage this action
70 * is in. E.g. a window zoom consists of selecting the
71 * first corner (status 0), and selecting the second
77 /** Action name. Used internally for debugging */
81 * This flag is set when the action has terminated and
87 * Pointer to the graphic is this container is a graphic.
93 * Pointer to the document (graphic or block) or NULL.
95 RS_Document * document;
98 * Predecessor of this action or NULL.
100 RS_ActionInterface * predecessor;