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