MeVisLab Toolbox Reference
ManagedOffsetTrigger.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 MANAGED_OFFSET_TRIGGER_H
14 #define MANAGED_OFFSET_TRIGGER_H
15 
18 
19 
24 {
25 public:
27  enum TriggerType {
30  Keyboard
31  };
32 
35 
38 
40 
49  ManagedOffsetTrigger(const ManagedMouseButtonTrigger& trigger, bool swapAxes = false);
50  ManagedOffsetTrigger(const ManagedMouseButtonTrigger& trigger, double sensitivity, bool swapAxes = false);
51  ManagedOffsetTrigger(const ManagedMouseButtonTrigger& trigger, double sensitivityX, double sensitivityY, bool swapAxes = false);
53 
56  ManagedOffsetTrigger(const ManagedMouseWheelTrigger& trigger, bool swapAxes = false);
57  ManagedOffsetTrigger(const ManagedMouseWheelTrigger& trigger, double sensitivity, bool swapAxes = false);
58  ManagedOffsetTrigger(const ManagedMouseWheelTrigger& trigger, double sensitivityX, double sensitivityY, bool swapAxes = false);
60 
63  ManagedOffsetTrigger(const ManagedKeyboardShortcut& shortcut, bool swapAxes = false);
64  ManagedOffsetTrigger(const ManagedKeyboardShortcut& shortcut, double sensitivity, bool swapAxes = false);
65  ManagedOffsetTrigger(const ManagedKeyboardShortcut& shortcut, double sensitivityX, double sensitivityY, bool swapAxes = false);
67 
74  bool swapAxes = false);
76  double sensitivity, bool swapAxes = false);
78  double sensitivityX, double sensitivityY, bool swapAxes = false);
80 
82  TriggerType getTriggerType() const { return _type; }
83 
86 
89 
92 
95 
97  bool isValid() const;
98 
100  std::string toString() const;
101 
113  static ManagedOffsetTrigger fromString(const std::string& s);
114 
116  double sensitivityX() const { return _sensitivityX; }
117 
119  double sensitivityY() const { return _sensitivityY; }
120 
122  bool swapAxes() const { return _swapAxes; }
123 
125  ManagedOffsetTrigger& operator= (const ManagedOffsetTrigger& trigger);
126 
127 private:
128  void free();
129  void copyFrom(const ManagedOffsetTrigger& trigger);
130 
132  TriggerType _type;
133 
134  union {
137  struct {
140  } _keyboard;
141  };
142 
144  bool _swapAxes;
145  double _sensitivityX;
146  double _sensitivityY;
147 
148  // helper functions used for string conversion:
149  std::string _getDisplayFragment(int mask, const char* displayString) const;
150  void _setMaskFromString(const std::string& triggerString, int mask, char c);
151 };
152 
153 #endif // ManagedOffsetTrigger
#define SOMANAGEDINTERACTION_API
File to resolve system dependencies in View2D library.
ManagedActionTrigger is a base class for all triggers of managed interactions.
Class ManagedKeyboardShortcut encapsulates the combination of modifier keys and another key that acti...
Class ManagedMouseButtonTrigger encapsulates the combination of required and ignored mouse buttons an...
Class ManagedMouseWheelTrigger encapsulates the combination of required and ignored modifier keys tha...
Class ManagedOffsetTrigger may contain a ManagedMouseButtonTrigger, a ManagedMouseWheelTrigger,...
ManagedKeyboardShortcut * shortcut1
ManagedOffsetTrigger(const ManagedMouseButtonTrigger &trigger, bool swapAxes=false)
ManagedMouseButtonTrigger * _mouseButtonTrigger
std::string toString() const
Returns a string representation of this trigger (see fromString()).
ManagedOffsetTrigger(const ManagedKeyboardShortcut &shortcut, double sensitivityX, double sensitivityY, bool swapAxes=false)
ManagedOffsetTrigger(const ManagedKeyboardShortcut &shortcut, double sensitivity, bool swapAxes=false)
ManagedOffsetTrigger(const ManagedMouseButtonTrigger &trigger, double sensitivity, bool swapAxes=false)
ManagedMouseWheelTrigger * _mouseWheelTrigger
bool isValid() const
TriggerType
The type of trigger contained in this class.
ManagedOffsetTrigger(const ManagedKeyboardShortcut &shortcut1, const ManagedKeyboardShortcut &shortcut2, bool swapAxes=false)
const ManagedKeyboardShortcut * getKeyboardShortcut2() const
ManagedOffsetTrigger(const ManagedMouseWheelTrigger &trigger, double sensitivity, bool swapAxes=false)
static ManagedOffsetTrigger fromString(const std::string &s)
Creates a trigger from a string.
const ManagedMouseButtonTrigger * getMouseButtonTrigger() const
ManagedKeyboardShortcut * shortcut2
ManagedOffsetTrigger(const ManagedMouseButtonTrigger &trigger, double sensitivityX, double sensitivityY, bool swapAxes=false)
ManagedOffsetTrigger(const ManagedMouseWheelTrigger &trigger, bool swapAxes=false)
ManagedOffsetTrigger(const ManagedMouseWheelTrigger &trigger, double sensitivityX, double sensitivityY, bool swapAxes=false)
ManagedOffsetTrigger(const ManagedOffsetTrigger &trigger)
Copy constructor.
ManagedOffsetTrigger(const ManagedKeyboardShortcut &shortcut, bool swapAxes=false)
const ManagedKeyboardShortcut * getKeyboardShortcut1() const
ManagedOffsetTrigger()
Default constructor (creates an invalid mouse button trigger).
ManagedOffsetTrigger(const ManagedKeyboardShortcut &shortcut1, const ManagedKeyboardShortcut &shortcut2, double sensitivity, bool swapAxes=false)
const ManagedMouseWheelTrigger * getMouseWheelTrigger() const
TriggerType getTriggerType() const
ManagedOffsetTrigger(const ManagedKeyboardShortcut &shortcut1, const ManagedKeyboardShortcut &shortcut2, double sensitivityX, double sensitivityY, bool swapAxes=false)