00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _SO_CONTROLLER_BUTTON_EVENT_
00025 #define _SO_CONTROLLER_BUTTON_EVENT_
00026
00027 #include <Inventor/events/SoButtonEvent.h>
00028 #include <Inventor/events/SbTrackerInfo.h>
00029
00030
00031
00032 #define SO_CONTROLLER_PRESS_EVENT(EVENT,BUTTON) \
00033 (SoControllerButtonEvent::isButtonPressEvent(EVENT,SoControllerButtonEvent::BUTTON))
00034
00035 #define SO_CONTROLLER_RELEASE_EVENT(EVENT,BUTTON) \
00036 (SoControllerButtonEvent::isButtonReleaseEvent(EVENT,SoControllerButtonEvent::BUTTON))
00037
00038
00083 class SoControllerButtonEvent : public SoButtonEvent {
00084
00085 SO_EVENT_HEADER();
00086
00087 public:
00088
00090 enum Button {
00091 ANY = 0,
00095 BUTTON1 = 1,
00099 BUTTON2 = 2,
00103 BUTTON3 = 3
00104 };
00105
00109 SoControllerButtonEvent();
00110 #ifndef HIDDEN_FROM_DOC
00111 virtual ~SoControllerButtonEvent();
00112 #endif // HIDDEN_FROM_DOC
00113
00117 void setButton(SoControllerButtonEvent::Button b) { button = b; }
00121 SoControllerButtonEvent::Button getButton() const { return button; }
00122
00126 void setPosition3(const SbVec3f &p)
00127 { m_trackerInfo.setPosition3( p ); }
00128
00132 const SbVec3f & getPosition3() const
00133 { return m_trackerInfo.getPosition3(); }
00134
00139 void setOrientation( float x, float y, float z)
00140 { m_trackerInfo.setOrientation( x, y, z ); }
00141
00145 void setOrientation( SbRotation orientation )
00146 { m_trackerInfo.setOrientation( orientation ); }
00147
00151 void setOrientation(const SbVec3f &axis, float angle)
00152 { m_trackerInfo.setOrientation( axis, angle ); }
00153
00158 const SbRotation & getOrientation() const
00159 { return m_trackerInfo.getOrientation(); }
00160
00164 const SbLine getRay() const
00165 { return m_trackerInfo.getRay(); }
00166
00167
00168
00169 using SoEvent::getTrackerInfo;
00170
00177 virtual const SbTrackerInfo *getTrackerInfo() const
00178 { return &m_trackerInfo; }
00179
00183 virtual const SbTrackerInfo & trackerInfo() const
00184 { return m_trackerInfo; }
00185
00190 static SbBool isButtonPressEvent(
00191 const SoEvent *e,
00192 SoControllerButtonEvent::Button whichButton);
00193
00198 static SbBool isButtonReleaseEvent(
00199 const SoEvent *e,
00200 SoControllerButtonEvent::Button whichButton);
00201
00202 private:
00203 static void initClass();
00204 static void exitClass();
00205
00206 private:
00207 Button button;
00208 SbTrackerInfo m_trackerInfo;
00209
00210 };
00211
00212 #endif
00213
00214
00215