event.h

来自「适合KS8695X」· C头文件 代码 · 共 697 行 · 第 1/2 页

H
697
字号
/****************************************************************************
*
*                   SciTech OS Portability Manager Library
*
*  ========================================================================
*
*    The contents of this file are subject to the SciTech MGL Public
*    License Version 1.0 (the "License"); you may not use this file
*    except in compliance with the License. You may obtain a copy of
*    the License at http://www.scitechsoft.com/mgl-license.txt
*
*    Software distributed under the License is distributed on an
*    "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
*    implied. See the License for the specific language governing
*    rights and limitations under the License.
*
*    The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc.
*
*    The Initial Developer of the Original Code is SciTech Software, Inc.
*    All Rights Reserved.
*
*  ========================================================================
*
* Language:     ANSI C
* Environment:  Any
*
* Description:  Header file for the SciTech cross platform event library
*
****************************************************************************/

#ifndef __EVENT_H
#define __EVENT_H

#include "scitech.h"

/*---------------------- Macros and type definitions ----------------------*/

#pragma pack(1)

/* 'C' calling conventions always */

#define EVTAPI  _ASMAPI
#define EVTAPIP _ASMAPIP

/* Event message masks for keyDown events */

#define EVT_ASCIIMASK   0x00FF      /* ASCII code of key pressed        */
#define EVT_SCANMASK    0xFF00      /* Scan code of key pressed         */
#define EVT_COUNTMASK   0x7FFF0000L /* Count for KEYREPEAT's            */

/* Macros to extract values from the message fields */

#define EVT_asciiCode(m)    ( (uchar) (m & EVT_ASCIIMASK) )
#define EVT_scanCode(m)     ( (uchar) ( (m & EVT_SCANMASK) >> 8 ) )
#define EVT_repeatCount(m)  ( (short) ( (m & EVT_COUNTMASK) >> 16 ) )

