OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef PUBLIC_FPDF_FWLEVENT_H_ | 7 #ifndef PUBLIC_FPDF_FWLEVENT_H_ |
8 #define PUBLIC_FPDF_FWLEVENT_H_ | 8 #define PUBLIC_FPDF_FWLEVENT_H_ |
9 | 9 |
10 #include "fpdfview.h" | 10 #include "fpdfview.h" |
11 | 11 |
12 #ifdef __cplusplus | 12 #ifdef __cplusplus |
13 extern "C" { | 13 extern "C" { |
14 #endif | 14 #endif // __cplusplus |
15 | 15 |
16 typedef int FPDF_INT32; | 16 typedef int FPDF_INT32; |
17 typedef unsigned int FPDF_UINT32; | 17 typedef unsigned int FPDF_UINT32; |
18 typedef float FPDF_FLOAT; | 18 typedef float FPDF_FLOAT; |
19 // event type | 19 |
| 20 // Event types. |
20 typedef enum { | 21 typedef enum { |
21 FWL_EVENTTYPE_Mouse = 0, | 22 FWL_EVENTTYPE_Mouse = 0, |
22 FWL_EVENTTYPE_MouseWheel, | 23 FWL_EVENTTYPE_MouseWheel, |
23 FWL_EVENTTYPE_Key, | 24 FWL_EVENTTYPE_Key, |
24 } FWL_EVENTTYPE; | 25 } FWL_EVENTTYPE; |
25 | 26 |
26 // key flag | 27 // Key flags. |
27 typedef enum { | 28 typedef enum { |
28 FWL_EVENTFLAG_ShiftKey = 1 << 0, | 29 FWL_EVENTFLAG_ShiftKey = 1 << 0, |
29 FWL_EVENTFLAG_ControlKey = 1 << 1, | 30 FWL_EVENTFLAG_ControlKey = 1 << 1, |
30 FWL_EVENTFLAG_AltKey = 1 << 2, | 31 FWL_EVENTFLAG_AltKey = 1 << 2, |
31 FWL_EVENTFLAG_MetaKey = 1 << 3, | 32 FWL_EVENTFLAG_MetaKey = 1 << 3, |
32 FWL_EVENTFLAG_KeyPad = 1 << 4, | 33 FWL_EVENTFLAG_KeyPad = 1 << 4, |
33 FWL_EVENTFLAG_AutoRepeat = 1 << 5, | 34 FWL_EVENTFLAG_AutoRepeat = 1 << 5, |
34 FWL_EVENTFLAG_LeftButtonDown = 1 << 6, | 35 FWL_EVENTFLAG_LeftButtonDown = 1 << 6, |
35 FWL_EVENTFLAG_MiddleButtonDown = 1 << 7, | 36 FWL_EVENTFLAG_MiddleButtonDown = 1 << 7, |
36 FWL_EVENTFLAG_RightButtonDown = 1 << 8, | 37 FWL_EVENTFLAG_RightButtonDown = 1 << 8, |
37 } FWL_EVENTFLAG; | 38 } FWL_EVENTFLAG; |
38 | 39 |
39 // Mouse message command | 40 // Mouse messages. |
40 typedef enum { | 41 typedef enum { |
41 FWL_EVENTMOUSECMD_LButtonDown = 1, | 42 FWL_EVENTMOUSECMD_LButtonDown = 1, |
42 FWL_EVENTMOUSECMD_LButtonUp, | 43 FWL_EVENTMOUSECMD_LButtonUp, |
43 FWL_EVENTMOUSECMD_LButtonDblClk, | 44 FWL_EVENTMOUSECMD_LButtonDblClk, |
44 FWL_EVENTMOUSECMD_RButtonDown, | 45 FWL_EVENTMOUSECMD_RButtonDown, |
45 FWL_EVENTMOUSECMD_RButtonUp, | 46 FWL_EVENTMOUSECMD_RButtonUp, |
46 FWL_EVENTMOUSECMD_RButtonDblClk, | 47 FWL_EVENTMOUSECMD_RButtonDblClk, |
47 FWL_EVENTMOUSECMD_MButtonDown, | 48 FWL_EVENTMOUSECMD_MButtonDown, |
48 FWL_EVENTMOUSECMD_MButtonUp, | 49 FWL_EVENTMOUSECMD_MButtonUp, |
49 FWL_EVENTMOUSECMD_MButtonDblClk, | 50 FWL_EVENTMOUSECMD_MButtonDblClk, |
50 FWL_EVENTMOUSECMD_MouseMove, | 51 FWL_EVENTMOUSECMD_MouseMove, |
51 FWL_EVENTMOUSECMD_MouseEnter, | 52 FWL_EVENTMOUSECMD_MouseEnter, |
52 FWL_EVENTMOUSECMD_MouseHover, | 53 FWL_EVENTMOUSECMD_MouseHover, |
53 FWL_EVENTMOUSECMD_MouseLeave, | 54 FWL_EVENTMOUSECMD_MouseLeave, |
54 } FWL_EVENT_MOUSECMD; | 55 } FWL_EVENT_MOUSECMD; |
55 | 56 |
56 // mouse event | 57 // Mouse events. |
57 struct FWL_EVENT_MOUSE { | 58 struct FWL_EVENT_MOUSE { |
58 FPDF_UINT32 command; | 59 FPDF_UINT32 command; |
59 FPDF_DWORD flag; | 60 FPDF_DWORD flag; |
60 FPDF_FLOAT x; | 61 FPDF_FLOAT x; |
61 FPDF_FLOAT y; | 62 FPDF_FLOAT y; |
62 }; | 63 }; |
63 | 64 |
64 // mouse wheel | 65 // Mouse wheel events. |
65 struct FWL_EVENT_MOUSEWHEEL { | 66 struct FWL_EVENT_MOUSEWHEEL { |
66 FPDF_DWORD flag; | 67 FPDF_DWORD flag; |
67 FPDF_FLOAT x; | 68 FPDF_FLOAT x; |
68 FPDF_FLOAT y; | 69 FPDF_FLOAT y; |
69 FPDF_FLOAT deltaX; | 70 FPDF_FLOAT deltaX; |
70 FPDF_FLOAT deltaY; | 71 FPDF_FLOAT deltaY; |
71 }; | 72 }; |
72 | 73 |
73 // virtual keycode | 74 // Virtual keycodes. |
74 typedef enum { | 75 typedef enum { |
75 FWL_VKEY_Back = 0x08, | 76 FWL_VKEY_Back = 0x08, |
76 FWL_VKEY_Tab = 0x09, | 77 FWL_VKEY_Tab = 0x09, |
77 FWL_VKEY_Clear = 0x0C, | 78 FWL_VKEY_Clear = 0x0C, |
78 FWL_VKEY_Return = 0x0D, | 79 FWL_VKEY_Return = 0x0D, |
79 FWL_VKEY_Shift = 0x10, | 80 FWL_VKEY_Shift = 0x10, |
80 FWL_VKEY_Control = 0x11, | 81 FWL_VKEY_Control = 0x11, |
81 FWL_VKEY_Menu = 0x12, | 82 FWL_VKEY_Menu = 0x12, |
82 FWL_VKEY_Pause = 0x13, | 83 FWL_VKEY_Pause = 0x13, |
83 FWL_VKEY_Capital = 0x14, | 84 FWL_VKEY_Capital = 0x14, |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 FWL_VKEY_Exsel = 0xF8, | 236 FWL_VKEY_Exsel = 0xF8, |
236 FWL_VKEY_Ereof = 0xF9, | 237 FWL_VKEY_Ereof = 0xF9, |
237 FWL_VKEY_Play = 0xFA, | 238 FWL_VKEY_Play = 0xFA, |
238 FWL_VKEY_Zoom = 0xFB, | 239 FWL_VKEY_Zoom = 0xFB, |
239 FWL_VKEY_NoName = 0xFC, | 240 FWL_VKEY_NoName = 0xFC, |
240 FWL_VKEY_PA1 = 0xFD, | 241 FWL_VKEY_PA1 = 0xFD, |
241 FWL_VKEY_OEM_Clear = 0xFE, | 242 FWL_VKEY_OEM_Clear = 0xFE, |
242 FWL_VKEY_Unknown = 0, | 243 FWL_VKEY_Unknown = 0, |
243 } FWL_VKEYCODE; | 244 } FWL_VKEYCODE; |
244 | 245 |
245 // key event command | 246 // Key event commands. |
246 typedef enum { | 247 typedef enum { |
247 FWL_EVENTKEYCMD_KeyDown = 1, | 248 FWL_EVENTKEYCMD_KeyDown = 1, |
248 FWL_EVENTKEYCMD_KeyUp, | 249 FWL_EVENTKEYCMD_KeyUp, |
249 FWL_EVENTKEYCMD_Char, | 250 FWL_EVENTKEYCMD_Char, |
250 } FWL_EVENTKEYCMD; | 251 } FWL_EVENTKEYCMD; |
251 | 252 |
252 // key event | 253 // Key events. |
253 struct FWL_EVENT_KEY { | 254 struct FWL_EVENT_KEY { |
254 FPDF_UINT32 command; | 255 FPDF_UINT32 command; |
255 FPDF_DWORD flag; | 256 FPDF_DWORD flag; |
256 union { | 257 union { |
257 // Virtual key code. | 258 // Virtual key code. |
258 FPDF_UINT32 vkcode; | 259 FPDF_UINT32 vkcode; |
259 // Character code. | 260 // Character code. |
260 FPDF_DWORD charcode; | 261 FPDF_DWORD charcode; |
261 } code; | 262 } code; |
262 }; | 263 }; |
263 | 264 |
264 // event type | 265 // Event types. |
265 struct FWL_EVENT { | 266 struct FWL_EVENT { |
266 // structure size. | 267 // Structure size. |
267 FPDF_UINT32 size; | 268 FPDF_UINT32 size; |
268 // FWL_EVENTTYPE. | 269 // FWL_EVENTTYPE. |
269 FPDF_UINT32 type; | 270 FPDF_UINT32 type; |
270 union { | 271 union { |
271 struct FWL_EVENT_MOUSE mouse; | 272 struct FWL_EVENT_MOUSE mouse; |
272 struct FWL_EVENT_MOUSEWHEEL wheel; | 273 struct FWL_EVENT_MOUSEWHEEL wheel; |
273 struct FWL_EVENT_KEY key; | 274 struct FWL_EVENT_KEY key; |
274 } s; | 275 } s; |
275 }; | 276 }; |
276 | 277 |
277 #ifdef __cplusplus | 278 #ifdef __cplusplus |
278 } | 279 } // extern "C" |
279 #endif | 280 #endif // __cplusplus |
280 | 281 |
281 #endif // PUBLIC_FPDF_FWLEVENT_H_ | 282 #endif // PUBLIC_FPDF_FWLEVENT_H_ |
OLD | NEW |