Home | History | Annotate | Download | only in include
      1 // Copyright 2014 PDFium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
      6 
      7 #ifndef _FWL_EVENT_H
      8 #define _FWL_EVENT_H
      9 
     10 #include "fpdfview.h"
     11 
     12 typedef int			FPDF_INT32;
     13 typedef unsigned int FPDF_UINT32;
     14 typedef float		FPDF_FLOAT;
     15 //event type
     16 typedef enum
     17 {
     18 	FWL_EVENTTYPE_Mouse = 0	,
     19 	FWL_EVENTTYPE_MouseWheel,
     20 	FWL_EVENTTYPE_Key		,
     21 } FWL_EVENTTYPE;
     22 
     23 //key flag
     24 typedef enum
     25 {
     26 	FWL_EVENTFLAG_ShiftKey			= 1 << 0,
     27 	FWL_EVENTFLAG_ControlKey		= 1 << 1,
     28     FWL_EVENTFLAG_AltKey			= 1 << 2,
     29     FWL_EVENTFLAG_MetaKey			= 1 << 3,
     30     FWL_EVENTFLAG_KeyPad			= 1 << 4,
     31     FWL_EVENTFLAG_AutoRepeat		= 1 << 5,
     32     FWL_EVENTFLAG_LeftButtonDown	= 1 << 6,
     33     FWL_EVENTFLAG_MiddleButtonDown	= 1 << 7,
     34     FWL_EVENTFLAG_RightButtonDown	= 1 << 8,
     35 } FWL_EVENTFLAG;
     36 
     37 // Mouse message command
     38 typedef enum
     39 {
     40 	FWL_EVENTMOUSECMD_LButtonDown =	1	,
     41 	FWL_EVENTMOUSECMD_LButtonUp			,
     42 	FWL_EVENTMOUSECMD_LButtonDblClk		,
     43 	FWL_EVENTMOUSECMD_RButtonDown		,
     44 	FWL_EVENTMOUSECMD_RButtonUp			,
     45 	FWL_EVENTMOUSECMD_RButtonDblClk		,
     46 	FWL_EVENTMOUSECMD_MButtonDown		,
     47 	FWL_EVENTMOUSECMD_MButtonUp			,
     48 	FWL_EVENTMOUSECMD_MButtonDblClk		,
     49 	FWL_EVENTMOUSECMD_MouseMove			,
     50 	FWL_EVENTMOUSECMD_MouseEnter		,
     51 	FWL_EVENTMOUSECMD_MouseHover		,
     52 	FWL_EVENTMOUSECMD_MouseLeave		,
     53 } FWL_EVENT_MOUSECMD;
     54 
     55 //mouse event
     56 struct FWL_EVENT_MOUSE
     57 {
     58 	FPDF_UINT32 command;
     59 	FPDF_DWORD flag;
     60 	FPDF_FLOAT x;
     61 	FPDF_FLOAT y;
     62 };
     63 
     64 //mouse wheel
     65 struct FWL_EVENT_MOUSEWHEEL
     66 {
     67 	FPDF_DWORD flag;
     68 	FPDF_FLOAT x;
     69 	FPDF_FLOAT y;
     70 	FPDF_FLOAT deltaX;
     71     FPDF_FLOAT deltaY;
     72 };
     73 
     74 //virtual keycode
     75 typedef enum
     76 {
     77   FWL_VKEY_Back		= 0x08,
     78   FWL_VKEY_Tab		= 0x09,
     79   FWL_VKEY_Clear	= 0x0C,
     80   FWL_VKEY_Return	= 0x0D,
     81   FWL_VKEY_Shift	= 0x10,
     82   FWL_VKEY_Control	= 0x11,
     83   FWL_VKEY_Menu		= 0x12,
     84   FWL_VKEY_Pause	= 0x13,
     85   FWL_VKEY_Capital	= 0x14,
     86   FWL_VKEY_Kana		= 0x15,
     87   FWL_VKEY_Hangul	= 0x15,
     88   FWL_VKEY_Junja	= 0x17,
     89   FWL_VKEY_Final	= 0x18,
     90   FWL_VKEY_Hanja	= 0x19,
     91   FWL_VKEY_Kanji	= 0x19,
     92   FWL_VKEY_Escape	= 0x1B,
     93   FWL_VKEY_Convert	= 0x1C,
     94   FWL_VKEY_NonConvert = 0x1D,
     95   FWL_VKEY_Accept	 = 0x1E,
     96   FWL_VKEY_ModeChange = 0x1F,
     97   FWL_VKEY_Space = 0x20,
     98   FWL_VKEY_Prior = 0x21,
     99   FWL_VKEY_Next = 0x22,
    100   FWL_VKEY_End = 0x23,
    101   FWL_VKEY_Home = 0x24,
    102   FWL_VKEY_Left = 0x25,
    103   FWL_VKEY_Up = 0x26,
    104   FWL_VKEY_Right = 0x27,
    105   FWL_VKEY_Down = 0x28,
    106   FWL_VKEY_Select = 0x29,
    107   FWL_VKEY_Print = 0x2A,
    108   FWL_VKEY_Execute = 0x2B,
    109   FWL_VKEY_Snapshot = 0x2C,
    110   FWL_VKEY_Insert = 0x2D,
    111   FWL_VKEY_Delete = 0x2E,
    112   FWL_VKEY_Help = 0x2F,
    113   FWL_VKEY_0 = 0x30,
    114   FWL_VKEY_1 = 0x31,
    115   FWL_VKEY_2 = 0x32,
    116   FWL_VKEY_3 = 0x33,
    117   FWL_VKEY_4 = 0x34,
    118   FWL_VKEY_5 = 0x35,
    119   FWL_VKEY_6 = 0x36,
    120   FWL_VKEY_7 = 0x37,
    121   FWL_VKEY_8 = 0x38,
    122   FWL_VKEY_9 = 0x39,
    123   FWL_VKEY_A = 0x41,
    124   FWL_VKEY_B = 0x42,
    125   FWL_VKEY_C = 0x43,
    126   FWL_VKEY_D = 0x44,
    127   FWL_VKEY_E = 0x45,
    128   FWL_VKEY_F = 0x46,
    129   FWL_VKEY_G = 0x47,
    130   FWL_VKEY_H = 0x48,
    131   FWL_VKEY_I = 0x49,
    132   FWL_VKEY_J = 0x4A,
    133   FWL_VKEY_K = 0x4B,
    134   FWL_VKEY_L = 0x4C,
    135   FWL_VKEY_M = 0x4D,
    136   FWL_VKEY_N = 0x4E,
    137   FWL_VKEY_O = 0x4F,
    138   FWL_VKEY_P = 0x50,
    139   FWL_VKEY_Q = 0x51,
    140   FWL_VKEY_R = 0x52,
    141   FWL_VKEY_S = 0x53,
    142   FWL_VKEY_T = 0x54,
    143   FWL_VKEY_U = 0x55,
    144   FWL_VKEY_V = 0x56,
    145   FWL_VKEY_W = 0x57,
    146   FWL_VKEY_X = 0x58,
    147   FWL_VKEY_Y = 0x59,
    148   FWL_VKEY_Z = 0x5A,
    149   FWL_VKEY_LWin = 0x5B,
    150   FWL_VKEY_Command = 0x5B,
    151   FWL_VKEY_RWin = 0x5C,
    152   FWL_VKEY_Apps = 0x5D,
    153   FWL_VKEY_Sleep = 0x5F,
    154   FWL_VKEY_NumPad0 = 0x60,
    155   FWL_VKEY_NumPad1 = 0x61,
    156   FWL_VKEY_NumPad2 = 0x62,
    157   FWL_VKEY_NumPad3 = 0x63,
    158   FWL_VKEY_NumPad4 = 0x64,
    159   FWL_VKEY_NumPad5 = 0x65,
    160   FWL_VKEY_NumPad6 = 0x66,
    161   FWL_VKEY_NumPad7 = 0x67,
    162   FWL_VKEY_NumPad8 = 0x68,
    163   FWL_VKEY_NumPad9 = 0x69,
    164   FWL_VKEY_Multiply = 0x6A,
    165   FWL_VKEY_Add = 0x6B,
    166   FWL_VKEY_Separator = 0x6C,
    167   FWL_VKEY_Subtract = 0x6D,
    168   FWL_VKEY_Decimal = 0x6E,
    169   FWL_VKEY_Divide = 0x6F,
    170   FWL_VKEY_F1 = 0x70,
    171   FWL_VKEY_F2 = 0x71,
    172   FWL_VKEY_F3 = 0x72,
    173   FWL_VKEY_F4 = 0x73,
    174   FWL_VKEY_F5 = 0x74,
    175   FWL_VKEY_F6 = 0x75,
    176   FWL_VKEY_F7 = 0x76,
    177   FWL_VKEY_F8 = 0x77,
    178   FWL_VKEY_F9 = 0x78,
    179   FWL_VKEY_F10 = 0x79,
    180   FWL_VKEY_F11 = 0x7A,
    181   FWL_VKEY_F12 = 0x7B,
    182   FWL_VKEY_F13 = 0x7C,
    183   FWL_VKEY_F14 = 0x7D,
    184   FWL_VKEY_F15 = 0x7E,
    185   FWL_VKEY_F16 = 0x7F,
    186   FWL_VKEY_F17 = 0x80,
    187   FWL_VKEY_F18 = 0x81,
    188   FWL_VKEY_F19 = 0x82,
    189   FWL_VKEY_F20 = 0x83,
    190   FWL_VKEY_F21 = 0x84,
    191   FWL_VKEY_F22 = 0x85,
    192   FWL_VKEY_F23 = 0x86,
    193   FWL_VKEY_F24 = 0x87,
    194   FWL_VKEY_NunLock = 0x90,
    195   FWL_VKEY_Scroll = 0x91,
    196   FWL_VKEY_LShift = 0xA0,
    197   FWL_VKEY_RShift = 0xA1,
    198   FWL_VKEY_LControl = 0xA2,
    199   FWL_VKEY_RControl = 0xA3,
    200   FWL_VKEY_LMenu = 0xA4,
    201   FWL_VKEY_RMenu = 0xA5,
    202   FWL_VKEY_BROWSER_Back = 0xA6,
    203   FWL_VKEY_BROWSER_Forward = 0xA7,
    204   FWL_VKEY_BROWSER_Refresh = 0xA8,
    205   FWL_VKEY_BROWSER_Stop = 0xA9,
    206   FWL_VKEY_BROWSER_Search = 0xAA,
    207   FWL_VKEY_BROWSER_Favorites = 0xAB,
    208   FWL_VKEY_BROWSER_Home = 0xAC,
    209   FWL_VKEY_VOLUME_Mute = 0xAD,
    210   FWL_VKEY_VOLUME_Down = 0xAE,
    211   FWL_VKEY_VOLUME_Up = 0xAF,
    212   FWL_VKEY_MEDIA_NEXT_Track = 0xB0,
    213   FWL_VKEY_MEDIA_PREV_Track = 0xB1,
    214   FWL_VKEY_MEDIA_Stop = 0xB2,
    215   FWL_VKEY_MEDIA_PLAY_Pause = 0xB3,
    216   FWL_VKEY_MEDIA_LAUNCH_Mail = 0xB4,
    217   FWL_VKEY_MEDIA_LAUNCH_MEDIA_Select = 0xB5,
    218   FWL_VKEY_MEDIA_LAUNCH_APP1 = 0xB6,
    219   FWL_VKEY_MEDIA_LAUNCH_APP2 = 0xB7,
    220   FWL_VKEY_OEM_1 = 0xBA,
    221   FWL_VKEY_OEM_Plus = 0xBB,
    222   FWL_VKEY_OEM_Comma = 0xBC,
    223   FWL_VKEY_OEM_Minus = 0xBD,
    224   FWL_VKEY_OEM_Period = 0xBE,
    225   FWL_VKEY_OEM_2 = 0xBF,
    226   FWL_VKEY_OEM_3 = 0xC0,
    227   FWL_VKEY_OEM_4 = 0xDB,
    228   FWL_VKEY_OEM_5 = 0xDC,
    229   FWL_VKEY_OEM_6 = 0xDD,
    230   FWL_VKEY_OEM_7 = 0xDE,
    231   FWL_VKEY_OEM_8 = 0xDF,
    232   FWL_VKEY_OEM_102 = 0xE2,
    233   FWL_VKEY_ProcessKey = 0xE5,
    234   FWL_VKEY_Packet = 0xE7,
    235   FWL_VKEY_Attn = 0xF6,
    236   FWL_VKEY_Crsel = 0xF7,
    237   FWL_VKEY_Exsel = 0xF8,
    238   FWL_VKEY_Ereof = 0xF9,
    239   FWL_VKEY_Play = 0xFA,
    240   FWL_VKEY_Zoom = 0xFB,
    241   FWL_VKEY_NoName = 0xFC,
    242   FWL_VKEY_PA1 = 0xFD,
    243   FWL_VKEY_OEM_Clear = 0xFE,
    244   FWL_VKEY_Unknown = 0,
    245 } FWL_VKEYCODE;
    246 
    247 //key event command
    248 typedef enum
    249 {
    250 	FWL_EVENTKEYCMD_KeyDown = 1	,
    251 	FWL_EVENTKEYCMD_KeyUp		,
    252 	FWL_EVENTKEYCMD_Char		,
    253 } FWL_EVENTKEYCMD;
    254 
    255 //key event
    256 struct FWL_EVENT_KEY
    257 {
    258 	FPDF_UINT32 command;
    259 	FPDF_DWORD flag;
    260 	union
    261 	{
    262 		//Virtual key code.
    263 		FPDF_UINT32 vkcode;
    264 		//Character code.
    265 		FPDF_DWORD charcode;
    266 	}code;
    267 };
    268 
    269 //event type
    270 struct FWL_EVENT
    271 {
    272 	//structure size.
    273 	FPDF_UINT32 size;
    274 	//FWL_EVENTTYPE.
    275     FPDF_UINT32 type;
    276 	union
    277 	{
    278 		struct FWL_EVENT_MOUSE mouse;
    279 		struct FWL_EVENT_MOUSEWHEEL wheel;
    280 		struct FWL_EVENT_KEY key;
    281 	}s;
    282 };
    283 
    284 #endif //_FWL_EVENT_H
    285 
    286 
    287