OLD | NEW |
1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 #ifndef PPAPI_C_PP_INPUT_EVENT_H_ | 5 #ifndef PPAPI_C_PP_INPUT_EVENT_H_ |
6 #define PPAPI_C_PP_INPUT_EVENT_H_ | 6 #define PPAPI_C_PP_INPUT_EVENT_H_ |
7 | 7 |
8 /** | 8 /** |
9 * @file | 9 * @file |
10 * This file defines the API used to handle mouse and keyboard input events. | 10 * This file defines the API used to handle mouse and keyboard input events. |
11 */ | 11 */ |
12 | 12 |
13 #include "ppapi/c/pp_bool.h" | 13 #include "ppapi/c/pp_bool.h" |
14 #include "ppapi/c/pp_macros.h" | 14 #include "ppapi/c/pp_macros.h" |
15 #include "ppapi/c/pp_stdint.h" | 15 #include "ppapi/c/pp_stdint.h" |
16 #include "ppapi/c/pp_time.h" | 16 #include "ppapi/c/pp_time.h" |
17 | 17 #include "ppapi/c/ppb_input_event.h" |
18 /** | |
19 * | |
20 * @addtogroup Enums | |
21 * @{ | |
22 */ | |
23 | |
24 /** | |
25 * This enumeration contains constants representing each mouse button. | |
26 */ | |
27 typedef enum { | |
28 PP_INPUTEVENT_MOUSEBUTTON_NONE = -1, | |
29 PP_INPUTEVENT_MOUSEBUTTON_LEFT = 0, | |
30 PP_INPUTEVENT_MOUSEBUTTON_MIDDLE = 1, | |
31 PP_INPUTEVENT_MOUSEBUTTON_RIGHT = 2 | |
32 } PP_InputEvent_MouseButton; | |
33 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_MouseButton, 4); | |
34 /** | |
35 * @} | |
36 */ | |
37 | |
38 /** | |
39 * @addtogroup Enums | |
40 * @{ | |
41 */ | |
42 | |
43 /** | |
44 * This enumeration contains mouse and keyboard event constants. | |
45 */ | |
46 typedef enum { | |
47 PP_INPUTEVENT_TYPE_UNDEFINED = -1, | |
48 PP_INPUTEVENT_TYPE_MOUSEDOWN = 0, // PP_InputEvent_Mouse | |
49 PP_INPUTEVENT_TYPE_MOUSEUP = 1, // PP_InputEvent_Mouse | |
50 PP_INPUTEVENT_TYPE_MOUSEMOVE = 2, // PP_InputEvent_Mouse | |
51 PP_INPUTEVENT_TYPE_MOUSEENTER = 3, // PP_InputEvent_Mouse | |
52 PP_INPUTEVENT_TYPE_MOUSELEAVE = 4, // PP_InputEvent_Mouse | |
53 PP_INPUTEVENT_TYPE_MOUSEWHEEL = 5, // PP_InputEvent_Wheel | |
54 PP_INPUTEVENT_TYPE_RAWKEYDOWN = 6, // PP_InputEvent_Key | |
55 PP_INPUTEVENT_TYPE_KEYDOWN = 7, // PP_InputEvent_Key | |
56 PP_INPUTEVENT_TYPE_KEYUP = 8, // PP_InputEvent_Key | |
57 PP_INPUTEVENT_TYPE_CHAR = 9, // PP_InputEvent_Character | |
58 PP_INPUTEVENT_TYPE_CONTEXTMENU = 10 // PP_InputEvent_Mouse | |
59 } PP_InputEvent_Type; | |
60 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Type, 4); | |
61 /** | |
62 * @} | |
63 */ | |
64 | |
65 /** | |
66 * @addtogroup Enums | |
67 * @{ | |
68 */ | |
69 | |
70 /** | |
71 * This enumeration contains event modifier constants. | |
72 */ | |
73 typedef enum { | |
74 PP_INPUTEVENT_MODIFIER_SHIFTKEY = 1 << 0, | |
75 PP_INPUTEVENT_MODIFIER_CONTROLKEY = 1 << 1, | |
76 PP_INPUTEVENT_MODIFIER_ALTKEY = 1 << 2, | |
77 PP_INPUTEVENT_MODIFIER_METAKEY = 1 << 3, | |
78 PP_INPUTEVENT_MODIFIER_ISKEYPAD = 1 << 4, | |
79 PP_INPUTEVENT_MODIFIER_ISAUTOREPEAT = 1 << 5, | |
80 PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN = 1 << 6, | |
81 PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN = 1 << 7, | |
82 PP_INPUTEVENT_MODIFIER_RIGHTBUTTONDOWN = 1 << 8, | |
83 PP_INPUTEVENT_MODIFIER_CAPSLOCKKEY = 1 << 9, | |
84 PP_INPUTEVENT_MODIFIER_NUMLOCKKEY = 1 << 10 | |
85 } PP_InputEvent_Modifier; | |
86 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Modifier, 4); | |
87 /** | |
88 * @} | |
89 */ | |
90 | 18 |
91 /** | 19 /** |
92 * @addtogroup Structs | 20 * @addtogroup Structs |
93 * @{ | 21 * @{ |
94 */ | 22 */ |
95 | 23 |
96 /** | 24 /** |
97 * The PP_InputEvent_Key struct represents a key up or key down event. | 25 * The PP_InputEvent_Key struct represents a key up or key down event. |
98 * | 26 * |
99 * Key up and key down events correspond to physical keys on the keyboard. The | 27 * Key up and key down events correspond to physical keys on the keyboard. The |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 */ | 255 */ |
328 char padding[64]; | 256 char padding[64]; |
329 } u; | 257 } u; |
330 }; | 258 }; |
331 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent, 80); | 259 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent, 80); |
332 /** | 260 /** |
333 * @} | 261 * @} |
334 */ | 262 */ |
335 | 263 |
336 #endif /* PPAPI_C_PP_INPUT_EVENT_H_ */ | 264 #endif /* PPAPI_C_PP_INPUT_EVENT_H_ */ |
OLD | NEW |