MeVisLab Toolbox Reference
SoMouseGrabber.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, 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_MOUSE_GRABBER_H
14#define SO_MOUSE_GRABBER_H
15
16
19
20#include <Inventor/fields/SoSFBool.h>
21#include <Inventor/fields/SoSFFloat.h>
22#include <Inventor/fields/SoSFTrigger.h>
23#include <Inventor/nodes/SoSeparator.h>
24#include <Inventor/nodes/SoSubNode.h>
25#include <Inventor/events/SoMouseButtonEvent.h>
26#include <Inventor/sensors/SoFieldSensor.h>
27
28#include <SoInteractionNode.h>
29
30class SoMouseGrabberPointingAction;
31
32//=============================================================
35
70//=============================================================
72{
73
74 SO_NODE_HEADER(SoMouseGrabber);
75
76 public:
79
81 static void initClass();
82
84
87
90
95
100
103
106
115
125
139
142
144
146
153
157
160
164
167
170
172
182
187
190
192
195
199
201 void GLRender(SoGLRenderAction * /* action */) override {};
202
204 bool affectsState() const override { return false; }
205
206 protected:
207 ~SoMouseGrabber() override;
208
209 private:
211
213 void trackMouse(SbVec2s pos, SbVec2f localPos, const SbViewportRegion& vp, bool initial);
214
216 void updatePointingAction(SoField*);
217
219
228 bool testState(int state, SbBool flag);
229
231 SoMouseGrabberPointingAction* _pointingAction;
232
234 SbBool _maskValid;
236 SbVec2s _lastPos;
239 SbBool _buttonState[3];
240
242 int _lastButtonPressed;
243
245 unsigned _prevWheelCode;
247 int _sumWheel;
248};
249
250#endif
SoInteractionNode is the base class for normal interaction nodes in OpenInventor, that handle their i...
SoMouseGrabber is a general facility to grab mouse events and to map mouse movement to x/y values.
SoSFEnum alt
mask for shift alt, the alt key will not work in SoFullViewer derived classes because those viewers h...
SoSFBool normalized
if true x and y are set to [xmin,xmax] relative to the viewport
SoSFBool button3Pressed
SoSFBool setEventHandled
Set events that depend on the button mask handled if they are indeed handled by this extension.
SoSFBool button2Pressed
SoSFEnum ctrl
mask for shift ctrl
SoSFBool flipY
flip the mouse movement to y mapping
SoSFEnum button2
button mask for button2
void handleEvent(SoHandleEventAction *action) override
handle event is reimplemented to handle the mouse events (The events are not consumed,...
SoMouseGrabber()
Constructor.
static void initClass()
inventor type system
SoSFBool wheelOverflow
if it to true, the wheel value is wrapped around when reaching min/max values
SoSFFloat wheelMax
max value for wheel
SoSFBool useManagedInteraction
If this is on, use managed interaction actions to modify x/y values.
SoSFTrigger wheelDown
tells when the wheel was turned down
SoSFBool shiftPressed
Output Fields that are changed when the state changes.
SoSFFloat xmax
max value for the x field
void GLRender(SoGLRenderAction *) override
GLRender dummy implementation.
SoSFBool swapXY
flip the mouse movement to xy mapping (mouse x -> field y, mouse y -> field x)
SoSFTrigger button2DoubleClicked
void onChanged(SoField *field)
Called when field on changed.
SoSFBool cursorPresent
this is set to true if the cursor is inside the viewing area
SoSFTrigger wheelUp
tells when the wheel was turned up
SoSFTrigger button1DoubleClicked
SoSFTrigger button3DoubleClicked
SoSFFloat y
y value that is changed by mouse movements
SoSFTrigger released
emitted when the mask was valid and switches to invalid again
SoSFBool on
Fields.
SoSFFloat ymax
max value for the y field
SoSFFloat wheelMin
min value for wheel
SoSFBool maskValid
gives the state of the mask, which calculated by the current mousebuttons and modifier key compared t...
SoSFFloat sensitivity
set the sensitivity of the mouse movement to x/y mapping, a value of 1 means that 400 pixel mouse mov...
SoSFFloat x
x value that is changed by mouse movements
SoSFBool flipX
flip the mouse movement to x mapping
SoSFEnum button3
button mask for button3
friend class SoMouseGrabberPointingAction
SoSFFloat xmin
min value for the x field
SoSFFloat wheelStep
step value that is added/subtracted onto wheel on wheel events
SoSFEnum cursorShape
shape of mouse cursor when this grabber is active
~SoMouseGrabber() override
SoSFFloat ymin
min value for the y field
SoSFBool setWheelEventHandled
Set wheel events handled.
SoSFBool button1Pressed
bool affectsState() const override
this node does not affect the state, so return false!
SoSFEnum shift
mask for shift key
SoSFEnum button1
button mask for button1
SoSFBool clamp
clamps the output to [min,max] in noramlized mode
Target mlrange_cast(Source arg)
Generic version of checked ML casts.