/****************************************************************************
REMARKS:
Defines the set of ASCII codes reported by the event library functions
in the message field. Use the EVT_asciiCode macro to extract the code
from the event structure.

HEADER:
event.h
****************************************************************************/
typedef enum {
    ASCII_ctrlA             = 0x01,
    ASCII_ctrlB             = 0x02,
    ASCII_ctrlC             = 0x03,
    ASCII_ctrlD             = 0x04,
    ASCII_ctrlE             = 0x05,
    ASCII_ctrlF             = 0x06,
    ASCII_ctrlG             = 0x07,
    ASCII_backspace         = 0x08,
    ASCII_ctrlH             = 0x08,
    ASCII_tab               = 0x09,
    ASCII_ctrlI             = 0x09,
    ASCII_ctrlJ             = 0x0A,
    ASCII_ctrlK             = 0x0B,
    ASCII_ctrlL             = 0x0C,
    ASCII_enter             = 0x0D,
    ASCII_ctrlM             = 0x0D,
    ASCII_ctrlN             = 0x0E,
    ASCII_ctrlO             = 0x0F,
    ASCII_ctrlP             = 0x10,
    ASCII_ctrlQ             = 0x11,
    ASCII_ctrlR             = 0x12,
    ASCII_ctrlS             = 0x13,
    ASCII_ctrlT             = 0x14,
    ASCII_ctrlU             = 0x15,
    ASCII_ctrlV             = 0x16,
    ASCII_ctrlW             = 0x17,
    ASCII_ctrlX             = 0x18,
    ASCII_ctrlY             = 0x19,
    ASCII_ctrlZ             = 0x1A,
    ASCII_esc               = 0x1B,
    ASCII_space             = 0x20,
    ASCII_exclamation       = 0x21, /* ! */
    ASCII_quote             = 0x22, /* " */
    ASCII_pound             = 0x23, /* # */
    ASCII_dollar            = 0x24, /* $ */
    ASCII_percent           = 0x25, /* % */
    ASCII_ampersand         = 0x26, /* & */
    ASCII_apostrophe        = 0x27, /* ' */
    ASCII_leftBrace         = 0x28, /* ( */
    ASCII_rightBrace        = 0x29, /* ) */
    ASCII_times             = 0x2A, /* * */
    ASCII_plus              = 0x2B, /* + */
    ASCII_comma             = 0x2C, /* , */
    ASCII_minus             = 0x2D, /* - */
    ASCII_period            = 0x2E, /* . */
    ASCII_divide            = 0x2F, /* / */
    ASCII_0                 = 0x30,
    ASCII_1                 = 0x31,
    ASCII_2                 = 0x32,
    ASCII_3                 = 0x33,
    ASCII_4                 = 0x34,
    ASCII_5                 = 0x35,
    ASCII_6                 = 0x36,
    ASCII_7                 = 0x37,
    ASCII_8                 = 0x38,
    ASCII_9                 = 0x39,
    ASCII_colon             = 0x3A, /* : */
    ASCII_semicolon         = 0x3B, /* ; */
    ASCII_lessThan          = 0x3C, /* < */
    ASCII_equals            = 0x3D, /* = */
    ASCII_greaterThan       = 0x3E, /* > */
    ASCII_question          = 0x3F, /* ? */
    ASCII_at                = 0x40, /* @ */
    ASCII_A                 = 0x41,
    ASCII_B                 = 0x42,
    ASCII_C                 = 0x43,
    ASCII_D                 = 0x44,
    ASCII_E                 = 0x45,
    ASCII_F                 = 0x46,
    ASCII_G                 = 0x47,
    ASCII_H                 = 0x48,
    ASCII_I                 = 0x49,
    ASCII_J                 = 0x4A,
    ASCII_K                 = 0x4B,
    ASCII_L                 = 0x4C,
    ASCII_M                 = 0x4D,
    ASCII_N                 = 0x4E,
    ASCII_O                 = 0x4F,
    ASCII_P                 = 0x50,
    ASCII_Q                 = 0x51,
    ASCII_R                 = 0x52,
    ASCII_S                 = 0x53,
    ASCII_T                 = 0x54,
    ASCII_U                 = 0x55,
    ASCII_V                 = 0x56,
    ASCII_W                 = 0x57,
    ASCII_X                 = 0x58,
    ASCII_Y                 = 0x59,
    ASCII_Z                 = 0x5A,
    ASCII_leftSquareBrace   = 0x5B, /* [ */
    ASCII_backSlash         = 0x5C, /* \ */
    ASCII_rightSquareBrace  = 0x5D, /* ] */
    ASCII_caret             = 0x5E, /* ^ */
    ASCII_underscore        = 0x5F, /* _ */
    ASCII_leftApostrophe    = 0x60, /* ` */
    ASCII_a                 = 0x61,
    ASCII_b                 = 0x62,
    ASCII_c                 = 0x63,
    ASCII_d                 = 0x64,
    ASCII_e                 = 0x65,
    ASCII_f                 = 0x66,
    ASCII_g                 = 0x67,
    ASCII_h                 = 0x68,
    ASCII_i                 = 0x69,
    ASCII_j                 = 0x6A,
    ASCII_k                 = 0x6B,
    ASCII_l                 = 0x6C,
    ASCII_m                 = 0x6D,
    ASCII_n                 = 0x6E,
    ASCII_o                 = 0x6F,
    ASCII_p                 = 0x70,
    ASCII_q                 = 0x71,
    ASCII_r                 = 0x72,
    ASCII_s                 = 0x73,
    ASCII_t                 = 0x74,
    ASCII_u                 = 0x75,
    ASCII_v                 = 0x76,
    ASCII_w                 = 0x77,
    ASCII_x                 = 0x78,
    ASCII_y                 = 0x79,
    ASCII_z                 = 0x7A,
    ASCII_leftCurlyBrace    = 0x7B, /* { */
    ASCII_verticalBar       = 0x7C, /* | */
    ASCII_rightCurlyBrace   = 0x7D, /* } */
    ASCII_tilde             = 0x7E  /* ~ */
    } EVT_asciiCodesType;

