00001 // 00002 // Copyright (c) 2000 by Tech Soft 3D, LLC. 00003 // The information contained herein is confidential and proprietary to 00004 // Tech Soft 3D, LLC., and considered a trade secret as defined under 00005 // civil and criminal statutes. Tech Soft 3D shall pursue its civil 00006 // and criminal remedies in the event of unauthorized use or misappropriation 00007 // of its trade secrets. Use of this information by anyone other than 00008 // authorized employees of Tech Soft 3D, LLC. is granted only under a 00009 // written non-disclosure agreement, expressly prescribing the scope and 00010 // manner of such use. 00011 // 00012 // $Id: d0452b484f88b607dc963efb54681eb313c4eb5a $ 00013 // 00014 00015 00017 00023 #ifndef _HEVENTINFO_H 00024 #define _HEVENTINFO_H 00025 00026 #ifdef H_PACK_8 00027 #pragma pack(push) 00028 #pragma pack(8) 00029 #endif 00030 00031 #include "HTools.h" 00032 #include "HUtility.h" 00033 00034 class HBaseView; 00035 00039 enum HEventType 00040 { 00041 HE_NoEvent, 00042 00043 HE_LButtonDown, 00044 HE_LButtonUp, 00045 HE_LButtonDblClk, 00046 00047 HE_MButtonDown, 00048 HE_MButtonUp, 00049 HE_MButtonDblClk, 00050 00051 HE_RButtonDown, 00052 HE_RButtonUp, 00053 HE_RButtonDblClk, 00054 00055 HE_MouseMove, 00056 00057 HE_MouseWheel, 00058 HE_MouseWheelUp, 00059 HE_MouseWheelDown, 00060 00061 HE_Timer, 00062 00063 HE_KeyDown, 00064 HE_KeyUp, 00065 00066 // Higher level 00067 HE_Selection, 00068 00069 HE_JoyStickTranslate, 00070 HE_JoyStickRotate, 00071 HE_JoyStickButton, 00072 00073 HE_TouchesDown, 00074 HE_TouchesUp, 00075 HE_TouchesMove 00076 00077 }; 00078 00079 00080 00081 00083 00086 class MVO_API HTouchInfo 00087 { 00088 public: 00098 HTouchInfo(float x, float y, float timestamp, int taps, int ident, bool active = true) 00099 { 00100 00101 Init(x,y,timestamp,taps,ident,active); 00102 } 00104 HTouchInfo() 00105 { 00106 } 00107 00116 void Init(float x = 0.0f, float y = 0.0f, float timestamp = 0.0f, int taps = 0, int ident = 0, bool active = true) 00117 { 00118 m_x=x; 00119 m_y=y; 00120 m_timestamp = timestamp; 00121 m_taps = taps; 00122 m_id = ident; 00123 m_bActive = active; 00124 00125 } 00126 00127 float m_x; 00128 float m_y; 00129 float m_timestamp; 00130 int m_taps; 00131 bool m_bActive; 00132 MVO_POINTER_SIZED_UINT m_id; 00133 }; 00134 00135 00136 00138 00141 class MVO_API HTouchManager 00142 { 00143 public: 00145 HTouchManager(); 00147 ~HTouchManager(); 00148 00159 HTouchInfo *AddTouch(float x, float y, float timestamp, int taps, MVO_POINTER_SIZED_UINT ident); 00165 void ClearTouchActivity(); 00166 00167 void ClearTouches(); 00168 00169 00175 bool RemoveTouch(MVO_POINTER_SIZED_UINT ident); 00176 00178 int GetActiveTouchCount() { return m_ActiveTouches; } 00180 int GetTouchCount(); 00181 00189 int GetTouches(HTouchInfo **touches, int maxtouches, bool m_ActiveOnly = false); 00190 00191 00192 private: 00193 unsigned int m_ActiveTouches; 00194 vlist_s *m_TouchList; 00195 }; 00196 00197 00199 00206 class MVO_API HEventInfo 00207 { 00208 00209 public: 00210 00213 HEventInfo(HBaseView *view); 00214 00216 #define MVO_CONTROL 1<<1 00217 00219 #define MVO_SHIFT 1<<2 00220 00222 #define MVO_ALT 1<<3 00223 00225 #define MVO_LBUTTON 1<<4 00226 00228 #define MVO_MBUTTON 1<<5 00229 00231 #define MVO_RBUTTON 1<<6 00232 00234 #define MVO_RIGHT_CONTROL 1<<7 00235 00237 #define MVO_RIGHT_SHIFT 1<<8 00238 00240 #define MVO_RIGHT_ALT 1<<9 00241 00243 #define MVO_LEFT_CONTROL 1<<10 00244 00246 #define MVO_LEFT_SHIFT 1<<11 00247 00249 #define MVO_LEFT_ALT 1<<12 00250 00252 #define MVO_LEFT_ARROW 1<<13 00253 00255 #define MVO_UP_ARROW 1<<14 00256 00258 #define MVO_RIGHT_ARROW 1<<15 00259 00261 #define MVO_DOWN_ARROW 1<<16 00262 00264 #define MVO_JOYSTICK_BUTTON_1 1<<17 00265 00267 #define MVO_JOYSTICK_BUTTON_2 1<<18 00268 00270 #define MVO_JOYSTICK_BUTTON_3 1<<19 00271 00273 #define MVO_JOYSTICK_BUTTON_4 1<<20 00274 00276 #define MVO_JOYSTICK_BUTTON_5 1<<21 00277 00279 #define MVO_JOYSTICK_BUTTON_6 1<<22 00280 00282 #define MVO_JOYSTICK_BUTTON_7 1<<23 00283 00285 #define MVO_JOYSTICK_BUTTON_8 1<<24 00286 00287 00288 static const int MAX_TOUCHES = 10; 00289 00290 00291 bool Control() const { return (m_flags & MVO_CONTROL) != 0; } 00292 bool Shift() const { return (m_flags & MVO_SHIFT) != 0; } 00293 bool Alt() const { return (m_flags & MVO_ALT) != 0; } 00294 bool LeftAlt() const { return (m_flags & MVO_LEFT_ALT) != 0; } 00295 bool LeftControl() const { return (m_flags & MVO_LEFT_CONTROL) != 0; } 00296 bool LeftShift() const { return (m_flags & MVO_LEFT_SHIFT) != 0; } 00297 bool RightAlt() const { return (m_flags & MVO_RIGHT_ALT) != 0; } 00298 bool RightControl() const { return (m_flags & MVO_RIGHT_CONTROL) != 0; } 00299 bool RightShift() const { return (m_flags & MVO_RIGHT_SHIFT) != 0; } 00300 bool LButton() const { return (m_flags & MVO_LBUTTON) != 0; } 00301 bool MButton() const { return (m_flags & MVO_MBUTTON) != 0; } 00302 bool RButton() const { return (m_flags & MVO_RBUTTON) != 0; } 00303 bool LeftArrow() const { return (m_flags & MVO_LEFT_ARROW) != 0; } 00304 bool UpArrow() const { return (m_flags & MVO_UP_ARROW) != 0; } 00305 bool RightArrow() const { return (m_flags & MVO_RIGHT_ARROW) != 0; } 00306 bool DownArrow() const { return (m_flags & MVO_DOWN_ARROW) != 0; } 00308 // Get/Set routines 00309 HBaseView* GetView() const { return m_pView; } 00311 const HPoint& GetMousePixelPos() const { return m_ptPixel; } 00312 const HPoint& GetMouseWindowPos() const { return m_ptWindow; } 00313 const HPoint& GetMouseWorldPos() const { return m_ptWorld; } 00314 const HPoint& GetMouseViewpointPos() const { return m_ptViewpoint; } 00315 const HPoint& GetJoystickRotation() const { return m_ptWorld; } 00316 const HPoint& GetJoystickTranslation() const { return m_ptWorld; } 00319 unsigned int GetChar () const { return m_Char; }; 00320 00321 unsigned int GetCharRepCount () const { return m_RepCount; } 00322 unsigned int GetTimerId () const {return m_TimerId; } 00328 unsigned int GetFlags() const { return m_flags; } 00329 00330 00331 // EventInfo Initialization 00332 void SetType(HEventType NewType) { m_EventType = NewType; } 00336 HEventType GetType() const { return m_EventType; } 00337 00347 void SetPoint(HEventType NewType, int x, int y, unsigned int NewFlags); 00348 00349 00358 void SetPixelPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags); 00359 00360 00361 //for some reason this is unresolved when the csharp/c module links 00370 void SetWindowPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags); 00371 00372 00381 void SetWorldPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags); 00382 00383 00391 void SetViewpointPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags); 00392 00393 00402 void SetKey(HEventType NewType, unsigned int nChar, unsigned int nRepCnt, unsigned int NewFlags); 00403 00409 void SetTimer(HEventType NewType, unsigned int nIDEvent); 00410 00415 void SetMouseWheelDelta(int NewWheelDelta); 00416 00422 void SetFlags(int flags){ 00423 m_flags = flags; 00424 } 00425 00429 int GetMouseWheelDelta() const { return m_WheelDelta; } 00430 00431 00432 00433 00434 private: 00435 int m_WheelDelta; 00436 HPoint m_ptPixel; // Mouse position in windows pixel space 00437 HPoint m_ptWindow; // Mouse position in HOOPS "outer window space" 00438 HPoint m_ptWorld; // Mouse position in HOOPS world space 00439 HPoint m_ptViewpoint; // Mouse position in HOOPS world space 00440 00441 unsigned int m_Char; // character from keyboard event 00442 unsigned int m_RepCount; // number of times key press event was repeated 00443 unsigned int m_TimerId; // Id number of the timer generated by the UI 00444 00445 float m_time; // System time of event 00446 unsigned int m_flags; // Flags indicating which mouse buttons are pressed 00447 // and if the "shift" and "control" keyboard keys are pressed 00448 00449 HEventType m_EventType; // Type of event 00450 HBaseView* m_pView; // view associated with this event 00451 00452 }; 00453 00454 00455 #ifdef H_PACK_8 00456 #pragma pack(pop) 00457 #endif 00458 00459 #endif 00460 00461 00462