]> Shamusworld >> Repos - architektonas/blob - src/base/rs_eventhandler.h
In the middle of major refactoring...
[architektonas] / src / base / rs_eventhandler.h
1 #ifndef RS_EVENTHANDLER_H
2 #define RS_EVENTHANDLER_H
3
4 #include <QtGui>
5 #include "rs.h"
6
7 #define RS_MAXACTIONS 16
8
9 class ActionInterface;
10 class RS_CommandEvent;
11 class GraphicView;
12
13 /**
14  * The event handler owns and manages all actions that are currently
15  * active. All events going from the view to the actions come over
16  * this class.
17  */
18 class RS_EventHandler
19 {
20         public:
21                 RS_EventHandler(GraphicView * graphicView);
22                 ~RS_EventHandler();
23
24                 void back();
25                 void enter();
26                 void mousePressEvent(QMouseEvent * e);
27                 void mouseReleaseEvent(QMouseEvent * e);
28                 void mouseMoveEvent(QMouseEvent * e);
29                 void mouseLeaveEvent();
30                 void mouseEnterEvent();
31                 void keyPressEvent(QKeyEvent * e);
32                 void keyReleaseEvent(QKeyEvent * e);
33                 void commandEvent(RS_CommandEvent * e);
34                 void enableCoordinateInput();
35                 void disableCoordinateInput();
36                 void setDefaultAction(ActionInterface * action);
37                 ActionInterface * getDefaultAction();
38                 void setCurrentAction(ActionInterface * action);
39                 ActionInterface * getCurrentAction();
40                 void killSelectActions();
41                 void killAllActions();
42                 bool hasAction();
43                 void cleanUp();
44                 void debugActions();
45                 void setSnapMode(RS2::SnapMode sm);
46                 void setSnapRestriction(RS2::SnapRestriction sr);
47
48         protected:
49                 GraphicView * graphicView;
50                 ActionInterface * defaultAction;
51                 ActionInterface * currentActions[RS_MAXACTIONS];
52                 int actionIndex;
53                 bool coordinateInputEnabled;
54 };
55
56 #endif