/****************************************************************************
REMARKS:
Defines the set of scan codes reported by the event library functions
in the message field. Use the EVT_scanCode macro to extract the code
from the event structure. Note that the scan codes reported will be the
same across all keyboards (assuming the placement of keys on a 101 key US
keyboard), but the translated ASCII values may be different depending on
the country code pages in use.

NOTE:   Scan codes in the event library are not really hardware scan codes,
	but rather virtual scan codes as generated by a low level keyboard
	interface driver. All virtual codes begin with scan code 0x60 and
	range up from there.

HEADER:
event.h
****************************************************************************/
typedef enum {
    KB_padEnter             = 0x60, /* Keypad keys */
    KB_padMinus             = 0x4A,
    KB_padPlus              = 0x4E,
    KB_padTimes             = 0x37,
    KB_padDivide            = 0x61,
    KB_padLeft              = 0x62,
    KB_padRight             = 0x63,
    KB_padUp                = 0x64,
    KB_padDown              = 0x65,
    KB_padInsert            = 0x66,
    KB_padDelete            = 0x67,
    KB_padHome              = 0x68,
    KB_padEnd               = 0x69,
    KB_padPageUp            = 0x6A,
    KB_padPageDown          = 0x6B,
    KB_padCenter            = 0x4C,
    KB_F1                   = 0x3B, /* Function keys */
    KB_F2                   = 0x3C,
    KB_F3                   = 0x3D,
    KB_F4                   = 0x3E,
    KB_F5                   = 0x3F,
    KB_F6                   = 0x40,
    KB_F7                   = 0x41,
    KB_F8                   = 0x42,
    KB_F9                   = 0x43,
    KB_F10                  = 0x44,
    KB_F11                  = 0x57,
    KB_F12                  = 0x58,
    KB_left                 = 0x4B, /* Cursor control keys */
    KB_right                = 0x4D,
    KB_up                   = 0x48,
    KB_down                 = 0x50,
    KB_insert               = 0x52,
    KB_delete               = 0x53,
    KB_home                 = 0x47,
    KB_end                  = 0x4F,
    KB_pageUp               = 0x49,
    KB_pageDown             = 0x51,
    KB_capsLock             = 0x3A,
    KB_numLock              = 0x45,
    KB_scrollLock           = 0x46,
    KB_leftShift            = 0x2A,
    KB_rightShift           = 0x36,
    KB_leftCtrl             = 0x1D,
    KB_rightCtrl            = 0x6C,
    KB_leftAlt              = 0x38,
    KB_rightAlt             = 0x6D,
    KB_leftWindows          = 0x5B,
    KB_rightWindows         = 0x5C,
    KB_menu                 = 0x5D,
    KB_sysReq               = 0x54,
    KB_esc                  = 0x01, /* Normal keyboard keys */
    KB_1                    = 0x02,
    KB_2                    = 0x03,
    KB_3                    = 0x04,
    KB_4                    = 0x05,
    KB_5                    = 0x06,
    KB_6                    = 0x07,
    KB_7                    = 0x08,
    KB_8                    = 0x09,
    KB_9                    = 0x0A,
    KB_0                    = 0x0B,
    KB_minus                = 0x0C,
    KB_equals               = 0x0D,
    KB_backSlash            = 0x2B,
    KB_backspace            = 0x0E,
    KB_tab                  = 0x0F,
    KB_Q                    = 0x10,
    KB_W                    = 0x11,
    KB_E                    = 0x12,
    KB_R                    = 0x13,
    KB_T                    = 0x14,
    KB_Y                    = 0x15,
    KB_U                    = 0x16,
    KB_I                    = 0x17,
    KB_O                    = 0x18,
    KB_P                    = 0x19,
    KB_leftSquareBrace      = 0x1A,
    KB_rightSquareBrace     = 0x1B,
    KB_enter                = 0x1C,
    KB_A                    = 0x1E,
    KB_S                    = 0x1F,
    KB_D                    = 0x20,
    KB_F                    = 0x21,
    KB_G                    = 0x22,
    KB_H                    = 0x23,
    KB_J                    = 0x24,
    KB_K                    = 0x25,
    KB_L                    = 0x26,
    KB_semicolon            = 0x27,
    KB_apostrophe           = 0x28,
    KB_Z                    = 0x2C,
    KB_X                    = 0x2D,
    KB_C                    = 0x2E,
    KB_V                    = 0x2F,
    KB_B                    = 0x30,
    KB_N                    = 0x31,
    KB_M                    = 0x32,
    KB_comma                = 0x33,
    KB_period               = 0x34,
    KB_divide               = 0x35,
    KB_space                = 0x39,
    KB_tilde                = 0x29
    } EVT_scanCodesType;

/****************************************************************************
REMARKS:
Defines the mask for the joystick axes that are present

HEADER:
event.h

MEMBERS:
EVT_JOY_AXIS_X1     - Joystick 1, X axis is present
EVT_JOY_AXIS_Y1     - Joystick 1, Y axis is present
EVT_JOY_AXIS_X2     - Joystick 2, X axis is present
EVT_JOY_AXIS_Y2     - Joystick 2, Y axis is present
EVT_JOY_AXIS_ALL    - Mask for all axes
****************************************************************************/
typedef enum {
    EVT_JOY_AXIS_X1     = 0x00000001,
    EVT_JOY_AXIS_Y1     = 0x00000002,
    EVT_JOY_AXIS_X2     = 0x00000004,
    EVT_JOY_AXIS_Y2     = 0x00000008,
    EVT_JOY_AXIS_ALL    = 0x0000000F
    } EVT_eventJoyAxisType;

/****************************************************************************
REMARKS:
Defines the event message masks for joystick events

HEADER:
event.h

MEMBERS:
EVT_JOY1_BUTTONA    - Joystick 1, button A is down
EVT_JOY1_BUTTONB    - Joystick 1, button B is down
EVT_JOY2_BUTTONA    - Joystick 2, button A is down

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?