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 
62 public:
66  enum ClickMode {
80  PickingDisabled
81  };
82 
83 public:
84  RAction(RGuiAction* guiAction = NULL);
85  virtual ~RAction();
86 
87  void terminate();
88  bool isTerminated();
89 
90  void setOverride();
91  bool isOverride();
92 
93  void setNoState();
94  bool hasNoState();
95 
96  void setUniqueGroup(const QString& ug);
97  QString getUniqueGroup();
98 
99  void setOverrideBase(RAction* base);
100  RAction* getOverrideBase();
101 
102  virtual RGuiAction* getGuiAction();
103 
104  void setGuiAction(RGuiAction* guiAction);
105 
106  QList<RGraphicsScene*> getGraphicsScenes();
107  RDocument* getDocument();
108  RDocumentInterface* getDocumentInterface();
109  RStorage* getStorage();
110 
112  documentInterface = di;
113  }
114 
121  clickMode = m;
122  }
123 
129  return clickMode;
130  }
131 
135  virtual void beginEvent() = 0;
139  virtual void setGraphicsView(RGraphicsView* view) = 0;
143  virtual void finishEvent() = 0;
148  virtual void suspendEvent() = 0;
153  virtual void resumeEvent() = 0;
159  virtual void escapeEvent() = 0;
160 
161  virtual void keyPressEvent(QKeyEvent& event) = 0;
162 
163  virtual void keyReleaseEvent(QKeyEvent& event) = 0;
164 
168  virtual void mousePressEvent(RMouseEvent& event) = 0;
169 
173  virtual void mouseMoveEvent(RMouseEvent& event) = 0;
174 
178  virtual void mouseReleaseEvent(RMouseEvent& event) = 0;
179 
183  virtual void mouseDoubleClickEvent(RMouseEvent& event) = 0;
184 
188  virtual void wheelEvent(RWheelEvent& event) = 0;
189 
193  virtual void tabletEvent(RTabletEvent& event) = 0;
194 
198  virtual void swipeGestureEvent(QSwipeGesture& gesture) = 0;
199 
203  virtual void panGestureEvent(QPanGesture& gesture) = 0;
204 
208  virtual void pinchGestureEvent(QPinchGesture& gesture) = 0;
209 
213  virtual void commandEvent(RCommandEvent& event) = 0;
214 
218  virtual void commandEventPreview(RCommandEvent& event) = 0;
219 
226  virtual void coordinateEvent(RCoordinateEvent& event) = 0;
227 
233  virtual void coordinateEventPreview(RCoordinateEvent& event) = 0;
234 
238  virtual void entityPickEvent(REntityPickEvent& event) = 0;
239 
243  virtual void entityPickEventPreview(REntityPickEvent& event) = 0;
244 
248  virtual void propertyChangeEvent(RPropertyEvent& event) = 0;
249 
250  RVector snap(RMouseEvent& event);
251 
252 protected:
254  bool override;
255 
260  bool noState;
261 
262  QString uniqueGroup;
267 };
268 
270 Q_DECLARE_METATYPE(RAction::ClickMode)
271 
272 #endif