Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HEventInfo.h
Go to the documentation of this file.
00001 // Copyright (c) 1998-2014 by Tech Soft 3D, Inc.
00002 //
00003 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc.,
00004 // and considered a trade secret as defined under civil and criminal statutes.
00005 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of
00006 // unauthorized use or misappropriation of its trade secrets.  Use of this information
00007 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under
00008 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use.
00009 
00011 
00017 #ifndef _HEVENTINFO_H
00018 #define _HEVENTINFO_H
00019 
00020 #ifdef H_PACK_8
00021 #pragma pack(push)
00022 #pragma pack(8)
00023 #endif
00024 
00025 #include "HTools.h"
00026 #include "HUtility.h"
00027 
00028 class HBaseView;
00029 
00033 enum HEventType 
00034 {
00035     HE_NoEvent,        
00036 
00037     HE_LButtonDown,    
00038     HE_LButtonUp,      
00039     HE_LButtonDblClk,  
00040 
00041     HE_MButtonDown,    
00042     HE_MButtonUp,      
00043     HE_MButtonDblClk,  
00044 
00045     HE_RButtonDown,    
00046     HE_RButtonUp,      
00047     HE_RButtonDblClk,  
00048 
00049     HE_MouseMove,      
00050 
00051     HE_MouseWheel,     
00052     HE_MouseWheelUp,   
00053     HE_MouseWheelDown, 
00054     
00055     HE_Timer,          
00056 
00057     HE_KeyDown,        
00058     HE_KeyUp,          
00059 
00060     // Higher level
00061     HE_Selection,       
00062 
00063     HE_JoyStickTranslate, 
00064     HE_JoyStickRotate, 
00065     HE_JoyStickButton, 
00066 
00067     HE_TouchesDown,    
00068     HE_TouchesUp,      
00069     HE_TouchesMove  
00070 
00071 };
00072 
00073 
00074 
00075 
00077 
00080 class MVO_API HTouchInfo
00081 {
00082 public:
00092     HTouchInfo(float x, float y, float timestamp, int taps, MVO_POINTER_SIZED_UINT ident, bool active = true)
00093     {
00094         
00095         Init(x,y,timestamp,taps,ident,active);
00096     }
00098     HTouchInfo()
00099     {
00100     }
00101     
00110     void Init(float x = 0.0f, float y = 0.0f, float timestamp = 0.0f, int taps = 0, MVO_POINTER_SIZED_UINT ident = 0, bool active = true)
00111     {
00112         m_x=x;
00113         m_y=y;
00114         m_timestamp = timestamp;
00115         m_taps = taps;
00116         m_id  = ident;
00117         m_bActive = active;
00118         
00119     }
00120     
00121     float m_x;                      
00122     float m_y;                      
00123     float m_timestamp;              
00124     int m_taps;                     
00125     bool m_bActive;                 
00126     MVO_POINTER_SIZED_UINT m_id;    
00127 };
00128 
00129 
00130 
00132 
00135 class MVO_API HTouchManager
00136 {
00137 public:
00139     HTouchManager();
00141     ~HTouchManager();
00142     
00153     HTouchInfo *AddTouch(float x, float y, float timestamp, int taps, MVO_POINTER_SIZED_UINT ident);
00159     void ClearTouchActivity();
00160     
00161     void ClearTouches();
00162 
00163 
00169     bool RemoveTouch(MVO_POINTER_SIZED_UINT ident);
00170 
00172     int GetActiveTouchCount() { return m_ActiveTouches; }
00174     int GetTouchCount();
00175      
00183     int GetTouches(HTouchInfo **touches, int maxtouches, bool activeOnly = false);
00184     
00191     HTouchInfo *GetTouch(int index, bool activeOnly = false);
00192 
00193 private:
00194     unsigned int m_ActiveTouches;
00195     vlist_s *m_TouchList;
00196  };
00197 
00198 
00200 
00207 class MVO_API HEventInfo 
00208 {
00209 
00210 public:
00211 
00214     HEventInfo(HBaseView *view); 
00215     
00217 #define MVO_CONTROL 1<<1
00218 
00220 #define MVO_SHIFT 1<<2
00221 
00223 #define MVO_ALT 1<<3
00224 
00226 #define MVO_LBUTTON 1<<4
00227 
00229 #define MVO_MBUTTON  1<<5
00230 
00232 #define MVO_RBUTTON 1<<6
00233 
00235 #define MVO_RIGHT_CONTROL 1<<7
00236 
00238 #define MVO_RIGHT_SHIFT 1<<8
00239 
00241 #define MVO_RIGHT_ALT 1<<9
00242 
00244 #define MVO_LEFT_CONTROL 1<<10
00245 
00247 #define MVO_LEFT_SHIFT 1<<11
00248 
00250 #define MVO_LEFT_ALT 1<<12
00251 
00253 #define MVO_LEFT_ARROW     1<<13
00254 
00256 #define MVO_UP_ARROW       1<<14
00257 
00259 #define MVO_RIGHT_ARROW    1<<15
00260 
00262 #define MVO_DOWN_ARROW     1<<16
00263 
00265 #define MVO_JOYSTICK_BUTTON_1 1<<17
00266     
00268 #define MVO_JOYSTICK_BUTTON_2 1<<18
00269 
00271 #define MVO_JOYSTICK_BUTTON_3 1<<19
00272 
00274 #define MVO_JOYSTICK_BUTTON_4 1<<20
00275     
00277 #define MVO_JOYSTICK_BUTTON_5 1<<21
00278     
00280 #define MVO_JOYSTICK_BUTTON_6 1<<22
00281     
00283 #define MVO_JOYSTICK_BUTTON_7 1<<23
00284     
00286 #define MVO_JOYSTICK_BUTTON_8 1<<24
00287 
00288     
00289     static const int  MAX_TOUCHES = 10; 
00290 
00291     
00292     bool Control() const    { return (m_flags & MVO_CONTROL) != 0; } 
00293     bool Shift() const  { return (m_flags & MVO_SHIFT) != 0; } 
00294     bool Alt() const    { return (m_flags & MVO_ALT) != 0; } 
00295     bool LeftAlt() const    { return (m_flags & MVO_LEFT_ALT) != 0; } 
00296     bool LeftControl() const { return (m_flags & MVO_LEFT_CONTROL) != 0; } 
00297     bool LeftShift() const  { return (m_flags & MVO_LEFT_SHIFT) != 0; } 
00298     bool RightAlt() const   { return (m_flags & MVO_RIGHT_ALT) != 0; } 
00299     bool RightControl() const { return (m_flags & MVO_RIGHT_CONTROL) != 0; } 
00300     bool RightShift() const { return (m_flags & MVO_RIGHT_SHIFT) != 0; } 
00301     bool LButton() const    { return (m_flags & MVO_LBUTTON) != 0; } 
00302     bool MButton() const    { return (m_flags & MVO_MBUTTON) != 0; } 
00303     bool RButton() const    { return (m_flags & MVO_RBUTTON) != 0; } 
00304     bool LeftArrow() const  { return (m_flags & MVO_LEFT_ARROW) != 0; } 
00305     bool UpArrow() const    { return (m_flags & MVO_UP_ARROW) != 0; } 
00306     bool RightArrow() const { return (m_flags & MVO_RIGHT_ARROW) != 0; } 
00307     bool DownArrow() const  { return (m_flags & MVO_DOWN_ARROW) != 0; } 
00309     // Get/Set routines
00310     HBaseView* GetView() const { return m_pView; }  
00312     const HPoint& GetMousePixelPos() const { return m_ptPixel; }        
00313     const HPoint& GetMouseWindowPos() const { return m_ptWindow; }      
00314     const HPoint& GetMouseWorldPos() const { return m_ptWorld; }        
00315     const HPoint& GetMouseViewpointPos() const { return m_ptViewpoint; }
00316     const HPoint& GetJoystickRotation() const { return m_ptWorld; }     
00317     const HPoint& GetJoystickTranslation() const { return m_ptWorld; }      
00320     unsigned int GetChar () const { return m_Char; };   
00321                 
00322     unsigned int GetCharRepCount () const { return m_RepCount; }    
00323     unsigned int GetTimerId () const {return m_TimerId; }           
00329     unsigned int GetFlags() const { return m_flags; }
00330 
00331 
00332     // EventInfo Initialization
00333     void SetType(HEventType NewType) { m_EventType = NewType; } 
00337     HEventType GetType() const { return m_EventType; }
00338 
00348     void SetPoint(HEventType NewType, int x, int y, unsigned int NewFlags); 
00349     
00350 
00359     void SetPixelPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags);
00360 
00361 
00362 //for some reason this is unresolved when the csharp/c module links
00371     void SetWindowPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags); 
00372 
00373 
00382     void SetWorldPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags);
00383 
00384 
00392     void SetViewpointPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags);
00393 
00394 
00403     void SetKey(HEventType NewType, unsigned int nChar, unsigned int nRepCnt, unsigned int NewFlags);
00404 
00410     void SetTimer(HEventType NewType, unsigned int nIDEvent);
00411 
00416     void SetMouseWheelDelta(int NewWheelDelta);
00417 
00423     void SetFlags(int flags){
00424         m_flags = flags;
00425     }
00426 
00430     int GetMouseWheelDelta() const { return m_WheelDelta; }
00431     
00432     
00433      
00434 
00435 private:
00436     int  m_WheelDelta;
00437     HPoint m_ptPixel; // Mouse position in windows pixel space
00438     HPoint m_ptWindow; // Mouse position in HOOPS "outer window space"
00439     HPoint m_ptWorld; // Mouse position in HOOPS world space
00440     HPoint m_ptViewpoint; // Mouse position in HOOPS world space
00441         
00442     unsigned int m_Char; // character from keyboard event
00443     unsigned int m_RepCount; // number of times key press event was repeated
00444     unsigned int m_TimerId; // Id number of the timer generated by the UI
00445 
00446     float m_time; // System time of event   
00447     unsigned int m_flags; // Flags indicating which mouse buttons are pressed 
00448             // and if the "shift" and "control" keyboard keys are pressed
00449 
00450     HEventType m_EventType; // Type of event
00451     HBaseView* m_pView; // view associated with this event
00452     
00453 };
00454 
00455 
00456 #ifdef H_PACK_8
00457 #pragma pack(pop)
00458 #endif
00459 
00460 #endif
00461 
00462 
00463