1 #ifndef __ACTIONINTERFACE_H__
2 #define __ACTIONINTERFACE_H__
11 class EntityContainer;
16 * This is the interface that must be implemented for all action classes.
17 * Action classes handle actions such as drawing lines, moving entities or
20 * Inherited from QObject for Qt translation features.
22 * @author James Hammons
23 * @author Andrew Mustun
25 class ActionInterface: public QObject
27 //WHY derive from QObject??? for the TR macro???
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 ActionInterface(const char * name, EntityContainer &,
33 virtual ~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(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(ActionInterface *);
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();
64 //built-in for now, we'll see how it goes...
65 Vector snapPoint(QMouseEvent *);
66 Entity * catchEntity(QMouseEvent *, RS2::ResolveLevel level = RS2::ResolveNone);
67 Entity * catchEntity(Vector, RS2::ResolveLevel level = RS2::ResolveNone);
68 #warning "!!! The following functions are DEPRECATED and only in place to help with porting.. !!!"
69 void drawSnapper(void);
70 void deleteSnapper(void);
71 void drawPreview(void);
72 void clearPreview(void);
73 void deletePreview(void);
77 * Current status of the action. After an action has been created the
78 * action status is set to 0. Actions that are terminated have a status
79 * of -1. Other status numbers can be used to describe the stage this
80 * action is in. E.g. a window zoom consists of selecting the first
81 * corner (status 0), and selecting the second corner (status 1).
84 bool snapperVisibility;
85 bool previewVisibility;
89 /** Action name. Used internally for debugging */
92 * This flag is set when the action has terminated and can be deleted.
96 * Pointer to the graphic is this container is a graphic. NULL otherwise
100 * Pointer to the document (graphic or block) or NULL.
104 * Predecessor of this action or NULL.
106 ActionInterface * predecessor;
108 GraphicView * graphicView;
109 EntityContainer * container;
112 #endif // __ACTIONINTERFACE_H__