Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HEventInfo.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2000 by Tech Soft 3D, LLC.
3 // The information contained herein is confidential and proprietary to
4 // Tech Soft 3D, LLC., and considered a trade secret as defined under
5 // civil and criminal statutes. Tech Soft 3D shall pursue its civil
6 // and criminal remedies in the event of unauthorized use or misappropriation
7 // of its trade secrets. Use of this information by anyone other than
8 // authorized employees of Tech Soft 3D, LLC. is granted only under a
9 // written non-disclosure agreement, expressly prescribing the scope and
10 // manner of such use.
11 //
12 // $Id: ebc052cc1d2794aeda73cdda0f74ef7c4212aa9c $
13 //
14 
15 
17 
23 #ifndef _HEVENTINFO_H
24 #define _HEVENTINFO_H
25 
26 #ifdef H_PACK_8
27 #pragma pack(push)
28 #pragma pack(8)
29 #endif
30 
31 #include "HTools.h"
32 #include "HUtility.h"
33 
34 class HBaseView;
35 
40 {
42 
46 
50 
54 
56 
60 
62 
65 
66  // Higher level
68 
72 
76 
77 
78 };
79 
80 
81 
82 
84 
87 class MVO_API HTouchInfo
88 {
89 public:
99  HTouchInfo(float x, float y, float timestamp, int taps, int ident, bool active = true)
100  {
101 
102  Init(x,y,timestamp,taps,ident,active);
103  }
106  {
107  }
108 
117  void Init(float x = 0.0f, float y = 0.0f, float timestamp = 0.0f, int taps = 0, int ident = 0, bool active = true)
118  {
119  m_x=x;
120  m_y=y;
121  m_timestamp = timestamp;
122  m_taps = taps;
123  m_id = ident;
124  m_bActive = active;
125 
126  }
127 
128  float m_x;
129  float m_y;
130  float m_timestamp;
131  int m_taps;
132  bool m_bActive;
133  MVO_POINTER_SIZED_UINT m_id;
134 };
135 
136 
137 
139 
142 class MVO_API HTouchManager
143 {
144 public:
146  HTouchManager();
148  ~HTouchManager();
149 
160  HTouchInfo *AddTouch(float x, float y, float timestamp, int taps, MVO_POINTER_SIZED_UINT ident);
166  void ClearTouchActivity();
167 
168  void ClearTouches();
169 
170 
176  bool RemoveTouch(MVO_POINTER_SIZED_UINT ident);
177 
179  int GetActiveTouchCount() { return m_ActiveTouches; }
181  int GetTouchCount();
182 
190  int GetTouches(HTouchInfo **touches, int maxtouches, bool activeOnly = false);
191 
198  HTouchInfo *GetTouch(int index, bool activeOnly = false);
199 
200 private:
201  int m_ActiveTouches;
202  vlist_s *m_TouchList;
203  };
204 
205 
207 
214 class MVO_API HEventInfo
215 {
216 
217 public:
218 
221  HEventInfo(HBaseView *view);
222 
224 #define MVO_CONTROL 1<<1
225 
227 #define MVO_SHIFT 1<<2
228 
230 #define MVO_ALT 1<<3
231 
233 #define MVO_LBUTTON 1<<4
234 
236 #define MVO_MBUTTON 1<<5
237 
239 #define MVO_RBUTTON 1<<6
240 
242 #define MVO_RIGHT_CONTROL 1<<7
243 
245 #define MVO_RIGHT_SHIFT 1<<8
246 
248 #define MVO_RIGHT_ALT 1<<9
249 
251 #define MVO_LEFT_CONTROL 1<<10
252 
254 #define MVO_LEFT_SHIFT 1<<11
255 
257 #define MVO_LEFT_ALT 1<<12
258 
260 #define MVO_LEFT_ARROW 1<<13
261 
263 #define MVO_UP_ARROW 1<<14
264 
266 #define MVO_RIGHT_ARROW 1<<15
267 
269 #define MVO_DOWN_ARROW 1<<16
270 
272 #define MVO_JOYSTICK_BUTTON_1 1<<17
273 
275 #define MVO_JOYSTICK_BUTTON_2 1<<18
276 
278 #define MVO_JOYSTICK_BUTTON_3 1<<19
279 
281 #define MVO_JOYSTICK_BUTTON_4 1<<20
282 
284 #define MVO_JOYSTICK_BUTTON_5 1<<21
285 
287 #define MVO_JOYSTICK_BUTTON_6 1<<22
288 
290 #define MVO_JOYSTICK_BUTTON_7 1<<23
291 
293 #define MVO_JOYSTICK_BUTTON_8 1<<24
294 
295 
296  static const int MAX_TOUCHES = 10;
297 
298 
299  bool Control() const { return(m_flags & MVO_CONTROL) != 0; }
300  bool Shift() const { return(m_flags & MVO_SHIFT) != 0; }
301  bool Alt() const { return(m_flags & MVO_ALT) != 0; }
302  bool LeftAlt() const { return(m_flags & MVO_LEFT_ALT) != 0; }
303  bool LeftControl() const { return(m_flags & MVO_LEFT_CONTROL) != 0; }
304  bool LeftShift() const { return(m_flags & MVO_LEFT_SHIFT) != 0; }
305  bool RightAlt() const { return(m_flags & MVO_RIGHT_ALT) != 0; }
306  bool RightControl() const { return(m_flags & MVO_RIGHT_CONTROL) != 0; }
307  bool RightShift() const { return(m_flags & MVO_RIGHT_SHIFT) != 0; }
308  bool LButton() const { return(m_flags & MVO_LBUTTON) != 0; }
309  bool MButton() const { return(m_flags & MVO_MBUTTON) != 0; }
310  bool RButton() const { return(m_flags & MVO_RBUTTON) != 0; }
311  bool LeftArrow() const { return(m_flags & MVO_LEFT_ARROW) != 0; }
312  bool UpArrow() const { return(m_flags & MVO_UP_ARROW) != 0; }
313  bool RightArrow() const { return(m_flags & MVO_RIGHT_ARROW) != 0; }
314  bool DownArrow() const { return(m_flags & MVO_DOWN_ARROW) != 0; }
316  // Get/Set routines
317  HBaseView* GetView( void ) const { return m_pView; }
319  const HPoint& GetMousePixelPos( void ) const { return m_ptPixel; }
320  const HPoint& GetMouseWindowPos( void ) const { return m_ptWindow; }
321  const HPoint& GetMouseWorldPos( void ) const { return m_ptWorld; }
322  const HPoint& GetMouseViewpointPos( void ) const { return m_ptViewpoint; }
323  const HPoint& GetJoystickRotation( void ) const { return m_ptWorld; }
324  const HPoint& GetJoystickTranslation( void ) const { return m_ptWorld; }
327  unsigned int GetChar (void) const { return m_Char; };
328 
329  unsigned int GetCharRepCount (void) const { return m_RepCount; }
330  unsigned int GetTimerId (void) const {return m_TimerId; }
336  unsigned int GetFlags( void ) const { return m_flags; }
337 
338 
339  // EventInfo Initialization
340  void SetType(HEventType NewType) { m_EventType = NewType; }
344  HEventType GetType() const { return m_EventType; }
345 
355  void SetPoint(HEventType NewType, int x, int y, unsigned int NewFlags);
356 
357 
366  void SetPixelPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags);
367 
368 
369 //for some reason this is unresolved when the csharp/c module links
378  void SetWindowPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags);
379 
380 
389  void SetWorldPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags);
390 
391 
399  void SetViewpointPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags);
400 
401 
410  void SetKey(HEventType NewType, unsigned int nChar, unsigned int nRepCnt, unsigned int NewFlags);
411 
417  void SetTimer(HEventType NewType, unsigned int nIDEvent);
418 
423  void SetMouseWheelDelta(int NewWheelDelta);
424 
430  void SetFlags(int flags){
431  m_flags = flags;
432  }
433 
437  int GetMouseWheelDelta() const { return m_WheelDelta; }
438 
439 
440 
441 
442 private:
443  int m_WheelDelta;
444  HPoint m_ptPixel; // Mouse position in windows pixel space
445  HPoint m_ptWindow; // Mouse position in HOOPS "outer window space"
446  HPoint m_ptWorld; // Mouse position in HOOPS world space
447  HPoint m_ptViewpoint; // Mouse position in HOOPS world space
448 
449  unsigned int m_Char; // character from keyboard event
450  unsigned int m_RepCount; // number of times key press event was repeated
451  unsigned int m_TimerId; // Id number of the timer generated by the UI
452 
453  float m_time; // System time of event
454  unsigned int m_flags; // Flags indicating which mouse buttons are pressed
455  // and if the "shift" and "control" keyboard keys are pressed
456 
457  HEventType m_EventType; // Type of event
458  HBaseView* m_pView; // view associated with this event
459 
460 };
461 
462 
463 #ifdef H_PACK_8
464 #pragma pack(pop)
465 #endif
466 
467 #endif
468 
469 
470 
bool RightAlt() const
Definition: HEventInfo.h:305
bool RButton() const
Definition: HEventInfo.h:310
float m_timestamp
Definition: HEventInfo.h:130
The middle mouse button is up.
Definition: HEventInfo.h:48
unsigned int GetFlags(void) const
Definition: HEventInfo.h:336
unsigned int GetChar(void) const
Definition: HEventInfo.h:327
float m_y
Definition: HEventInfo.h:129
The left mouse button was double-clicked.
Definition: HEventInfo.h:45
unsigned int GetTimerId(void) const
Definition: HEventInfo.h:330
bool LeftControl() const
Definition: HEventInfo.h:303
void Init(float x=0.0f, float y=0.0f, float timestamp=0.0f, int taps=0, int ident=0, bool active=true)
Definition: HEventInfo.h:117
The mouse wheel has moved.
Definition: HEventInfo.h:57
The mouse cursor has moved.
Definition: HEventInfo.h:55
bool LeftShift() const
Definition: HEventInfo.h:304
int GetActiveTouchCount()
Definition: HEventInfo.h:179
A set of Rotation values from a 3D Mouse/Joystick.
Definition: HEventInfo.h:70
The left mouse button is up.
Definition: HEventInfo.h:44
bool RightControl() const
Definition: HEventInfo.h:306
self-explanatory
Definition: HEventInfo.h:61
bool m_bActive
Definition: HEventInfo.h:132
A touch down event has occured.
Definition: HEventInfo.h:73
void SetType(HEventType NewType)
Definition: HEventInfo.h:340
bool LeftAlt() const
Definition: HEventInfo.h:302
bool MButton() const
Definition: HEventInfo.h:309
No event ooccurred.
Definition: HEventInfo.h:41
bool UpArrow() const
Definition: HEventInfo.h:312
bool Control() const
Definition: HEventInfo.h:299
The left mouse button was pressed.
Definition: HEventInfo.h:43
const HPoint & GetJoystickTranslation(void) const
Definition: HEventInfo.h:324
The middle mouse button was pressed.
Definition: HEventInfo.h:47
The mouse wheel was scrolled down.
Definition: HEventInfo.h:59
int GetMouseWheelDelta() const
Definition: HEventInfo.h:437
The right mouse button was double-clicked.
Definition: HEventInfo.h:53
HTouchInfo()
Definition: HEventInfo.h:105
The right mouse button is up.
Definition: HEventInfo.h:52
bool Shift() const
Definition: HEventInfo.h:300
unsigned int GetCharRepCount(void) const
Definition: HEventInfo.h:329
bool RightShift() const
Definition: HEventInfo.h:307
int m_taps
Definition: HEventInfo.h:131
The HPoint class is the data type of a three-dimensional point.
Definition: HGlobals.h:126
float m_x
Definition: HEventInfo.h:128
A key on the keyboard was pressed.
Definition: HEventInfo.h:63
The HBaseView class defines and manages a view of model information.
Definition: HBaseView.h:337
The HTouchInfo class encapsulates touch events.
Definition: HEventInfo.h:87
A general selection event.
Definition: HEventInfo.h:67
bool LeftArrow() const
Definition: HEventInfo.h:311
A key on the keyboard was released.
Definition: HEventInfo.h:64
bool LButton() const
Definition: HEventInfo.h:308
const HPoint & GetMousePixelPos(void) const
Definition: HEventInfo.h:319
const HPoint & GetMouseViewpointPos(void) const
Definition: HEventInfo.h:322
const HPoint & GetMouseWorldPos(void) const
Definition: HEventInfo.h:321
The right mouse button was pressed.
Definition: HEventInfo.h:51
The HEventInfo class stores and manages event information.
Definition: HEventInfo.h:214
The mouse wheel was scrolled up.
Definition: HEventInfo.h:58
bool Alt() const
Definition: HEventInfo.h:301
HEventType GetType() const
Definition: HEventInfo.h:344
A touch up event has occured.
Definition: HEventInfo.h:74
void SetFlags(int flags)
Definition: HEventInfo.h:430
The middle mouse button was double-clicked.
Definition: HEventInfo.h:49
HEventType
Definition: HEventInfo.h:39
The HTouchManager class stores and manages touch input.
Definition: HEventInfo.h:142
const HPoint & GetMouseWindowPos(void) const
Definition: HEventInfo.h:320
A button press from a 3D Mouse/Joystick.
Definition: HEventInfo.h:71
MVO_POINTER_SIZED_UINT m_id
Definition: HEventInfo.h:133
HTouchInfo(float x, float y, float timestamp, int taps, int ident, bool active=true)
Definition: HEventInfo.h:99
A touch move event has occured.
Definition: HEventInfo.h:75
bool DownArrow() const
Definition: HEventInfo.h:314
HBaseView * GetView(void) const
Definition: HEventInfo.h:317
A 3D Translation vector from a 3D Mouse/Joystick.
Definition: HEventInfo.h:69
bool RightArrow() const
Definition: HEventInfo.h:313
const HPoint & GetJoystickRotation(void) const
Definition: HEventInfo.h:323