MeVisLab Toolbox Reference
SoOffsetAction.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2014, 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_OFFSET_ACTION_H
14 #define SO_OFFSET_ACTION_H
15 
16 #include "SoInteraction.h"
18 
19 class SoViewerProxy;
20 class SoPointingAction;
22 
31 {
32  friend class SoInteractionHandler;
33 
34 public:
35  enum { TypeId = TypeOffsetAction };
36 
38  enum OffsetType {
44  DOUBLE_AXES
45  };
46 
49  enum {
54  };
55 
58 
60  typedef std::list<Trigger> TriggerList;
61 
67  SoOffsetAction(SoInteractionOwner* owner, std::string id, OffsetType offsetType = DOUBLE_AXES);
68 
69  ~SoOffsetAction() override;
70 
72  OffsetType getOffsetType() const { return _offsetType; }
73 
75  void clearTriggers();
76 
78  void setTrigger(const Trigger& trigger);
79 
81  void addTrigger(const Trigger& trigger);
82 
84  const TriggerList& getTriggers() const { return _triggers; }
85 
86 
93  virtual void offsetBy(double dx, double dy, void* /*info*/) { offsetBy(dx, dy); }
94 
96  virtual void offsetBy(double /*dx*/, double /*dy*/) {}
97 
98 
106  virtual int getCurrentCursor(SoViewerProxy* /*viewerProxy*/) const { return -1; }
107 
112  virtual std::string getCurrentStatusMessage() const { return std::string(); }
113 
114 private:
116  SoPointingAction* _getProxyPointingAction();
117 
120  TriggerList _triggers;
121 
123  SoPointingAction* _proxyPointingAction;
124 
126  OffsetType _offsetType;
127 };
128 
129 #endif // __SoPointingAction_H
#define SOMANAGEDINTERACTION_API
File to resolve system dependencies in View2D library.
@ Button2Mask
Middle button.
Class ManagedOffsetTrigger may contain a ManagedMouseButtonTrigger, a ManagedMouseWheelTrigger,...
SoInteractionHandler is a mix-in class for instances of SoNode to handle the interactions it provides...
SoInteractionOwner is a mix-in class for instances of SoNode that should have interaction objects.
SoInteraction is the base class for SoCommandAction, SoPointingAction, and SoOffsetAction.
Definition: SoInteraction.h:36
SoOffsetAction is the base class for any interaction that only provides (numeric) offsets in one or t...
virtual std::string getCurrentStatusMessage() const
Returns a status message for display in status bar (make it short!), will get called at same time as ...
std::list< Trigger > TriggerList
List of triggers.
void clearTriggers()
Clears list of default triggers.
~SoOffsetAction() override
void setTrigger(const Trigger &trigger)
Sets the (only) default trigger.
virtual int getCurrentCursor(SoViewerProxy *) const
Returns the cursor shape ID for display, as defined in SoViewerProxy.
OffsetType
Type of offset action (single or double axis).
@ SINGLE_AXIS
Only one offset axis is used.
const TriggerList & getTriggers() const
Returns the default triggers set for this action.
virtual void offsetBy(double, double)
Variant without additional info parameter. You need to override one of these methods.
virtual void offsetBy(double dx, double dy, void *)
Perform offset operation with given values.
OffsetType getOffsetType() const
void addTrigger(const Trigger &trigger)
Adds another default trigger.
ManagedOffsetTrigger Trigger
The trigger type for this action.
SoOffsetAction(SoInteractionOwner *owner, std::string id, OffsetType offsetType=DOUBLE_AXES)
Standard constructor.
SoPointingAction is the base class for any mouse based interaction.
This class gives access to state of a viewer during scene graph traversal.
Definition: SoViewerProxy.h:30