MeVisLab Toolbox Reference
SoInteractionController.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_CONTROLLER_H
14 #define SO_INTERACTION_CONTROLLER_H
15 
21 
24 
25 #include <ThirdPartyWarningsDisable.h>
26 #include <Inventor/fields/SoFields.h>
27 #include <Inventor/nodes/SoSubNode.h>
28 #include <Inventor/nodes/SoShape.h>
29 #include <Inventor/nodes/SoGroup.h>
30 #include <Inventor/sensors/SoFieldSensor.h>
31 #include <Inventor/sensors/SoNodeSensor.h>
32 #include <Inventor/elements/SoCacheElement.h>
33 #include <Inventor/actions/SoCallbackAction.h>
34 #include <Inventor/events/SoKeyboardEvent.h>
35 #include <Inventor/SbLinear.h>
36 #include <Inventor/SbTime.h>
37 #include <ThirdPartyWarningsRestore.h>
38 
39 #include "SoPointingAction.h"
40 
47  : public SoGroup, public SoInteractionCoordinator
48 {
49  SO_NODE_HEADER(SoInteractionController);
50 
51 public:
53  static void initClass();
54 
59 
60  // fields
61 
65 
68 
70  SoSFBool inDrag;
71 
74 
77 
80 
83 
85  void handleEvent(SoHandleEventAction *action) override;
86 
88  bool isDragThresholdExceeded() const override { return _dragThresholdExceeded; }
89 
90 protected:
93  void setDragging(bool dragging = true) override;
94 
95 private:
97  void updatePointerStatus(SoAction* action);
98 
101  SoInteractionHandler* handler, const SoPointerPosition& location, bool allowed = true) override;
102 
104  int _currentButtonMask;
105  SbVec2s _clickStartPos;
106  int _clickCount;
107  bool _dragThresholdExceeded;
108  bool _wasDoubleClick;
109 };
110 
111 #endif //__SoInteractionController_H
#define SOMANAGEDINTERACTION_API
File to resolve system dependencies in View2D library.
SoInteractionController is the controlling instance of managed interactions.
SoSFBool inDrag
This flag is true if an pointer action is active (dragging).
SoSFString activePointingAction
This field contains the id of the pointing action that would be activated on left mouse click or whic...
void handleEvent(SoHandleEventAction *action) override
Handles the mouse and keyboard events and send them to interaction nodes.
SoSFBool enableMouseHandling
If this flag is false, no pointing actions are enabled.
~SoInteractionController() override
Destructor.
SoInteractionController()
Default constructor.
static void initClass()
Initialization of the inventor runtime type system.
SoSFBool enableKeyHandling
If this flag is false, no command actions will be executed when a key is pressed.
void setDragging(bool dragging=true) override
Method inherited from SoInteractionCoordinator, overridden to update the inDrag field.
SoSFBool enableWheelHandling
If this flag is false, no offset actions will be executed when the mouse wheel is rotated.
SoSFString activePointingActionStatus
Status string returned by the pointing action indicated by activePointerAction.
SoSFString activePointingActionProvider
This field contains the id of the provider of the pointing action.
bool isDragThresholdExceeded() const override
Return if the drag threshold was exceeded, that is, endPress will get a clickCount of 0.
Provides coordinating interface to the SoInteractionHandlers in the scene.
virtual void setSelectedPointingAction(SoPointingAction *action, SoInteractionHandler *handler, const SoPointerPosition &location, bool allowed=true)
This method sets the new selected pointing action.
SoInteractionHandler is a mix-in class for instances of SoNode to handle the interactions it provides...
SoPointerPosition manages the current position of the mouse cursor.
SoPointingAction is the base class for any mouse based interaction.