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