QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RAction.h
Go to the documentation of this file.
1 
20 #ifndef RACTION_H
21 #define RACTION_H
22 
23 #include "core_global.h"
24 
25 #include <QKeyEvent>
26 #include <QList>
27 #include <QMap>
28 #include <QObject>
29 #include <QString>
30 #include <QSwipeGesture>
31 #include <QPanGesture>
32 #include <QPinchGesture>
33 
34 #include "RDebug.h"
35 #include "REntity.h"
36 #include "RVector.h"
37 
38 class RPropertyEvent;
39 class RGraphicsScene;
40 class RGraphicsView;
41 class RDocumentInterface;
42 class RCommandEvent;
43 class RCoordinateEvent;
44 class RDocument;
45 class REntityPickEvent;
46 class RMouseEvent;
47 class RWheelEvent;
48 class RGuiAction;
49 class RStorage;
50 class RTabletEvent;
51 class ROperation;
52 
63 public:
67  enum ClickMode {
81  PickingDisabled
82  };
83 
84 public:
85  RAction(RGuiAction* guiAction = NULL);
86  virtual ~RAction();
87 
88  void terminate();
89  bool isTerminated();
90 
91  void setOverride();
92  bool isOverride();
93 
94  void setNoState();
95  bool hasNoState();
96 
97  void setUniqueGroup(const QString& ug);
98  QString getUniqueGroup();
99 
100  void setOverrideBase(RAction* base);
101  RAction* getOverrideBase();
102 
103  virtual RGuiAction* getGuiAction();
104 
105  void setGuiAction(RGuiAction* guiAction);
106 
107  QList<RGraphicsScene*> getGraphicsScenes();
108  RDocument* getDocument();
109  RDocumentInterface* getDocumentInterface();
110  RStorage* getStorage();
111 
113  documentInterface = di;
114  }
115 
122  clickMode = m;
123  }
124 
130  return clickMode;
131  }
132 
136  virtual void beginEvent() = 0;
140  virtual void setGraphicsView(RGraphicsView* view) = 0;
144  virtual void finishEvent() = 0;
149  virtual void suspendEvent() = 0;
154  virtual void resumeEvent() = 0;
160  virtual void escapeEvent() = 0;
161 
162  virtual void keyPressEvent(QKeyEvent& event) = 0;
163 
164  virtual void keyReleaseEvent(QKeyEvent& event) = 0;
165 
169  virtual void mousePressEvent(RMouseEvent& event) = 0;
170 
174  virtual void mouseMoveEvent(RMouseEvent& event) = 0;
175 
179  virtual void mouseReleaseEvent(RMouseEvent& event) = 0;
180 
184  virtual void mouseDoubleClickEvent(RMouseEvent& event) = 0;
185 
189  virtual void wheelEvent(RWheelEvent& event) = 0;
190 
194  virtual void tabletEvent(RTabletEvent& event) = 0;
195 
199  virtual void swipeGestureEvent(QSwipeGesture& gesture) = 0;
200 
204  virtual void panGestureEvent(QPanGesture& gesture) = 0;
205 
209  virtual void pinchGestureEvent(QPinchGesture& gesture) = 0;
210 
214  virtual void commandEvent(RCommandEvent& event) = 0;
215 
219  virtual void commandEventPreview(RCommandEvent& event) = 0;
220 
227  virtual void coordinateEvent(RCoordinateEvent& event) = 0;
228 
234  virtual void coordinateEventPreview(RCoordinateEvent& event) = 0;
235 
239  virtual void entityPickEvent(REntityPickEvent& event) = 0;
240 
244  virtual void entityPickEventPreview(REntityPickEvent& event) = 0;
245 
249  virtual void propertyChangeEvent(RPropertyEvent& event) = 0;
250 
251  //virtual void setMultiSnapPoints(const QList<RVector>& points) = 0;
252  //virtual void setMultiSnapAngles(const QList<double>& angles) = 0;
253 
254  virtual void updatePreview() = 0;
255  virtual void applyOperation() = 0;
256 
257  RVector snap(RMouseEvent& event);
258 
259 protected:
261  bool override;
262 
267  bool noState;
268 
269  QString uniqueGroup;
274 };
275 
277 Q_DECLARE_METATYPE(RAction::ClickMode)
278 
279 #endif