MeVisLab Toolbox Reference
ManagedMouseButtonTrigger.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_MOUSE_BUTTON_TRIGGER_H
14 #define MANAGED_MOUSE_BUTTON_TRIGGER_H
15 
16 #include "ManagedActionTrigger.h"
17 
18 // undef macros defined in X.h (Linux), which might collide with our enums:
19 #ifdef Button1Mask
20 #undef Button1Mask
21 #endif
22 #ifdef Button2Mask
23 #undef Button2Mask
24 #endif
25 #ifdef Button3Mask
26 #undef Button3Mask
27 #endif
28 #ifdef AllButtonsMask
29 #undef AllButtonsMask
30 #endif
31 
33 
37 {
39 
40 public:
44  ManagedMouseButtonTrigger(int triggerMask = 0, int ignoreMask = 0) : _triggerMask(triggerMask), _ignoreMask(ignoreMask) {}
45 
47  bool isValid() const { return ((_triggerMask & AllButtonsMask) != 0); }
48 
50  bool matches(int mask) const;
51 
53  std::string toString() const;
54 
67  static ManagedMouseButtonTrigger fromString(const std::string& s);
68 
69 
70 private:
72  int _triggerMask;
73  int _ignoreMask;
74 
75  // helper functions used for string conversion:
76  std::string _getDisplayFragment(int mask, const char* displayString) const;
77  void _setMaskFromString(const std::string& triggerString, int mask, char c);
78 };
79 
80 #endif // __ManagedMouseButtonTrigger_H
#define SOMANAGEDINTERACTION_API
File to resolve system dependencies in View2D library.
ManagedActionTrigger is a base class for all triggers of managed interactions.
Class ManagedMouseButtonTrigger encapsulates the combination of required and ignored mouse buttons an...
bool matches(int mask) const
ManagedMouseButtonTrigger(int triggerMask=0, int ignoreMask=0)
Creates a mouse trigger with a trigger mask and an ignore mask.
std::string toString() const
static ManagedMouseButtonTrigger fromString(const std::string &s)
Create a trigger from a string.
Class ManagedMouseWheelTrigger encapsulates the combination of required and ignored modifier keys tha...