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: ebc052cc1d2794aeda73cdda0f74ef7c4212aa9c $
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 
00082 
00084 
00087 class MVO_API HTouchInfo
00088 {
00089 public:
00099     HTouchInfo(float x, float y, float timestamp, int taps, int ident, bool active = true)
00100     {
00101         
00102         Init(x,y,timestamp,taps,ident,active);
00103     }
00105     HTouchInfo()
00106     {
00107     }
00108     
00117     void Init(float x = 0.0f, float y = 0.0f, float timestamp = 0.0f, int taps = 0, int ident = 0, bool active = true)
00118     {
00119         m_x=x;
00120         m_y=y;
00121         m_timestamp = timestamp;
00122         m_taps = taps;
00123         m_id  = ident;
00124         m_bActive = active;
00125         
00126     }
00127     
00128     float m_x;                      
00129     float m_y;                      
00130     float m_timestamp;              
00131     int m_taps;                     
00132     bool m_bActive;                 
00133     MVO_POINTER_SIZED_UINT m_id;    
00134 };
00135 
00136 
00137 
00139 
00142 class MVO_API HTouchManager
00143 {
00144 public:
00146     HTouchManager();
00148     ~HTouchManager();
00149     
00160     HTouchInfo *AddTouch(float x, float y, float timestamp, int taps, MVO_POINTER_SIZED_UINT ident);
00166     void ClearTouchActivity();
00167     
00168     void ClearTouches();
00169 
00170 
00176     bool RemoveTouch(MVO_POINTER_SIZED_UINT ident);
00177 
00179     int GetActiveTouchCount() { return m_ActiveTouches; }
00181     int GetTouchCount();
00182      
00190     int GetTouches(HTouchInfo **touches, int maxtouches, bool activeOnly = false);
00191     
00198     HTouchInfo *GetTouch(int index, bool activeOnly = false);
00199 
00200 private:
00201     int m_ActiveTouches;
00202     vlist_s *m_TouchList;
00203  };
00204 
00205 
00207 
00214 class MVO_API HEventInfo 
00215 {
00216 
00217 public:
00218 
00221     HEventInfo(HBaseView *view); 
00222     
00224 #define MVO_CONTROL 1<<1
00225 
00227 #define MVO_SHIFT 1<<2
00228 
00230 #define MVO_ALT 1<<3
00231 
00233 #define MVO_LBUTTON 1<<4
00234 
00236 #define MVO_MBUTTON  1<<5
00237 
00239 #define MVO_RBUTTON 1<<6
00240 
00242 #define MVO_RIGHT_CONTROL 1<<7
00243 
00245 #define MVO_RIGHT_SHIFT 1<<8
00246 
00248 #define MVO_RIGHT_ALT 1<<9
00249 
00251 #define MVO_LEFT_CONTROL 1<<10
00252 
00254 #define MVO_LEFT_SHIFT 1<<11
00255 
00257 #define MVO_LEFT_ALT 1<<12
00258 
00260 #define MVO_LEFT_ARROW     1<<13
00261 
00263 #define MVO_UP_ARROW       1<<14
00264 
00266 #define MVO_RIGHT_ARROW    1<<15
00267 
00269 #define MVO_DOWN_ARROW     1<<16
00270 
00272 #define MVO_JOYSTICK_BUTTON_1 1<<17
00273     
00275 #define MVO_JOYSTICK_BUTTON_2 1<<18
00276 
00278 #define MVO_JOYSTICK_BUTTON_3 1<<19
00279 
00281 #define MVO_JOYSTICK_BUTTON_4 1<<20
00282     
00284 #define MVO_JOYSTICK_BUTTON_5 1<<21
00285     
00287 #define MVO_JOYSTICK_BUTTON_6 1<<22
00288     
00290 #define MVO_JOYSTICK_BUTTON_7 1<<23
00291     
00293 #define MVO_JOYSTICK_BUTTON_8 1<<24
00294 
00295     
00296     static const int  MAX_TOUCHES = 10; 
00297 
00298     
00299     bool Control() const    { return(m_flags & MVO_CONTROL) != 0; } 
00300     bool Shift() const  { return(m_flags & MVO_SHIFT) != 0; } 
00301     bool Alt() const    { return(m_flags & MVO_ALT) != 0; } 
00302     bool LeftAlt() const    { return(m_flags & MVO_LEFT_ALT) != 0; } 
00303     bool LeftControl() const { return(m_flags & MVO_LEFT_CONTROL) != 0; } 
00304     bool LeftShift() const  { return(m_flags & MVO_LEFT_SHIFT) != 0; } 
00305     bool RightAlt() const   { return(m_flags & MVO_RIGHT_ALT) != 0; } 
00306     bool RightControl() const { return(m_flags & MVO_RIGHT_CONTROL) != 0; } 
00307     bool RightShift() const { return(m_flags & MVO_RIGHT_SHIFT) != 0; } 
00308     bool LButton() const    { return(m_flags & MVO_LBUTTON) != 0; } 
00309     bool MButton() const    { return(m_flags & MVO_MBUTTON) != 0; } 
00310     bool RButton() const    { return(m_flags & MVO_RBUTTON) != 0; } 
00311     bool LeftArrow() const  { return(m_flags & MVO_LEFT_ARROW) != 0; } 
00312     bool UpArrow() const    { return(m_flags & MVO_UP_ARROW) != 0; } 
00313     bool RightArrow() const { return(m_flags & MVO_RIGHT_ARROW) != 0; } 
00314     bool DownArrow() const  { return(m_flags & MVO_DOWN_ARROW) != 0; } 
00316     // Get/Set routines
00317     HBaseView* GetView( void ) const { return m_pView; }    
00319     const HPoint& GetMousePixelPos( void ) const { return m_ptPixel; }      
00320     const HPoint& GetMouseWindowPos( void ) const { return m_ptWindow; }        
00321     const HPoint& GetMouseWorldPos( void ) const { return m_ptWorld; }      
00322     const HPoint& GetMouseViewpointPos( void ) const { return m_ptViewpoint; }
00323     const HPoint& GetJoystickRotation( void ) const { return m_ptWorld; }       
00324     const HPoint& GetJoystickTranslation( void ) const { return m_ptWorld; }        
00327     unsigned int GetChar (void) const { return m_Char; };   
00328                 
00329     unsigned int GetCharRepCount (void) const { return m_RepCount; }    
00330     unsigned int GetTimerId (void) const {return m_TimerId; }           
00336     unsigned int GetFlags( void ) const { return m_flags; }
00337 
00338 
00339     // EventInfo Initialization
00340     void SetType(HEventType NewType) { m_EventType = NewType; } 
00344     HEventType GetType() const { return m_EventType; }
00345 
00355     void SetPoint(HEventType NewType, int x, int y, unsigned int NewFlags); 
00356     
00357 
00366     void SetPixelPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags);
00367 
00368 
00369 //for some reason this is unresolved when the csharp/c module links
00378     void SetWindowPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags); 
00379 
00380 
00389     void SetWorldPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags);
00390 
00391 
00399     void SetViewpointPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags);
00400 
00401 
00410     void SetKey(HEventType NewType, unsigned int nChar, unsigned int nRepCnt, unsigned int NewFlags);
00411 
00417     void SetTimer(HEventType NewType, unsigned int nIDEvent);
00418 
00423     void SetMouseWheelDelta(int NewWheelDelta);
00424 
00430     void SetFlags(int flags){
00431         m_flags = flags;
00432     }
00433 
00437     int GetMouseWheelDelta() const { return m_WheelDelta; }
00438     
00439     
00440      
00441 
00442 private:
00443     int  m_WheelDelta;
00444     HPoint m_ptPixel; // Mouse position in windows pixel space
00445     HPoint m_ptWindow; // Mouse position in HOOPS "outer window space"
00446     HPoint m_ptWorld; // Mouse position in HOOPS world space
00447     HPoint m_ptViewpoint; // Mouse position in HOOPS world space
00448         
00449     unsigned int m_Char; // character from keyboard event
00450     unsigned int m_RepCount; // number of times key press event was repeated
00451     unsigned int m_TimerId; // Id number of the timer generated by the UI
00452 
00453     float m_time; // System time of event   
00454     unsigned int m_flags; // Flags indicating which mouse buttons are pressed 
00455             // and if the "shift" and "control" keyboard keys are pressed
00456 
00457     HEventType m_EventType; // Type of event
00458     HBaseView* m_pView; // view associated with this event
00459     
00460 };
00461 
00462 
00463 #ifdef H_PACK_8
00464 #pragma pack(pop)
00465 #endif
00466 
00467 #endif
00468 
00469 
00470