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 0x0001 //
28 #define UI_SHIFT_KEY 0x0002 //
29 #define UI_CTRL_KEY 0x0004 //
30 #define UI_COMMAND_KEY 0x0008 // 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 0x0010 // Caps-lock
36 #define UI_AUTOREPEAT 0x0020 // Auto-repeat is on for the key
37 #define UI_IME_PREEDIT 0x0040 // Key is IME pre-edit string
38 #define UI_IME_COMMIT 0x0080 // Key is IME commit string
39 #define UI_KEYPAD_KEY 0x0100 // The key came from the keypad
40 #define UI_TABLET_MOTION 0x0200 // Motion event triggered from tablet.
41 #define UI_KEYSTATE_CHANGE 0x0400 // Key state was changed by this event
42 #define UI_KEYSEQ_TRIGGER 0x0800 // Key is key sequence hotkey trigger
43 #define UI_DBLCLK 0x1000 // UI_EVENT_BUTTON is the second press of a double-click
44 
45 #if defined(MBSD)
46  #define UI_TOGGLE_SEL_MODIFIER UI_COMMAND_KEY
47 #else
48  #define UI_TOGGLE_SEL_MODIFIER UI_CTRL_KEY
49 #endif
50 
51 static inline bool
52 UIhasToggleSelModifier(short alt_flags)
53 {
54  return (alt_flags & UI_TOGGLE_SEL_MODIFIER);
55 }
56 
57 // Conversion from our Z value to 0..1
58 #define UI_PRESSURE_SCALE 16384.0F
59 // Conversion of T/U/V values to degrees.
60 #define UI_ANGLE_SCALE 100.0F
61 
63 {
71 };
72 #define UI_DEVICE_DIMENSIONS 7
73 
74 
76 {
77 public:
78  UI_DeviceEvent(int event_id = 0);
79 
80  /// Returns an array of Unicode code points corresponding to typed in
81  /// characters from a keyboard event.
82  bool getTypedCharacters(UT_Array<utf32> &cps) const;
83 
85  // NB: 4 bytes of alignment padding here
86  RE_IDType context; // Device specific context
87  double time; // Time in seconds.
88  int64 serialId; // Event specific serialization id
89 
90  exint data; // Event data (at least pointer sized)
91  int values[UI_DEVICE_DIMENSIONS]; // Usually valuator values
92  short altFlags; // Event flags
93  // NB: 2 bytes of alignment padding here
94  int id; // Event identifier
95 
96  int qt_key;
97  UT_StringHolder key; // Key input for UI_EVENT_KEYBOARD
98 };
99 
100 inline
102 {
103  id = event_id;
104 
106 
107  context = 0;
108  data = 0;
109  altFlags = 0;
110  values[DEVICE_DIM_T] = 0;
111  values[DEVICE_DIM_U] = 0;
112  values[DEVICE_DIM_V] = 0;
113  values[DEVICE_DIM_W] = 0;
114  values[DEVICE_DIM_X] = 0;
115  values[DEVICE_DIM_Y] = 0;
116  values[DEVICE_DIM_Z] = 0;
117 
118  time = -1.0;
119  serialId = 0;
120  qt_key = 0;
121 }
122 
123 #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:11
Definition: format.h:1821
#define UI_DEVICE_DIMENSIONS