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{
25public:
32
35
38
40
50 ManagedOffsetTrigger(const ManagedMouseButtonTrigger& trigger, double sensitivity, bool swapAxes = false);
51 ManagedOffsetTrigger(const ManagedMouseButtonTrigger& trigger, double sensitivityX, double sensitivityY, bool swapAxes = false);
53
57 ManagedOffsetTrigger(const ManagedMouseWheelTrigger& trigger, double sensitivity, bool swapAxes = false);
58 ManagedOffsetTrigger(const ManagedMouseWheelTrigger& trigger, double sensitivityX, double sensitivityY, bool swapAxes = false);
60
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
126
127private:
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)
const ManagedKeyboardShortcut * getKeyboardShortcut1() const
Returns the pointer to the first keyboard shortcut if the trigger type is Keyboard,...
ManagedOffsetTrigger(const ManagedKeyboardShortcut &shortcut, double sensitivity, bool swapAxes=false)
ManagedOffsetTrigger(const ManagedMouseButtonTrigger &trigger, double sensitivity, bool swapAxes=false)
ManagedMouseWheelTrigger * _mouseWheelTrigger
double sensitivityY() const
Returns the sensitivity for the y-axis.
bool isValid() const
Returns whether this is a valid trigger.
TriggerType
The type of trigger contained in this class.
ManagedOffsetTrigger(const ManagedKeyboardShortcut &shortcut1, const ManagedKeyboardShortcut &shortcut2, bool swapAxes=false)
const ManagedMouseButtonTrigger * getMouseButtonTrigger() const
Returns the pointer to the mouse button trigger if the trigger type is MouseButton,...
ManagedOffsetTrigger(const ManagedMouseWheelTrigger &trigger, double sensitivity, bool swapAxes=false)
static ManagedOffsetTrigger fromString(const std::string &s)
Creates a trigger from a string.
double sensitivityX() const
Returns the sensitivity for the x-axis.
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)
const ManagedKeyboardShortcut * getKeyboardShortcut2() const
Returns the pointer to a possible second keyboard shortcut if the trigger type is Keyboard,...
ManagedOffsetTrigger(const ManagedOffsetTrigger &trigger)
Copy constructor.
ManagedOffsetTrigger(const ManagedKeyboardShortcut &shortcut, bool swapAxes=false)
bool swapAxes() const
Returns whether the axes should be swapped for this trigger.
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
Returns the pointer to the mouse wheel trigger if the trigger type is MouseWheel, else NULL.
TriggerType getTriggerType() const
Returns the type of this trigger.
ManagedOffsetTrigger(const ManagedKeyboardShortcut &shortcut1, const ManagedKeyboardShortcut &shortcut2, double sensitivityX, double sensitivityY, bool swapAxes=false)
Target mlrange_cast(Source arg)
Generic version of checked ML casts.