]> Shamusworld >> Repos - architektonas/blob - src/base/eventhandler.h
4651a8971e947828ea8a2635baeae01bf6e4364d
[architektonas] / src / base / eventhandler.h
1 #ifndef __EVENTHANDLER_H__
2 #define __EVENTHANDLER_H__
3
4 #include <QtGui>
5 #include "enums.h"
6
7 #define RS_MAXACTIONS 16
8
9 class ActionInterface;
10 class 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 EventHandler
19 {
20         public:
21                 EventHandler(GraphicView * graphicView);
22                 ~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(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  // __EVENTHANDLER_H__