HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UI_DeviceEvent.h
Go to the documentation of this file.
1 #ifndef __UI_DeviceEvent__
2 #define __UI_DeviceEvent__
3 
4 #include "UI_API.h"
5 
6 #include <RE/RE_IDType.h>
7 #include <SYS/SYS_Types.h>
8 #include <UT/UT_Array.h>
9 #include <UT/UT_StringHolder.h>
10 
11 #include "UI_EventType.h"
12 
13 /*
14  * The UI_DeviceEvent is a generic event structure which
15  * various input device drivers will generate as sub-classes
16  * of UI_EventGenerator.
17  */
18 
19 /*
20  * Note: these are flag bits since more than one button can be down:
21  */
22 #define UI_NO_BUTTON 0x0
23 #define UI_LEFT_BUTTON 0x01
24 #define UI_MIDDLE_BUTTON 0x02
25 #define UI_RIGHT_BUTTON 0x04
26 
27 #define UI_ALT_KEY 0x001 //
28 #define UI_SHIFT_KEY 0x002 //
29 #define UI_CTRL_KEY 0x004 //
30 #define UI_COMMAND_KEY 0x008 // Windows key on Win/Linux
31 #define UI_META_KEYS (UI_ALT_KEY| \
32  UI_SHIFT_KEY| \
33  UI_CTRL_KEY| \
34  UI_COMMAND_KEY)
35 #define UI_ALPHASHIFT_KEY 0x010 // Caps-lock
36 #define UI_AUTOREPEAT 0x020 // Auto-repeat is on for the key
37 #define UI_IME_PREEDIT 0x040 // Key is IME pre-edit string
38 #define UI_IME_COMMIT 0x080 // Key is IME commit string
39 #define UI_KEYPAD_KEY 0x100 // The key came from the keypad
40 #define UI_TABLET_MOTION 0x200 // Motion event triggered from tablet.
41 #define UI_KEYSTATE_CHANGE 0x400 // Key state was changed by this event
42 #define UI_KEYSEQ_TRIGGER 0x800 // Key is key sequence hotkey trigger
43 
44 #if defined(MBSD)
45  #define UI_TOGGLE_SEL_MODIFIER UI_COMMAND_KEY
46 #else
47  #define UI_TOGGLE_SEL_MODIFIER UI_CTRL_KEY
48 #endif
49 
50 static inline bool
51 UIhasToggleSelModifier(short alt_flags)
52 {
53  return (alt_flags & UI_TOGGLE_SEL_MODIFIER);
54 }
55 
56 // Conversion from our Z value to 0..1
57 #define UI_PRESSURE_SCALE 16384.0F
58 // Conversion of T/U/V values to degrees.
59 #define UI_ANGLE_SCALE 100.0F
60 
62 {
66  W = 3,
67  X = 4,
68  Y = 5,
69  Z = 6
70 };
71 #define UI_DEVICE_DIMENSIONS 7
72 
73 
75 {
76 public:
77  UI_DeviceEvent(int event_id = 0);
78 
79  /// Returns an array of Unicode code points corresponding to typed in
80  /// characters from a keyboard event.
81  bool getTypedCharacters(UT_Array<utf32> &cps) const;
82 
84  // NB: 4 bytes of alignment padding here
85  RE_IDType context; // Device specific context
86  double time; // Time in seconds.
87  int64 serialId; // Event specific serialization id
88 
89  exint data; // Event data (at least pointer sized)
90  int values[UI_DEVICE_DIMENSIONS]; // Usually valuator values
91  short altFlags; // Event flags
92  // NB: 2 bytes of alignment padding here
93  int id; // Event identifier
94 
95  int qt_key;
96  UT_StringHolder key; // Key input for UI_EVENT_KEYBOARD
97 };
98 
99 inline
101 {
102  id = event_id;
103 
105 
106  context = 0;
107  data = 0;
108  altFlags = 0;
109  values[DEVICE_DIM_T] = 0;
110  values[DEVICE_DIM_U] = 0;
111  values[DEVICE_DIM_V] = 0;
112  values[W] = 0;
113  values[X] = 0;
114  values[Y] = 0;
115  values[Z] = 0;
116 
117  time = -1.0;
118  serialId = 0;
119  qt_key = 0;
120 }
121 
122 #endif
void * RE_IDType
Definition: RE_IDType.h:20
int64 exint
Definition: SYS_Types.h:125
UI_DeviceEvent(int event_id=0)
UT_StringHolder key
UI_EventType type
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
RE_IDType context
UI_Dimension
UI_EventType
Definition: UI_EventType.h:20
long long int64
Definition: SYS_Types.h:116
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1602
#define UI_TOGGLE_SEL_MODIFIER
#define UI_API
Definition: UI_API.h:10
Definition: format.h:1821
#define UI_DEVICE_DIMENSIONS