| 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 |
| 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 // event type |
| 20 typedef enum | 20 typedef enum { |
| 21 { | 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 , | |
| 25 } FWL_EVENTTYPE; | 24 } FWL_EVENTTYPE; |
| 26 | 25 |
| 27 //key flag | 26 // key flag |
| 28 typedef enum | 27 typedef enum { |
| 29 { | 28 FWL_EVENTFLAG_ShiftKey = 1 << 0, |
| 30 FWL_EVENTFLAG_ShiftKey = 1 << 0, | 29 FWL_EVENTFLAG_ControlKey = 1 << 1, |
| 31 FWL_EVENTFLAG_ControlKey = 1 << 1, | 30 FWL_EVENTFLAG_AltKey = 1 << 2, |
| 32 FWL_EVENTFLAG_AltKey = 1 << 2, | 31 FWL_EVENTFLAG_MetaKey = 1 << 3, |
| 33 FWL_EVENTFLAG_MetaKey = 1 << 3, | 32 FWL_EVENTFLAG_KeyPad = 1 << 4, |
| 34 FWL_EVENTFLAG_KeyPad = 1 << 4, | 33 FWL_EVENTFLAG_AutoRepeat = 1 << 5, |
| 35 FWL_EVENTFLAG_AutoRepeat = 1 << 5, | 34 FWL_EVENTFLAG_LeftButtonDown = 1 << 6, |
| 36 FWL_EVENTFLAG_LeftButtonDown = 1 << 6, | 35 FWL_EVENTFLAG_MiddleButtonDown = 1 << 7, |
| 37 FWL_EVENTFLAG_MiddleButtonDown = 1 << 7, | 36 FWL_EVENTFLAG_RightButtonDown = 1 << 8, |
| 38 FWL_EVENTFLAG_RightButtonDown = 1 << 8, | |
| 39 } FWL_EVENTFLAG; | 37 } FWL_EVENTFLAG; |
| 40 | 38 |
| 41 // Mouse message command | 39 // Mouse message command |
| 42 typedef enum | 40 typedef enum { |
| 43 { | 41 FWL_EVENTMOUSECMD_LButtonDown = 1, |
| 44 FWL_EVENTMOUSECMD_LButtonDown = 1, | 42 FWL_EVENTMOUSECMD_LButtonUp, |
| 45 FWL_EVENTMOUSECMD_LButtonUp, | 43 FWL_EVENTMOUSECMD_LButtonDblClk, |
| 46 FWL_EVENTMOUSECMD_LButtonDblClk, | 44 FWL_EVENTMOUSECMD_RButtonDown, |
| 47 FWL_EVENTMOUSECMD_RButtonDown, | 45 FWL_EVENTMOUSECMD_RButtonUp, |
| 48 FWL_EVENTMOUSECMD_RButtonUp, | 46 FWL_EVENTMOUSECMD_RButtonDblClk, |
| 49 FWL_EVENTMOUSECMD_RButtonDblClk, | 47 FWL_EVENTMOUSECMD_MButtonDown, |
| 50 FWL_EVENTMOUSECMD_MButtonDown, | 48 FWL_EVENTMOUSECMD_MButtonUp, |
| 51 FWL_EVENTMOUSECMD_MButtonUp, | 49 FWL_EVENTMOUSECMD_MButtonDblClk, |
| 52 FWL_EVENTMOUSECMD_MButtonDblClk, | 50 FWL_EVENTMOUSECMD_MouseMove, |
| 53 FWL_EVENTMOUSECMD_MouseMove, | 51 FWL_EVENTMOUSECMD_MouseEnter, |
| 54 FWL_EVENTMOUSECMD_MouseEnter, | 52 FWL_EVENTMOUSECMD_MouseHover, |
| 55 FWL_EVENTMOUSECMD_MouseHover, | 53 FWL_EVENTMOUSECMD_MouseLeave, |
| 56 FWL_EVENTMOUSECMD_MouseLeave, | |
| 57 } FWL_EVENT_MOUSECMD; | 54 } FWL_EVENT_MOUSECMD; |
| 58 | 55 |
| 59 //mouse event | 56 // mouse event |
| 60 struct FWL_EVENT_MOUSE | 57 struct FWL_EVENT_MOUSE { |
| 61 { | 58 FPDF_UINT32 command; |
| 62 FPDF_UINT32 command; | 59 FPDF_DWORD flag; |
| 63 FPDF_DWORD flag; | 60 FPDF_FLOAT x; |
| 64 FPDF_FLOAT x; | 61 FPDF_FLOAT y; |
| 65 FPDF_FLOAT y; | |
| 66 }; | 62 }; |
| 67 | 63 |
| 68 //mouse wheel | 64 // mouse wheel |
| 69 struct FWL_EVENT_MOUSEWHEEL | 65 struct FWL_EVENT_MOUSEWHEEL { |
| 70 { | 66 FPDF_DWORD flag; |
| 71 FPDF_DWORD flag; | 67 FPDF_FLOAT x; |
| 72 FPDF_FLOAT x; | 68 FPDF_FLOAT y; |
| 73 FPDF_FLOAT y; | 69 FPDF_FLOAT deltaX; |
| 74 FPDF_FLOAT deltaX; | 70 FPDF_FLOAT deltaY; |
| 75 FPDF_FLOAT deltaY; | |
| 76 }; | 71 }; |
| 77 | 72 |
| 78 //virtual keycode | 73 // virtual keycode |
| 79 typedef enum | 74 typedef enum { |
| 80 { | 75 FWL_VKEY_Back = 0x08, |
| 81 FWL_VKEY_Back = 0x08, | 76 FWL_VKEY_Tab = 0x09, |
| 82 FWL_VKEY_Tab = 0x09, | 77 FWL_VKEY_Clear = 0x0C, |
| 83 FWL_VKEY_Clear = 0x0C, | 78 FWL_VKEY_Return = 0x0D, |
| 84 FWL_VKEY_Return = 0x0D, | 79 FWL_VKEY_Shift = 0x10, |
| 85 FWL_VKEY_Shift = 0x10, | 80 FWL_VKEY_Control = 0x11, |
| 86 FWL_VKEY_Control = 0x11, | 81 FWL_VKEY_Menu = 0x12, |
| 87 FWL_VKEY_Menu = 0x12, | 82 FWL_VKEY_Pause = 0x13, |
| 88 FWL_VKEY_Pause = 0x13, | 83 FWL_VKEY_Capital = 0x14, |
| 89 FWL_VKEY_Capital = 0x14, | 84 FWL_VKEY_Kana = 0x15, |
| 90 FWL_VKEY_Kana = 0x15, | 85 FWL_VKEY_Hangul = 0x15, |
| 91 FWL_VKEY_Hangul = 0x15, | 86 FWL_VKEY_Junja = 0x17, |
| 92 FWL_VKEY_Junja = 0x17, | 87 FWL_VKEY_Final = 0x18, |
| 93 FWL_VKEY_Final = 0x18, | 88 FWL_VKEY_Hanja = 0x19, |
| 94 FWL_VKEY_Hanja = 0x19, | 89 FWL_VKEY_Kanji = 0x19, |
| 95 FWL_VKEY_Kanji = 0x19, | 90 FWL_VKEY_Escape = 0x1B, |
| 96 FWL_VKEY_Escape = 0x1B, | 91 FWL_VKEY_Convert = 0x1C, |
| 97 FWL_VKEY_Convert = 0x1C, | |
| 98 FWL_VKEY_NonConvert = 0x1D, | 92 FWL_VKEY_NonConvert = 0x1D, |
| 99 FWL_VKEY_Accept = 0x1E, | 93 FWL_VKEY_Accept = 0x1E, |
| 100 FWL_VKEY_ModeChange = 0x1F, | 94 FWL_VKEY_ModeChange = 0x1F, |
| 101 FWL_VKEY_Space = 0x20, | 95 FWL_VKEY_Space = 0x20, |
| 102 FWL_VKEY_Prior = 0x21, | 96 FWL_VKEY_Prior = 0x21, |
| 103 FWL_VKEY_Next = 0x22, | 97 FWL_VKEY_Next = 0x22, |
| 104 FWL_VKEY_End = 0x23, | 98 FWL_VKEY_End = 0x23, |
| 105 FWL_VKEY_Home = 0x24, | 99 FWL_VKEY_Home = 0x24, |
| 106 FWL_VKEY_Left = 0x25, | 100 FWL_VKEY_Left = 0x25, |
| 107 FWL_VKEY_Up = 0x26, | 101 FWL_VKEY_Up = 0x26, |
| 108 FWL_VKEY_Right = 0x27, | 102 FWL_VKEY_Right = 0x27, |
| 109 FWL_VKEY_Down = 0x28, | 103 FWL_VKEY_Down = 0x28, |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 FWL_VKEY_Exsel = 0xF8, | 235 FWL_VKEY_Exsel = 0xF8, |
| 242 FWL_VKEY_Ereof = 0xF9, | 236 FWL_VKEY_Ereof = 0xF9, |
| 243 FWL_VKEY_Play = 0xFA, | 237 FWL_VKEY_Play = 0xFA, |
| 244 FWL_VKEY_Zoom = 0xFB, | 238 FWL_VKEY_Zoom = 0xFB, |
| 245 FWL_VKEY_NoName = 0xFC, | 239 FWL_VKEY_NoName = 0xFC, |
| 246 FWL_VKEY_PA1 = 0xFD, | 240 FWL_VKEY_PA1 = 0xFD, |
| 247 FWL_VKEY_OEM_Clear = 0xFE, | 241 FWL_VKEY_OEM_Clear = 0xFE, |
| 248 FWL_VKEY_Unknown = 0, | 242 FWL_VKEY_Unknown = 0, |
| 249 } FWL_VKEYCODE; | 243 } FWL_VKEYCODE; |
| 250 | 244 |
| 251 //key event command | 245 // key event command |
| 252 typedef enum | 246 typedef enum { |
| 253 { | 247 FWL_EVENTKEYCMD_KeyDown = 1, |
| 254 FWL_EVENTKEYCMD_KeyDown = 1, | 248 FWL_EVENTKEYCMD_KeyUp, |
| 255 FWL_EVENTKEYCMD_KeyUp, | 249 FWL_EVENTKEYCMD_Char, |
| 256 FWL_EVENTKEYCMD_Char, | |
| 257 } FWL_EVENTKEYCMD; | 250 } FWL_EVENTKEYCMD; |
| 258 | 251 |
| 259 //key event | 252 // key event |
| 260 struct FWL_EVENT_KEY | 253 struct FWL_EVENT_KEY { |
| 261 { | 254 FPDF_UINT32 command; |
| 262 FPDF_UINT32 command; | 255 FPDF_DWORD flag; |
| 263 FPDF_DWORD flag; | 256 union { |
| 264 union | 257 // Virtual key code. |
| 265 { | 258 FPDF_UINT32 vkcode; |
| 266 //Virtual key code. | 259 // Character code. |
| 267 FPDF_UINT32 vkcode; | 260 FPDF_DWORD charcode; |
| 268 //Character code. | 261 } code; |
| 269 FPDF_DWORD charcode; | |
| 270 }code; | |
| 271 }; | 262 }; |
| 272 | 263 |
| 273 //event type | 264 // event type |
| 274 struct FWL_EVENT | 265 struct FWL_EVENT { |
| 275 { | 266 // structure size. |
| 276 //structure size. | 267 FPDF_UINT32 size; |
| 277 FPDF_UINT32 size; | 268 // FWL_EVENTTYPE. |
| 278 //FWL_EVENTTYPE. | 269 FPDF_UINT32 type; |
| 279 FPDF_UINT32 type; | 270 union { |
| 280 union | 271 struct FWL_EVENT_MOUSE mouse; |
| 281 { | 272 struct FWL_EVENT_MOUSEWHEEL wheel; |
| 282 struct FWL_EVENT_MOUSE mouse; | 273 struct FWL_EVENT_KEY key; |
| 283 struct FWL_EVENT_MOUSEWHEEL wheel; | 274 } s; |
| 284 struct FWL_EVENT_KEY key; | |
| 285 }s; | |
| 286 }; | 275 }; |
| 287 | 276 |
| 288 #ifdef __cplusplus | 277 #ifdef __cplusplus |
| 289 } | 278 } |
| 290 #endif | 279 #endif |
| 291 | 280 |
| 292 #endif // PUBLIC_FPDF_FWLEVENT_H_ | 281 #endif // PUBLIC_FPDF_FWLEVENT_H_ |
| OLD | NEW |