Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HEventInfo.h
Go to the documentation of this file.
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: 58c52284c012013cd1aeaaf3f16b9101122a0e8e $
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 activeOnly = false);
00190     
00197     HTouchInfo *GetTouch(int index, bool activeOnly = false);
00198 
00199 private:
00200     unsigned int m_ActiveTouches;
00201     vlist_s *m_TouchList;
00202  };
00203 
00204 
00206 
00213 class MVO_API HEventInfo 
00214 {
00215 
00216 public:
00217 
00220     HEventInfo(HBaseView *view); 
00221     
00223 #define MVO_CONTROL 1<<1
00224 
00226 #define MVO_SHIFT 1<<2
00227 
00229 #define MVO_ALT 1<<3
00230 
00232 #define MVO_LBUTTON 1<<4
00233 
00235 #define MVO_MBUTTON  1<<5
00236 
00238 #define MVO_RBUTTON 1<<6
00239 
00241 #define MVO_RIGHT_CONTROL 1<<7
00242 
00244 #define MVO_RIGHT_SHIFT 1<<8
00245 
00247 #define MVO_RIGHT_ALT 1<<9
00248 
00250 #define MVO_LEFT_CONTROL 1<<10
00251 
00253 #define MVO_LEFT_SHIFT 1<<11
00254 
00256 #define MVO_LEFT_ALT 1<<12
00257 
00259 #define MVO_LEFT_ARROW     1<<13
00260 
00262 #define MVO_UP_ARROW       1<<14
00263 
00265 #define MVO_RIGHT_ARROW    1<<15
00266 
00268 #define MVO_DOWN_ARROW     1<<16
00269 
00271 #define MVO_JOYSTICK_BUTTON_1 1<<17
00272     
00274 #define MVO_JOYSTICK_BUTTON_2 1<<18
00275 
00277 #define MVO_JOYSTICK_BUTTON_3 1<<19
00278 
00280 #define MVO_JOYSTICK_BUTTON_4 1<<20
00281     
00283 #define MVO_JOYSTICK_BUTTON_5 1<<21
00284     
00286 #define MVO_JOYSTICK_BUTTON_6 1<<22
00287     
00289 #define MVO_JOYSTICK_BUTTON_7 1<<23
00290     
00292 #define MVO_JOYSTICK_BUTTON_8 1<<24
00293 
00294     
00295     static const int  MAX_TOUCHES = 10; 
00296 
00297     
00298     bool Control() const    { return (m_flags & MVO_CONTROL) != 0; } 
00299     bool Shift() const  { return (m_flags & MVO_SHIFT) != 0; } 
00300     bool Alt() const    { return (m_flags & MVO_ALT) != 0; } 
00301     bool LeftAlt() const    { return (m_flags & MVO_LEFT_ALT) != 0; } 
00302     bool LeftControl() const { return (m_flags & MVO_LEFT_CONTROL) != 0; } 
00303     bool LeftShift() const  { return (m_flags & MVO_LEFT_SHIFT) != 0; } 
00304     bool RightAlt() const   { return (m_flags & MVO_RIGHT_ALT) != 0; } 
00305     bool RightControl() const { return (m_flags & MVO_RIGHT_CONTROL) != 0; } 
00306     bool RightShift() const { return (m_flags & MVO_RIGHT_SHIFT) != 0; } 
00307     bool LButton() const    { return (m_flags & MVO_LBUTTON) != 0; } 
00308     bool MButton() const    { return (m_flags & MVO_MBUTTON) != 0; } 
00309     bool RButton() const    { return (m_flags & MVO_RBUTTON) != 0; } 
00310     bool LeftArrow() const  { return (m_flags & MVO_LEFT_ARROW) != 0; } 
00311     bool UpArrow() const    { return (m_flags & MVO_UP_ARROW) != 0; } 
00312     bool RightArrow() const { return (m_flags & MVO_RIGHT_ARROW) != 0; } 
00313     bool DownArrow() const  { return (m_flags & MVO_DOWN_ARROW) != 0; } 
00315     // Get/Set routines
00316     HBaseView* GetView() const { return m_pView; }  
00318     const HPoint& GetMousePixelPos() const { return m_ptPixel; }        
00319     const HPoint& GetMouseWindowPos() const { return m_ptWindow; }      
00320     const HPoint& GetMouseWorldPos() const { return m_ptWorld; }        
00321     const HPoint& GetMouseViewpointPos() const { return m_ptViewpoint; }
00322     const HPoint& GetJoystickRotation() const { return m_ptWorld; }     
00323     const HPoint& GetJoystickTranslation() const { return m_ptWorld; }      
00326     unsigned int GetChar () const { return m_Char; };   
00327                 
00328     unsigned int GetCharRepCount () const { return m_RepCount; }    
00329     unsigned int GetTimerId () const {return m_TimerId; }           
00335     unsigned int GetFlags() const { return m_flags; }
00336 
00337 
00338     // EventInfo Initialization
00339     void SetType(HEventType NewType) { m_EventType = NewType; } 
00343     HEventType GetType() const { return m_EventType; }
00344 
00354     void SetPoint(HEventType NewType, int x, int y, unsigned int NewFlags); 
00355     
00356 
00365     void SetPixelPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags);
00366 
00367 
00368 //for some reason this is unresolved when the csharp/c module links
00377     void SetWindowPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags); 
00378 
00379 
00388     void SetWorldPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags);
00389 
00390 
00398     void SetViewpointPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags);
00399 
00400 
00409     void SetKey(HEventType NewType, unsigned int nChar, unsigned int nRepCnt, unsigned int NewFlags);
00410 
00416     void SetTimer(HEventType NewType, unsigned int nIDEvent);
00417 
00422     void SetMouseWheelDelta(int NewWheelDelta);
00423 
00429     void SetFlags(int flags){
00430         m_flags = flags;
00431     }
00432 
00436     int GetMouseWheelDelta() const { return m_WheelDelta; }
00437     
00438     
00439      
00440 
00441 private:
00442     int  m_WheelDelta;
00443     HPoint m_ptPixel; // Mouse position in windows pixel space
00444     HPoint m_ptWindow; // Mouse position in HOOPS "outer window space"
00445     HPoint m_ptWorld; // Mouse position in HOOPS world space
00446     HPoint m_ptViewpoint; // Mouse position in HOOPS world space
00447         
00448     unsigned int m_Char; // character from keyboard event
00449     unsigned int m_RepCount; // number of times key press event was repeated
00450     unsigned int m_TimerId; // Id number of the timer generated by the UI
00451 
00452     float m_time; // System time of event   
00453     unsigned int m_flags; // Flags indicating which mouse buttons are pressed 
00454             // and if the "shift" and "control" keyboard keys are pressed
00455 
00456     HEventType m_EventType; // Type of event
00457     HBaseView* m_pView; // view associated with this event
00458     
00459 };
00460 
00461 
00462 #ifdef H_PACK_8
00463 #pragma pack(pop)
00464 #endif
00465 
00466 #endif
00467 
00468 
00469