?? event.h
字號:
EVT_JOY2_BUTTONB - Joystick 2, button B is down****************************************************************************/typedef enum { EVT_JOY1_BUTTONA = 0x00000001, EVT_JOY1_BUTTONB = 0x00000002, EVT_JOY2_BUTTONA = 0x00000004, EVT_JOY2_BUTTONB = 0x00000008 } EVT_eventJoyMaskType;/****************************************************************************REMARKS:Defines the event message masks for mouse eventsHEADER:event.hMEMBERS:EVT_LEFTBMASK - Left button is held downEVT_RIGHTBMASK - Right button is held downEVT_MIDDLEBMASK - Middle button is held downEVT_BOTHBMASK - Both left and right held down togetherEVT_ALLBMASK - All buttons pressedEVT_DBLCLICK - Set if mouse down event was a double click****************************************************************************/typedef enum { EVT_LEFTBMASK = 0x00000001, EVT_RIGHTBMASK = 0x00000002, EVT_MIDDLEBMASK = 0x00000004, EVT_BOTHBMASK = 0x00000007, EVT_ALLBMASK = 0x00000007, EVT_DBLCLICK = 0x00010000 } EVT_eventMouseMaskType;/****************************************************************************REMARKS:Defines the event modifier masks. These are the masks used to extractthe modifier information from the modifiers field of the event_t structure.Note that the values in the modifiers field represent the values of thesemodifier keys at the time the event occurred, not the time you decidedto process the event.HEADER:event.hMEMBERS:EVT_LEFTBUT - Set if left mouse button was downEVT_RIGHTBUT - Set if right mouse button was downEVT_MIDDLEBUT - Set if the middle button was downEVT_RIGHTSHIFT - Set if right shift was downEVT_LEFTSHIFT - Set if left shift was downEVT_RIGHTCTRL - Set if right ctrl key was downEVT_RIGHTALT - Set if right alt key was downEVT_LEFTCTRL - Set if left ctrl key was downEVT_LEFTALT - Set if left alt key was downEVT_SHIFTKEY - Mask for any shift key downEVT_CTRLSTATE - Set if ctrl key was downEVT_ALTSTATE - Set if alt key was downEVT_CAPSLOCK - Caps lock is activeEVT_NUMLOCK - Num lock is activeEVT_SCROLLLOCK - Scroll lock is active****************************************************************************/typedef enum { EVT_LEFTBUT = 0x00000001, EVT_RIGHTBUT = 0x00000002, EVT_MIDDLEBUT = 0x00000004, EVT_RIGHTSHIFT = 0x00000008, EVT_LEFTSHIFT = 0x00000010, EVT_RIGHTCTRL = 0x00000020, EVT_RIGHTALT = 0x00000040, EVT_LEFTCTRL = 0x00000080, EVT_LEFTALT = 0x00000100, EVT_SHIFTKEY = 0x00000018, EVT_CTRLSTATE = 0x000000A0, EVT_ALTSTATE = 0x00000140, EVT_SCROLLLOCK = 0x00000200, EVT_NUMLOCK = 0x00000400, EVT_CAPSLOCK = 0x00000800 } EVT_eventModMaskType;/****************************************************************************REMARKS:Defines the event codes returned in the event_t structures what field. Notethat these are defined as a set of mutually exlusive bit fields, so youcan test for multiple event types using the combined event masks definedin the EVT_eventMaskType enumeration.HEADER:event.hMEMBERS:EVT_NULLEVT - A null eventEVT_KEYDOWN - Key down eventEVT_KEYREPEAT - Key repeat eventEVT_KEYUP - Key up eventEVT_MOUSEDOWN - Mouse down eventEVT_MOUSEAUTO - Mouse down autorepeat eventEVT_MOUSEUP - Mouse up eventEVT_MOUSEMOVE - Mouse movement eventEVT_JOYCLICK - Joystick button state change eventEVT_JOYMOVE - Joystick movement eventEVT_USEREVT - First user event****************************************************************************/typedef enum { EVT_NULLEVT = 0x00000000, EVT_KEYDOWN = 0x00000001, EVT_KEYREPEAT = 0x00000002, EVT_KEYUP = 0x00000004, EVT_MOUSEDOWN = 0x00000008, EVT_MOUSEAUTO = 0x00000010, EVT_MOUSEUP = 0x00000020, EVT_MOUSEMOVE = 0x00000040, EVT_JOYCLICK = 0x00000080, EVT_JOYMOVE = 0x00000100, EVT_USEREVT = 0x00000200 } EVT_eventType;/****************************************************************************REMARKS:Defines the event code masks you can use to test for multiple types ofevents, since the event codes are mutually exlusive bit fields.HEADER:event.hMEMBERS:EVT_KEYEVT - Mask for any key eventEVT_MOUSEEVT - Mask for any mouse eventEVT_MOUSECLICK - Mask for any mouse click eventEVT_JOYEVT - Mask for any joystick eventEVT_EVERYEVT - Mask for any event****************************************************************************/typedef enum { EVT_KEYEVT = (EVT_KEYDOWN | EVT_KEYREPEAT | EVT_KEYUP), EVT_MOUSEEVT = (EVT_MOUSEDOWN | EVT_MOUSEAUTO | EVT_MOUSEUP | EVT_MOUSEMOVE), EVT_MOUSECLICK = (EVT_MOUSEDOWN | EVT_MOUSEUP), EVT_JOYEVT = (EVT_JOYCLICK | EVT_JOYMOVE), EVT_EVERYEVT = 0x7FFFFFFF } EVT_eventMaskType;/****************************************************************************REMARKS:Structure describing the information contained in an event extracted fromthe event queue.HEADER:event.hMEMBERS:which - Window identifier for message for use by high level window manager code (i.e. MegaVision GUI or Windows API).what - Type of event that occurred. Will be one of the values defined by the EVT_eventType enumeration.when - Time that the event occurred in milliseconds since startupwhere_x - X coordinate of the mouse cursor location at the time of the event (in screen coordinates). For joystick events this represents the position of the first joystick X axis.where_y - Y coordinate of the mouse cursor location at the time of the event (in screen coordinates). For joystick events this represents the position of the first joystick Y axis.relative_x - Relative movement of the mouse cursor in the X direction (in units of mickeys, or 1/200th of an inch). For joystick events this represents the position of the second joystick X axis.relative_y - Relative movement of the mouse cursor in the Y direction (in units of mickeys, or 1/200th of an inch). For joystick events this represents the position of the second joystick Y axis.message - Event specific message for the event. For use events this can be any user specific information. For keyboard events this contains the ASCII code in bits 0-7, the keyboard scan code in bits 8-15 and the character repeat count in bits 16-30. You can use the EVT_asciiCode, EVT_scanCode and EVT_repeatCount macros to extract this information from the message field. For mouse events this contains information about which button was pressed, and will be a combination of the flags defined by the EVT_eventMouseMaskType enumeration. For joystick events, this conatins information about which buttons were pressed, and will be a combination of the flags defined by the EVT_eventJoyMaskType enumeration.modifiers - Contains additional information about the state of the keyboard shift modifiers (Ctrl, Alt and Shift keys) when the event occurred. For mouse events it will also contain the state of the mouse buttons. Will be a combination of the values defined by the EVT_eventModMaskType enumeration.next - Internal use; do not use.prev - Internal use; do not use.****************************************************************************/typedef struct { ulong which; ulong what; ulong when; int where_x; int where_y; int relative_x; int relative_y; ulong message; ulong modifiers; int next; int prev; } event_t;/****************************************************************************REMARKS:Structure describing an entry in the code page table. A table of translationcodes for scan codes to ASCII codes is provided in this table to be usedby the keyboard event libraries. On some OS'es the keyboard translation ishandled by the OS, but for DOS and embedded systems you must register adifferent code page translation table if you want to support keyboardsother than the US English keyboard (the default).NOTE: Entries in code page tables *must* be in ascending order for the scan codes as we do a binary search on the tables for the ASCII code equivalents.HEADER:event.hMEMBERS:scanCode - Scan code to translate (really the virtual scan code).asciiCode - ASCII code for this scan code.****************************************************************************/typedef struct { uchar scanCode; uchar asciiCode; } codepage_entry_t;/****************************************************************************REMARKS:Structure describing a complete code page translation table. The tablecontains translation tables for normal keys, shifted keys and ctrl keys.The Ctrl key always has precedence over the shift table, and the shifttable is used when the shift key is down or the CAPSLOCK key is down.HEADER:event.hMEMBERS:name - Name of the code page table (ie: "US English")normal - Code page for translating normal keysnormalLen - Length of normal translation tablecaps - Code page for translating keys when CAPSLOCK is downcapsLen - Length of CAPSLOCK translation tableshift - Code page for shifted keys (ie: shift key is held down)shiftLen - Length of shifted translation tableshiftCaps - Code page for shifted keys when CAPSLOCK is downshiftCapsLen - Length of shifted CAPSLOCK translation tablectrl - Code page for ctrl'ed keys (ie: ctrl key is held down)ctrlLen - Length of ctrl'ed translation tablenumPad - Code page for NUMLOCK'ed keypad keysnumPadLen - Length of NUMLOCK'ed translation table****************************************************************************/typedef struct { char name[20]; codepage_entry_t *normal; int normalLen; codepage_entry_t *caps; int capsLen; codepage_entry_t *shift; int shiftLen; codepage_entry_t *shiftCaps; int shiftCapsLen; codepage_entry_t *ctrl; int ctrlLen; codepage_entry_t *numPad; int numPadLen; } codepage_t;/* {secret} */typedef ibool (EVTAPIP _EVT_userEventFilter)(event_t *evt);/* {secret} */typedef void (EVTAPIP _EVT_mouseMoveHandler)(int x,int y);/* {secret} */typedef void (EVTAPIP _EVT_heartBeatCallback)(void *params);/* Macro to find the size of a static array */#define EVT_ARR_SIZE(a) (sizeof(a)/sizeof((a)[0]))#pragma pack()/*--------------------------- Global variables ----------------------------*/#ifdef __cplusplusextern "C" { /* Use "C" linkage when in C++ mode */#endif/* Standard code page tables */extern codepage_t _CP_US_English;/*------------------------- Function Prototypes ---------------------------*//* Public API functions for user applications */ibool EVTAPI EVT_getNext(event_t *evt,ulong mask);ibool EVTAPI EVT_peekNext(event_t *evt,ulong mask);ibool EVTAPI EVT_post(ulong which,ulong what,ulong message,ulong modifiers);void EVTAPI EVT_flush(ulong mask);void EVTAPI EVT_halt(event_t *evt,ulong mask);ibool EVTAPI EVT_isKeyDown(uchar scanCode);void EVTAPI EVT_setMousePos(int x,int y);void EVTAPI EVT_getMousePos(int *x,int *y);/* Function to enable/disable updating of keyboard LED status indicators */void EVTAPI EVT_allowLEDS(ibool enable);/* Function to install a custom keyboard code page. Default is US English */codepage_t *EVTAPI EVT_getCodePage(void);void EVTAPI EVT_setCodePage(codepage_t *page);/* Functions for fine grained joystick calibration */void EVTAPI EVT_pollJoystick(void);int EVTAPI EVT_joyIsPresent(void);void EVTAPI EVT_joySetUpperLeft(void);void EVTAPI EVT_joySetLowerRight(void);void EVTAPI EVT_joySetCenter(void);/* Install user supplied event filter callback */void EVTAPI EVT_setUserEventFilter(_EVT_userEventFilter filter);/* Install user supplied event heartbeat callback function */void EVTAPI EVT_setHeartBeatCallback(_EVT_heartBeatCallback callback,void *params);void EVTAPI EVT_getHeartBeatCallback(_EVT_heartBeatCallback *callback,void **params);/* Internal functions to initialise and kill the event manager. MGL * applications should never call these functions directly as the MGL * libraries do it for you. *//* {secret} */void EVTAPI EVT_init(_EVT_mouseMoveHandler mouseMove);/* {secret} */void EVTAPI EVT_setMouseRange(int xRes,int yRes);/* {secret} */void EVTAPI EVT_suspend(void);/* {secret} */void EVTAPI EVT_resume(void);/* {secret} */void EVTAPI EVT_exit(void);#ifdef __cplusplus} /* End of "C" linkage for C++ */#endif /* __cplusplus */#endif /* __EVENT_H */
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -