QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
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 <QList>
26#include <QMetaType>
27#include <QString>
28
29class RPropertyEvent;
30class RGraphicsScene;
31class RGraphicsView;
33class RCommandEvent;
35class RDocument;
37class RMouseEvent;
38class RWheelEvent;
39class RGuiAction;
40class RStorage;
41class RTabletEvent;
42class RVector;
43class QKeyEvent;
44class QSwipeGesture;
45class QPanGesture;
46class QPinchGesture;
47
58public:
79
80public:
81 RAction(RGuiAction* guiAction = NULL);
82 virtual ~RAction();
83
84 void terminate();
85 bool isTerminated();
86
87 void setOverride();
88 bool isOverride();
89
90 void setNoState(bool on = true);
91 bool hasNoState();
92
93 void setUniqueGroup(const QString& ug);
94 QString getUniqueGroup();
95
96 void setOverrideBase(RAction* base);
97 RAction* getOverrideBase();
98
99 virtual RGuiAction* getGuiAction();
100
101 void setGuiAction(RGuiAction* guiAction);
102
103 QList<RGraphicsScene*> getGraphicsScenes();
104 virtual RDocument* getDocument();
106 RStorage* getStorage();
107
109 documentInterface = di;
110 }
111
112 void setClickMode(RAction::ClickMode m);
113
119 return clickMode;
120 }
121
125 virtual void beginEvent() = 0;
129 virtual void setGraphicsView(RGraphicsView* view) = 0;
133 virtual void finishEvent() = 0;
137 virtual void enterEvent() = 0;
142 virtual void suspendEvent() = 0;
147 virtual void resumeEvent() = 0;
153 virtual void escapeEvent() = 0;
154
155 virtual void keyPressEvent(QKeyEvent& event) = 0;
156
157 virtual void keyReleaseEvent(QKeyEvent& event) = 0;
158
162 virtual void mousePressEvent(RMouseEvent& event) = 0;
163
167 virtual void mouseMoveEvent(RMouseEvent& event) = 0;
168
172 virtual void mouseReleaseEvent(RMouseEvent& event) = 0;
173
177 virtual void mouseDoubleClickEvent(RMouseEvent& event) = 0;
178
182 virtual void wheelEvent(RWheelEvent& event) = 0;
183
187 virtual void tabletEvent(RTabletEvent& event) = 0;
188
192 virtual void swipeGestureEvent(QSwipeGesture& gesture) = 0;
193
197 virtual void panGestureEvent(QPanGesture& gesture) = 0;
198
202 virtual void pinchGestureEvent(QPinchGesture& gesture) = 0;
203
207 virtual void commandEvent(RCommandEvent& event) = 0;
208
212 virtual void commandEventPreview(RCommandEvent& event) = 0;
213
220 virtual void coordinateEvent(RCoordinateEvent& event) = 0;
221
227 virtual void coordinateEventPreview(RCoordinateEvent& event) = 0;
228
229 virtual void entityPickEvent(REntityPickEvent& event) = 0;
230
231 virtual void entityPickEventPreview(REntityPickEvent& event) = 0;
232
236 virtual void propertyChangeEvent(RPropertyEvent& event) = 0;
237
241 virtual void zoomChangeEvent(RGraphicsView& view) = 0;
242
243 //virtual void setMultiSnapPoints(const QList<RVector>& points) = 0;
244 //virtual void setMultiSnapAngles(const QList<double>& angles) = 0;
245
246 virtual void updatePreview() = 0;
247 virtual void applyOperation() = 0;
248
249 virtual RVector snap(RMouseEvent& event, bool preview = false);
250
251protected:
253 bool override;
254
260
261 QString uniqueGroup;
266};
267
270
271#endif
Q_DECLARE_METATYPE(RMath *)
Abstract base class for all action classes.
Definition RAction.h:57
bool noState
Indicates whether this action is stateless (i.e.
Definition RAction.h:259
virtual void finishEvent()=0
Called just before the action is deleted.
virtual void keyPressEvent(QKeyEvent &event)=0
virtual void zoomChangeEvent(RGraphicsView &view)=0
Called when the zoom factor or offset changed in the given view.
virtual void commandEventPreview(RCommandEvent &event)=0
Called when a command is being edited in the command line.
virtual void mouseMoveEvent(RMouseEvent &event)=0
Called on mouse move events.
virtual void pinchGestureEvent(QPinchGesture &gesture)=0
Called on pinch gesture events.
virtual void applyOperation()=0
ClickMode
Current mouse click mode.
Definition RAction.h:62
@ PickCoordinate
Mouse click will pick a coordinate and trigger coordinateEvent.
Definition RAction.h:67
@ PickEntity
Mouse click will pick an entity and trigger entityPickEvent.
Definition RAction.h:72
@ PickCoordinateNoSnap
Definition RAction.h:68
RDocumentInterface * documentInterface
Definition RAction.h:265
RAction * overrideBase
Definition RAction.h:264
virtual void resumeEvent()=0
Resumes the action (for example when another action became active and then terminated or if the mouse...
virtual void setDocumentInterface(RDocumentInterface *di)
Definition RAction.h:108
virtual void mousePressEvent(RMouseEvent &event)=0
Called on mouse press events.
virtual void coordinateEventPreview(RCoordinateEvent &event)=0
Called if the action is in PickCoordinate mode and the mouse is moved around.
virtual void tabletEvent(RTabletEvent &event)=0
Called on tablet events.
virtual void mouseDoubleClickEvent(RMouseEvent &event)=0
Called on mouse double click events.
virtual void coordinateEvent(RCoordinateEvent &event)=0
Called for every coordinate event.
virtual void setGraphicsView(RGraphicsView *view)=0
Called if this action is set as a navigation action of a graphics view.
virtual void mouseReleaseEvent(RMouseEvent &event)=0
Called on mouse release events.
virtual void panGestureEvent(QPanGesture &gesture)=0
Called on pan gesture events.
virtual void suspendEvent()=0
Called when the action is suspended, for example when another action becomes active or the mouse curs...
virtual void entityPickEventPreview(REntityPickEvent &event)=0
virtual void enterEvent()=0
Called when user presses enter (e.g.
QString uniqueGroup
Definition RAction.h:261
virtual void beginEvent()=0
Called as soon as the action is created (menu chosen, toolbutton activated, etc).
RAction::ClickMode clickMode
Definition RAction.h:262
virtual void propertyChangeEvent(RPropertyEvent &event)=0
Called when the value of a property is modified while this action is active.
bool terminated
Definition RAction.h:252
virtual void wheelEvent(RWheelEvent &event)=0
Called on mouse wheel events.
virtual void keyReleaseEvent(QKeyEvent &event)=0
virtual void entityPickEvent(REntityPickEvent &event)=0
RAction::ClickMode getClickMode()
Definition RAction.h:118
virtual void escapeEvent()=0
Escape events are triggered if the user clicks the right mouse button or hits the Escape key.
RGuiAction * guiAction
Definition RAction.h:263
virtual void updatePreview()=0
virtual void swipeGestureEvent(QSwipeGesture &gesture)=0
Called on swipe gesture events.
virtual void commandEvent(RCommandEvent &event)=0
Called when a command is entered in the command line.
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RCommandEvent.h:34
Coordinate Event.
Definition RCoordinateEvent.h:39
A graphics document contains and owns entities, layers, user coordinate systems, variables,...
Definition RDocument.h:78
Interface for interaction between a graphics document and a user.
Definition RDocumentInterface.h:97
Entity pick event.
Definition REntityPickEvent.h:38
Abstract base class for all graphics scenes.
Definition RGraphicsScene.h:64
Graphics view.
Definition RGraphicsView.h:67
Abstract base class for GUI action classes.
Definition RGuiAction.h:62
A mouse event for a graphics scene.
Definition RMouseEvent.h:42
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RPropertyEvent.h:40
This is the abstract base class for all storage implementations.
Definition RStorage.h:67
A tablet event for a graphics scene.
Definition RTabletEvent.h:43
Represents a 3d vector (x/y/z).
Definition RVector.h:47
A mouse wheel event for a graphics scene.
Definition RWheelEvent.h:41
#define QCADCORE_EXPORT
Definition core_global.h:10
void getDocument()
Returns the current RDocument or undefined.
Definition simple.js:63
void getDocumentInterface()
Returns the current RDocumentInterface or undefined.
Definition simple.js:69
#define NULL
Definition opennurbs_system.h:256