MeVisLab Toolbox Reference
SoInteraction.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_INTERACTION_H
14 #define SO_INTERACTION_H
15 
17 #include <ThirdPartyWarningsDisable.h>
18 #include <string>
19 #include <list>
20 #include <ThirdPartyWarningsRestore.h>
21 
23 
24 class SoInteractionOwner;
25 
36 {
37 public:
40  enum {
46  // deprecated values:
47  ShiftMask = ShiftModifier,
48  CtrlMask = ControlModifier,
49  AltMask = AltModifier
50  };
51 
56  TypeOffsetAction
57  };
58 
59 
64  SoInteraction(InteractionType type, SoInteractionOwner* owner, const std::string& id, bool registerWithOwner = true);
65 
69  virtual ~SoInteraction();
70 
72  SoInteractionOwner* getOwner() const { return _owner; }
73 
77  virtual bool isEnabled() const { return _enabled; }
79  virtual void setEnabled(bool enabled) { _enabled = enabled; touch(); }
80 
84  std::string getID() const { return _id; }
86  void setID(const std::string& id) { _id = id; touch(); }
87 
90  std::string getFullID() const;
91 
96  int getMenuPriority() const { return _menuPriority; }
98  void setMenuPriority(int priority) { _menuPriority = priority; touch(); }
99 
102  virtual std::string getUserName() const { return _userName; }
104  virtual void setUserName(const std::string& name) { _userName = name; touch(); }
105 
107  virtual std::string getIconFile() const { return _iconFile; }
109  virtual void setIconFile(const std::string& file) { _iconFile = file; touch(); }
110 
112  virtual std::string getDescription() const { return _description; }
114  virtual void setDescription(const std::string& descr) { _description = descr; touch(); }
116 
118  InteractionType getInteractionType() const { return _interactionType; }
119 
121  template<class T>
122  inline bool isOfType() const { return static_cast<int>(_interactionType) == T::TypeId; }
123 
126  virtual void ref();
127  virtual void unref();
129 
136  int getStateVersion() const { return _stateVersion; }
137 
139  void touch();
141 
142 
143 private:
144  SoInteractionOwner* _owner;
145  InteractionType _interactionType;
146 
147  int _stateVersion;
148  std::string _id;
149  std::string _userName;
150  std::string _iconFile;
151  std::string _description;
152  int _menuPriority;
153  bool _enabled;
154 };
155 
158 
159 #endif // __SoInteraction_H
SoInteraction SoInteractionEntry
provide deprecated old class name
#define SOMANAGEDINTERACTION_API
File to resolve system dependencies in View2D library.
@ NoModifier
No modifier key.
@ ShiftModifier
Shift modifier key.
@ AllModifiersMask
All modifier keys.
@ ControlModifier
Control modifier key.
@ AltModifier
Alt modifier key.
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
virtual std::string getUserName() const
virtual ~SoInteraction()
Virtual destructor.
bool isOfType() const
Convenience method for checking type.
virtual bool isEnabled() const
Definition: SoInteraction.h:77
int getStateVersion() const
virtual void setEnabled(bool enabled)
Sets the enabled status of this interaction.
Definition: SoInteraction.h:79
virtual std::string getIconFile() const
InteractionType
Enum identifying sub-types of this class.
Definition: SoInteraction.h:53
virtual void ref()
SoInteraction(InteractionType type, SoInteractionOwner *owner, const std::string &id, bool registerWithOwner=true)
Standard constructor.
SoInteractionOwner * getOwner() const
Definition: SoInteraction.h:72
virtual void setUserName(const std::string &name)
Sets the user name of this interaction entry.
void setMenuPriority(int priority)
Sets the priority value for ordered display in menus/tool boxes.
Definition: SoInteraction.h:98
virtual void setIconFile(const std::string &file)
Sets the filename of an icon used for this interaction entry.
void touch()
Increments the version number of attribute state to mark attribute changes.
InteractionType getInteractionType() const
Get type of interaction object.
int getMenuPriority() const
Definition: SoInteraction.h:96
void setID(const std::string &id)
Sets the id of this interaction.
Definition: SoInteraction.h:86
std::string getFullID() const
Returns the ID string consisting of the id of the provider and this action's id, separated by '.
std::string getID() const
Definition: SoInteraction.h:84
virtual std::string getDescription() const
virtual void setDescription(const std::string &descr)
Sets the description for user help.
virtual void unref()