MeVisLab Toolbox Reference
SoPointingAction.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2008, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef SO_POINTING_ACTION_H
14#define SO_POINTING_ACTION_H
15
16#include "SoInteraction.h"
17#include "SoPointerPosition.h"
18
20
21class SoViewerProxy;
25
26class SoOffsetAction;
27
28// typedef for a callback that signals that the controller should release its
29// pointing grab
30typedef void (*grabReleaseFunc) (SoPointingAction*, void*);
31
89{
92
93public:
95 typedef enum {
98 } StopMode;
99
102 enum {
107 };
108
110
114
116 typedef std::list<Trigger> TriggerList;
117
123 SoPointingAction(SoInteractionOwner* owner, std::string id, bool positionSensitive = true);
124
131 virtual bool isPositionSensitive() const { return _positionSensitive; }
132
134 void clearTriggers() { _triggers.clear(); }
135
138 void setTrigger(int triggerMask, int ignoreMask = 0);
139
141 void setTrigger(const Trigger& trigger);
142
144 void addTrigger(const Trigger& trigger);
145
147 TriggerList getTriggers() const { return _triggers; }
148
153 virtual bool triggersAction(int mask);
154
158 virtual int getNumModes() const { return 1; }
159
166 virtual int getCurrentCursor(SoViewerProxy* /*viewerProxy*/) const { return -1; }
167
172 virtual std::string getCurrentStatusMessage() const { return std::string(); }
173
178 virtual void setMode(int /*mode*/) {}
179
185 virtual bool isSensitiveAt(const SoPointerPosition& pos) = 0;
186
189 virtual void setHighlightAt(const SoPointerPosition& /*pos*/) {}
190
194 virtual void unsetHighlight() {}
195
199 virtual void startPressAt(const SoPointerPosition& pos) = 0;
200
202 virtual void dragMoveTo(const SoPointerPosition& pos) = 0;
203
219 virtual SoPointingAction* endPress(int clickCount) = 0;
220
226 virtual void dragCancelled() { endPress(0); }
227
236 virtual bool wantsMouseOverUpdates() { return false; }
237
241
248 virtual void releaseGrab(StopMode /*mode*/) {}
249
256 virtual bool wantsImmediateDragUpdates() { return true; }
257
258protected:
259 // Internal interface, do not override:
260 // For SoOffsetPointingAction, this returns the SoOffsetAction that is proxied by this object.
261 virtual SoOffsetAction* proxiedOffsetAction() const { return nullptr; }
262
263private:
266
269 void setGrabReleaseCB (grabReleaseFunc cb, void* data);
270
272 bool _positionSensitive;
273
276 TriggerList _triggers;
277
279 grabReleaseFunc _grabReleaseCB;
280
282 void* _grabReleaseData;
283};
284
285#endif // __SoPointingAction_H
#define SOMANAGEDINTERACTION_API
File to resolve system dependencies in View2D library.
void(* grabReleaseFunc)(SoPointingAction *, void *)
Provides a coordinating interface to the SoInteractionHandlers in the scene.
SoInteraction(InteractionType type, SoInteractionOwner *owner, const std::string &id, bool registerWithOwner=true)
SoPointerPosition manages the current position of the mouse cursor.
friend class SoOffsetPointingAction
@ Button1Mask
Left button.
@ Button2Mask
Middle button.
@ Button3Mask
Right button.
@ AllButtonsMask
All buttons.
StopMode
Argument type for releaseGrab().
@ AbortAction
Current action should be aborted.
@ FinishAction
Current action should be finished.
TriggerList getTriggers() const
Returns the list of default modifier/button mask combinations set for this action.
SoPointingAction(SoInteractionOwner *owner, std::string id, bool positionSensitive=true)
virtual SoOffsetAction * proxiedOffsetAction() const
virtual void dragCancelled()
void addTrigger(const Trigger &trigger)
Adds another default modifier/button mask as trigger.
virtual void unsetHighlight()
virtual std::string getCurrentStatusMessage() const
virtual SoPointingAction * endPress(int clickCount)=0
ManagedMouseButtonTrigger Trigger
virtual void setMode(int)
virtual int getCurrentCursor(SoViewerProxy *) const
virtual bool isPositionSensitive() const
virtual int getNumModes() const
virtual void startPressAt(const SoPointerPosition &pos)=0
virtual bool wantsImmediateDragUpdates()
void clearTriggers()
Removes all triggers.
std::list< Trigger > TriggerList
List of triggers.
friend class SoInteractionCoordinator
void setTrigger(const Trigger &trigger)
Same with Trigger object.
virtual void releaseGrab(StopMode)
void setTrigger(int triggerMask, int ignoreMask=0)
virtual bool wantsMouseOverUpdates()
virtual bool triggersAction(int mask)
virtual void setHighlightAt(const SoPointerPosition &)
virtual void dragMoveTo(const SoPointerPosition &pos)=0
Continues the drag to given device position.
virtual bool isSensitiveAt(const SoPointerPosition &pos)=0