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
00082 class SoControllerButtonEvent : public SoButtonEvent {
00083
00084 SO_EVENT_HEADER();
00085
00086 public:
00087
00089 enum Button {
00090 ANY = 0,
00094 BUTTON1 = 1,
00098 BUTTON2 = 2,
00102 BUTTON3 = 3
00103 };
00104
00108 SoControllerButtonEvent();
00109 #ifndef HIDDEN_FROM_DOC
00110 virtual ~SoControllerButtonEvent();
00111 #endif // HIDDEN_FROM_DOC
00112
00116 void setButton(SoControllerButtonEvent::Button b) { button = b; }
00120 SoControllerButtonEvent::Button getButton() const { return button; }
00121
00125 void setPosition3(const SbVec3f &p)
00126 { m_trackerInfo.setPosition3( p ); }
00127
00131 const SbVec3f & getPosition3() const
00132 { return m_trackerInfo.getPosition3(); }
00133
00138 void setOrientation( float x, float y, float z)
00139 { m_trackerInfo.setOrientation( x, y, z ); }
00140
00144 void setOrientation( SbRotation orientation )
00145 { m_trackerInfo.setOrientation( orientation ); }
00146
00150 void setOrientation(const SbVec3f &axis, float angle)
00151 { m_trackerInfo.setOrientation( axis, angle ); }
00152
00157 const SbRotation & getOrientation() const
00158 { return m_trackerInfo.getOrientation(); }
00159
00163 const SbLine getRay() const
00164 { return m_trackerInfo.getRay(); }
00165
00166
00167
00168 using SoEvent::getTrackerInfo;
00169
00176 virtual const SbTrackerInfo *getTrackerInfo() const
00177 { return &m_trackerInfo; }
00178
00182 virtual const SbTrackerInfo & trackerInfo() const
00183 { return m_trackerInfo; }
00184
00189 static SbBool isButtonPressEvent(
00190 const SoEvent *e,
00191 SoControllerButtonEvent::Button whichButton);
00192
00197 static SbBool isButtonReleaseEvent(
00198 const SoEvent *e,
00199 SoControllerButtonEvent::Button whichButton);
00200
00201 private:
00202 static void initClass();
00203 static void exitClass();
00204
00205 private:
00206 Button button;
00207 SbTrackerInfo m_trackerInfo;
00208
00209 };
00210
00211 #endif
00212
00213
00214