MeVisLabToolboxReference
|
00001 #ifndef __SoMouseGrabber_H 00002 #define __SoMouseGrabber_H 00003 00004 //---------------------------------------------------------------------------------- 00005 // **InsertLicense** code 00006 //---------------------------------------------------------------------------------- 00009 00014 //---------------------------------------------------------------------------------- 00015 00016 #include <Inventor/fields/SoSFBool.h> 00017 #include <Inventor/fields/SoSFFloat.h> 00018 #include <Inventor/fields/SoSFTrigger.h> 00019 #include <Inventor/nodes/SoSeparator.h> 00020 #include <Inventor/nodes/SoSubNode.h> 00021 #include <Inventor/events/SoMouseButtonEvent.h> 00022 #include <Inventor/sensors/SoFieldSensor.h> 00023 00024 //============================================================= 00028 00062 //============================================================= 00063 class SoMouseGrabber : public SoNode { 00064 00065 SO_NODE_HEADER(SoMouseGrabber); 00066 00067 public: 00069 SoMouseGrabber(); 00070 00072 static void initClass(); 00073 00075 00077 SoSFBool on; 00078 00080 SoSFBool normalized; 00082 SoSFBool clamp; 00083 00085 SoSFFloat x; 00087 SoSFFloat y; 00088 00089 SoSFFloat absX; 00090 SoSFFloat absY; 00091 00093 SoSFBool cursorPresent; 00094 00096 SoSFFloat xmin; 00098 SoSFFloat xmax; 00100 SoSFFloat ymin; 00102 SoSFFloat ymax; 00103 00105 SoSFBool flipX; 00107 SoSFBool flipY; 00109 SoSFBool swapXY; 00112 SoSFFloat sensitivity; 00113 00115 SoSFEnum button1; 00117 SoSFEnum button2; 00119 SoSFEnum button3; 00121 SoSFEnum shift; 00123 SoSFEnum ctrl; 00126 SoSFEnum alt; 00127 00129 SoSFEnum cursorShape; 00130 00132 00134 00135 SoSFBool shiftPressed; 00136 SoSFBool ctrlPressed; 00137 SoSFBool altPressed; 00138 SoSFBool button1Pressed; 00139 SoSFBool button2Pressed; 00140 SoSFBool button3Pressed; 00141 00142 SoSFTrigger button1DoubleClicked; 00143 SoSFTrigger button2DoubleClicked; 00144 SoSFTrigger button3DoubleClicked; 00145 00147 SoSFTrigger released; 00148 00151 SoSFBool maskValid; 00152 00154 SoSFBool setEventHandled; 00155 00157 SoSFBool setWheelEventHandled; 00158 00160 00162 00163 SoSFFloat wheel; 00165 SoSFFloat wheelMin; 00167 SoSFFloat wheelMax; 00169 SoSFFloat wheelStep; 00170 00172 SoSFTrigger wheelUp; 00174 SoSFTrigger wheelDown; 00175 00177 SoSFBool wheelOverflow; 00178 00180 00181 00182 //>//! Called when field \c cursorShape changed 00183 //>void cursorShapeChanged(SoFieldSensor* sensor); 00184 //>//! forward CB when field \c cursorShape changed 00185 //>static void cursorShapeChangedCB(void *data, SoSensor* sens); 00186 00189 virtual void handleEvent(SoHandleEventAction *action); 00190 00192 virtual void GLRender(SoGLRenderAction * /* action */) {}; 00193 00194 protected: 00195 virtual ~SoMouseGrabber(); 00196 00197 private: 00198 00200 00209 bool testState(int state, SbBool flag); 00210 00212 SbBool _maskValid; 00214 SbVec2s _lastPos; 00217 SbBool _buttonState[3]; 00218 00220 SbVec2s _lastClickPos; 00222 SbTime _lastClickTime; 00224 int _lastButtonPressed; 00225 00227 unsigned _prevWheelCode; 00229 int _sumWheel; 00230 00231 //>//! sensor for changes of \c cursorShape 00232 //>SoFieldSensor* _cursorShapeSensor; 00233 00234 //>//! required to set the cursor if \c cursorShapeChanged is called 00235 //>SoState* _state; 00236 }; 00237 00238 #endif