HEventInfo.h
Go to the documentation of this file.
1 // Copyright (c) Tech Soft 3D, Inc.
2 //
3 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc.,
4 // and considered a trade secret as defined under civil and criminal statutes.
5 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of
6 // unauthorized use or misappropriation of its trade secrets. Use of this information
7 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under
8 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use.
9 
11 
17 #ifndef _HEVENTINFO_H
18 #define _HEVENTINFO_H
19 
20 #ifdef H_PACK_8
21 #pragma pack(push)
22 #pragma pack(8)
23 #endif
24 
25 #include "HTools.h"
26 #include "HUtility.h"
27 
28 class HBaseView;
29 
34 {
36 
40 
44 
48 
50 
54 
56 
59 
60  // Higher level
62 
66 
70 
71 };
72 
73 
74 
75 
77 
80 class MVO_API HTouchInfo
81 {
82 public:
92  HTouchInfo(float x, float y, float timestamp, int taps, MVO_POINTER_SIZED_UINT ident, bool active = true)
93  {
94 
95  Init(x,y,timestamp,taps,ident,active);
96  }
99  {
100  }
101 
110  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)
111  {
112  m_x=x;
113  m_y=y;
114  m_timestamp = timestamp;
115  m_taps = taps;
116  m_id = ident;
117  m_bActive = active;
118 
119  }
120 
121  float m_x;
122  float m_y;
123  float m_timestamp;
124  int m_taps;
125  bool m_bActive;
126  MVO_POINTER_SIZED_UINT m_id;
127 };
128 
129 
130 
132 
135 class MVO_API HTouchManager
136 {
137 public:
139  HTouchManager();
141  ~HTouchManager();
142 
153  HTouchInfo *AddTouch(float x, float y, float timestamp, int taps, MVO_POINTER_SIZED_UINT ident);
159  void ClearTouchActivity();
160 
161  void ClearTouches();
162 
163 
169  bool RemoveTouch(MVO_POINTER_SIZED_UINT ident);
170 
172  int GetActiveTouchCount() { return m_ActiveTouches; }
174  int GetTouchCount();
175 
183  int GetTouches(HTouchInfo *touches[], int maxtouches, bool activeOnly = false);
184 
191  HTouchInfo *GetTouch(int index, bool activeOnly = false);
192 
193 private:
194  unsigned int m_ActiveTouches;
195  vlist_s *m_TouchList;
196  };
197 
198 
200 
207 class MVO_API HEventInfo
208 {
209 
210 public:
211 
214  HEventInfo(HBaseView *view);
215 
217 #define MVO_CONTROL 1<<1
218 
220 #define MVO_SHIFT 1<<2
221 
223 #define MVO_ALT 1<<3
224 
226 #define MVO_LBUTTON 1<<4
227 
229 #define MVO_MBUTTON 1<<5
230 
232 #define MVO_RBUTTON 1<<6
233 
235 #define MVO_RIGHT_CONTROL 1<<7
236 
238 #define MVO_RIGHT_SHIFT 1<<8
239 
241 #define MVO_RIGHT_ALT 1<<9
242 
244 #define MVO_LEFT_CONTROL 1<<10
245 
247 #define MVO_LEFT_SHIFT 1<<11
248 
250 #define MVO_LEFT_ALT 1<<12
251 
253 #define MVO_LEFT_ARROW 1<<13
254 
256 #define MVO_UP_ARROW 1<<14
257 
259 #define MVO_RIGHT_ARROW 1<<15
260 
262 #define MVO_DOWN_ARROW 1<<16
263 
265 #define MVO_JOYSTICK_BUTTON_1 1<<17
266 
268 #define MVO_JOYSTICK_BUTTON_2 1<<18
269 
271 #define MVO_JOYSTICK_BUTTON_3 1<<19
272 
274 #define MVO_JOYSTICK_BUTTON_4 1<<20
275 
277 #define MVO_JOYSTICK_BUTTON_5 1<<21
278 
280 #define MVO_JOYSTICK_BUTTON_6 1<<22
281 
283 #define MVO_JOYSTICK_BUTTON_7 1<<23
284 
286 #define MVO_JOYSTICK_BUTTON_8 1<<24
287 
288 
289  static const int MAX_TOUCHES = 10;
290 
291 
292  bool Control() const { return (m_flags & MVO_CONTROL) != 0; }
293  bool Shift() const { return (m_flags & MVO_SHIFT) != 0; }
294  bool Alt() const { return (m_flags & MVO_ALT) != 0; }
295  bool LeftAlt() const { return (m_flags & MVO_LEFT_ALT) != 0; }
296  bool LeftControl() const { return (m_flags & MVO_LEFT_CONTROL) != 0; }
297  bool LeftShift() const { return (m_flags & MVO_LEFT_SHIFT) != 0; }
298  bool RightAlt() const { return (m_flags & MVO_RIGHT_ALT) != 0; }
299  bool RightControl() const { return (m_flags & MVO_RIGHT_CONTROL) != 0; }
300  bool RightShift() const { return (m_flags & MVO_RIGHT_SHIFT) != 0; }
301  bool LButton() const { return (m_flags & MVO_LBUTTON) != 0; }
302  bool MButton() const { return (m_flags & MVO_MBUTTON) != 0; }
303  bool RButton() const { return (m_flags & MVO_RBUTTON) != 0; }
304  bool LeftArrow() const { return (m_flags & MVO_LEFT_ARROW) != 0; }
305  bool UpArrow() const { return (m_flags & MVO_UP_ARROW) != 0; }
306  bool RightArrow() const { return (m_flags & MVO_RIGHT_ARROW) != 0; }
307  bool DownArrow() const { return (m_flags & MVO_DOWN_ARROW) != 0; }
309  // Get/Set routines
310  HBaseView* GetView() const { return m_pView; }
312  const HPoint& GetMousePixelPos() const { return m_ptPixel; }
313  const HPoint& GetMouseWindowPos() const { return m_ptWindow; }
314  const HPoint& GetMouseWorldPos() const { return m_ptWorld; }
315  const HPoint& GetMouseViewpointPos() const { return m_ptViewpoint; }
316  const HPoint& GetJoystickRotation() const { return m_ptWorld; }
317  const HPoint& GetJoystickTranslation() const { return m_ptWorld; }
320  unsigned int GetChar () const { return m_Char; };
321 
322  unsigned int GetCharRepCount () const { return m_RepCount; }
323  unsigned int GetTimerId () const {return m_TimerId; }
329  unsigned int GetFlags() const { return m_flags; }
330 
331 
332  // EventInfo Initialization
333  void SetType(HEventType NewType) { m_EventType = NewType; }
337  HEventType GetType() const { return m_EventType; }
338 
348  void SetPoint(HEventType NewType, int x, int y, unsigned int NewFlags);
349 
350 
359  void SetPixelPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags);
360 
361 
362 //for some reason this is unresolved when the csharp/c module links
371  void SetWindowPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags);
372 
373 
382  void SetWorldPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags);
383 
384 
392  void SetViewpointPos(HEventType NewType, const HPoint& NewPoint, unsigned int NewFlags);
393 
394 
403  void SetKey(HEventType NewType, unsigned int nChar, unsigned int nRepCnt, unsigned int NewFlags);
404 
410  void SetTimer(HEventType NewType, unsigned int nIDEvent);
411 
416  void SetMouseWheelDelta(int NewWheelDelta);
417 
423  void SetFlags(int flags){
424  m_flags = flags;
425  }
426 
430  int GetMouseWheelDelta() const { return m_WheelDelta; }
431 
432 
433 
434 
435 private:
436  int m_WheelDelta;
437  HPoint m_ptPixel; // Mouse position in windows pixel space
438  HPoint m_ptWindow; // Mouse position in HOOPS "outer window space"
439  HPoint m_ptWorld; // Mouse position in HOOPS world space
440  HPoint m_ptViewpoint; // Mouse position in HOOPS world space
441 
442  unsigned int m_Char; // character from keyboard event
443  unsigned int m_RepCount; // number of times key press event was repeated
444  unsigned int m_TimerId; // Id number of the timer generated by the UI
445 
446  float m_time; // System time of event
447  unsigned int m_flags; // Flags indicating which mouse buttons are pressed
448  // and if the "shift" and "control" keyboard keys are pressed
449 
450  HEventType m_EventType; // Type of event
451  HBaseView* m_pView; // view associated with this event
452 
453 };
454 
455 
456 #ifdef H_PACK_8
457 #pragma pack(pop)
458 #endif
459 
460 #endif
461 
462 
463 
const HPoint & GetMousePixelPos() const
Definition: HEventInfo.h:312
float m_timestamp
Definition: HEventInfo.h:123
The middle mouse button is up.
Definition: HEventInfo.h:42
bool Control() const
Definition: HEventInfo.h:292
bool RightArrow() const
Definition: HEventInfo.h:306
float m_y
Definition: HEventInfo.h:122
The left mouse button was double-clicked.
Definition: HEventInfo.h:39
const HPoint & GetJoystickRotation() const
Definition: HEventInfo.h:316
The mouse wheel has moved.
Definition: HEventInfo.h:51
bool RightControl() const
Definition: HEventInfo.h:299
The mouse cursor has moved.
Definition: HEventInfo.h:49
bool RButton() const
Definition: HEventInfo.h:303
bool UpArrow() const
Definition: HEventInfo.h:305
int GetActiveTouchCount()
Definition: HEventInfo.h:172
A set of Rotation values from a 3D Mouse/Joystick.
Definition: HEventInfo.h:64
The left mouse button is up.
Definition: HEventInfo.h:38
bool LeftAlt() const
Definition: HEventInfo.h:295
HBaseView * GetView() const
Definition: HEventInfo.h:310
self-explanatory
Definition: HEventInfo.h:55
bool m_bActive
Definition: HEventInfo.h:125
A touch down event has occured.
Definition: HEventInfo.h:67
HTouchInfo(float x, float y, float timestamp, int taps, MVO_POINTER_SIZED_UINT ident, bool active=true)
Definition: HEventInfo.h:92
void SetType(HEventType NewType)
Definition: HEventInfo.h:333
bool LeftArrow() const
Definition: HEventInfo.h:304
No event ooccurred.
Definition: HEventInfo.h:35
const HPoint & GetMouseWorldPos() const
Definition: HEventInfo.h:314
bool LButton() const
Definition: HEventInfo.h:301
The left mouse button was pressed.
Definition: HEventInfo.h:37
The middle mouse button was pressed.
Definition: HEventInfo.h:41
The mouse wheel was scrolled down.
Definition: HEventInfo.h:53
const HPoint & GetMouseViewpointPos() const
Definition: HEventInfo.h:315
bool RightAlt() const
Definition: HEventInfo.h:298
The right mouse button was double-clicked.
Definition: HEventInfo.h:47
HTouchInfo()
Definition: HEventInfo.h:98
bool LeftShift() const
Definition: HEventInfo.h:297
unsigned int GetChar() const
Definition: HEventInfo.h:320
const HPoint & GetJoystickTranslation() const
Definition: HEventInfo.h:317
unsigned int GetFlags() const
Definition: HEventInfo.h:329
The right mouse button is up.
Definition: HEventInfo.h:46
const HPoint & GetMouseWindowPos() const
Definition: HEventInfo.h:313
bool DownArrow() const
Definition: HEventInfo.h:307
int m_taps
Definition: HEventInfo.h:124
The HPoint class is the data type of a three-dimensional point.
Definition: HGlobals.h:121
float m_x
Definition: HEventInfo.h:121
A key on the keyboard was pressed.
Definition: HEventInfo.h:57
The HBaseView class defines and manages a view of model information.
Definition: HBaseView.h:332
The HTouchInfo class encapsulates touch events.
Definition: HEventInfo.h:80
A general selection event.
Definition: HEventInfo.h:61
A key on the keyboard was released.
Definition: HEventInfo.h:58
unsigned int GetCharRepCount() const
Definition: HEventInfo.h:322
The right mouse button was pressed.
Definition: HEventInfo.h:45
The HEventInfo class stores and manages event information.
Definition: HEventInfo.h:207
The mouse wheel was scrolled up.
Definition: HEventInfo.h:52
bool Shift() const
Definition: HEventInfo.h:293
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)
Definition: HEventInfo.h:110
A touch up event has occured.
Definition: HEventInfo.h:68
void SetFlags(int flags)
Definition: HEventInfo.h:423
The middle mouse button was double-clicked.
Definition: HEventInfo.h:43
HEventType
Definition: HEventInfo.h:33
The HTouchManager class stores and manages touch input.
Definition: HEventInfo.h:135
bool LeftControl() const
Definition: HEventInfo.h:296
A button press from a 3D Mouse/Joystick.
Definition: HEventInfo.h:65
bool MButton() const
Definition: HEventInfo.h:302
unsigned int GetTimerId() const
Definition: HEventInfo.h:323
MVO_POINTER_SIZED_UINT m_id
Definition: HEventInfo.h:126
bool Alt() const
Definition: HEventInfo.h:294
int GetMouseWheelDelta() const
Definition: HEventInfo.h:430
A touch move event has occured.
Definition: HEventInfo.h:69
bool RightShift() const
Definition: HEventInfo.h:300
A 3D Translation vector from a 3D Mouse/Joystick.
Definition: HEventInfo.h:63
HEventType GetType() const
Definition: HEventInfo.h:337