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: 4e7b93916605b62ab0d8d35b1f4660c3f74afcc8 $
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 m_ActiveOnly = false);
00191     
00192     
00193 private:
00194     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( void ) const { return m_pView; }    
00312     const HPoint& GetMousePixelPos( void ) const { return m_ptPixel; }      
00313     const HPoint& GetMouseWindowPos( void ) const { return m_ptWindow; }        
00314     const HPoint& GetMouseWorldPos( void ) const { return m_ptWorld; }      
00315     const HPoint& GetMouseViewpointPos( void ) const { return m_ptViewpoint; }
00316     const HPoint& GetJoystickRotation( void ) const { return m_ptWorld; }       
00317     const HPoint& GetJoystickTranslation( void ) const { return m_ptWorld; }        
00320     unsigned int GetChar (void) const { return m_Char; };   
00321                 
00322     unsigned int GetCharRepCount (void) const { return m_RepCount; }    
00323     unsigned int GetTimerId (void) const {return m_TimerId; }           
00329     unsigned int GetFlags( void ) 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