📄 common.h
字号:
#define SCANCODE_CURSORUP 72#define SCANCODE_KEYPAD9 73#define SCANCODE_CURSORUPRIGHT 73#define SCANCODE_KEYPADMINUS 74#define SCANCODE_KEYPAD4 75#define SCANCODE_CURSORLEFT 75#define SCANCODE_KEYPAD5 76#define SCANCODE_KEYPAD6 77#define SCANCODE_CURSORRIGHT 77#define SCANCODE_KEYPADPLUS 78#define SCANCODE_KEYPAD1 79#define SCANCODE_CURSORDOWNLEFT 79#define SCANCODE_KEYPAD2 80#define SCANCODE_CURSORDOWN 80#define SCANCODE_KEYPAD3 81#define SCANCODE_CURSORDOWNRIGHT 81#define SCANCODE_KEYPAD0 82#define SCANCODE_KEYPADPERIOD 83#define SCANCODE_LESS 86#define SCANCODE_F11 87#define SCANCODE_F12 88#define SCANCODE_KEYPADENTER 96#define SCANCODE_RIGHTCONTROL 97#define SCANCODE_CONTROL 97#define SCANCODE_KEYPADDIVIDE 98#define SCANCODE_PRINTSCREEN 99#define SCANCODE_RIGHTALT 100#define SCANCODE_BREAK 101 /* Beware: is 119 */#define SCANCODE_BREAK_ALTERNATIVE 119 /* on some keyboards! */#define SCANCODE_HOME 102#define SCANCODE_CURSORBLOCKUP 103 /* Cursor key block */#define SCANCODE_PAGEUP 104#define SCANCODE_CURSORBLOCKLEFT 105 /* Cursor key block */#define SCANCODE_CURSORBLOCKRIGHT 106 /* Cursor key block */#define SCANCODE_END 107#define SCANCODE_CURSORBLOCKDOWN 108 /* Cursor key block */#define SCANCODE_PAGEDOWN 109#define SCANCODE_INSERT 110#define SCANCODE_REMOVE 111#define SCANCODE_PAUSE 119#define SCANCODE_LEFTWIN 125#define SCANCODE_RIGHTWIN 126#define SCANCODE_MENU 127#define SCANCODE_LEFTBUTTON 0x1000#define SCANCODE_RIGHTBUTTON 0x2000#define SCANCODE_MIDDLBUTTON 0x4000/** * \def KS_CAPTURED * \brief This status indicate that the mouse is captured by a window when * the mouse message posted. * * You can test the status by AND'ed with lParam of the message, like below: * * \code * switch (message) { * case MSG_MOUSEMOVE: * if (lParam & KS_CAPTURED) { * // the mouse is captured by this window. * ... * } * break; * ... * \endcode * * \sa mouse_msgs */#define KS_CAPTURED 0x00000400/** * \def KS_IMEPOST * \brief This status indicate that the key message is posted by the IME window. * * \sa key_msgs */#define KS_IMEPOST 0x00000200/** * \def KS_CAPSLOCK * \brief This status indicate that the CapsLock key was locked when * the key or mouse message posted to the window. * * You can test the status by AND'ed with lParam of the message, like below * * \code * switch (message) { * case MSG_KEYDOWN: * if (lParam & KS_CAPSLOCK) { * // the CapsLock key is locked. * ... * } * break; * ... * \endcode * * \sa key_msgs */#define KS_CAPSLOCK 0x00000100/** * \def KS_NUMLOCK * \brief This status indicate that the NumLock key was locked when * the key or mouse message posted to the window. * * \sa key_msgs */#define KS_NUMLOCK 0x00000080/** * \def KS_SCROLLLOCK * \brief This status indicate that the ScrollLock key was locked when * the key or mouse message posted to the window. * * \sa key_msgs */#define KS_SCROLLLOCK 0x00000040/** * \def KS_LEFTCTRL * \brief This status indicate that the left-Ctrl key was pressed when * the key or mouse message posted to the window. * * \sa key_msgs */#define KS_LEFTCTRL 0x00000020/** * \def KS_RIGHTCTRL * \brief This status indicate that the right-Ctrl key was pressed when * the key or mouse message posted to the window. * * \sa key_msgs */#define KS_RIGHTCTRL 0x00000010/** * \def KS_CTRL * \brief This status indicate that either the left-Ctrl key or the right-Ctrl key * was pressed when the key or mouse message posted to the window. * * \sa key_msgs */#define KS_CTRL 0x00000030/** * \def KS_LEFTALT * \brief This status indicate that left-Alt key was pressed when * the key or mouse message posted to the window. * * \sa key_msgs */#define KS_LEFTALT 0x00000008/** * \def KS_RIGHTALT * \brief This status indicate that right-Alt key was pressed when * the key or mouse message posted to the window. * * \sa key_msgs */#define KS_RIGHTALT 0x00000004/** * \def KS_ALT * \brief This status indicate that either the left-Alt key or the right-Alt key * was pressed when the key or mouse message posted to the window. * * \sa key_msgs */#define KS_ALT 0x0000000C/** * \def KS_LEFTSHIFT * \brief This status indicate that left-Shift key was pressed when * the key or mouse message posted to the window. * * \sa key_msgs */#define KS_LEFTSHIFT 0x00000002/** * \def KS_RIGHTSHIFT * \brief This status indicate that right-Shift key was pressed when * the key or mouse message posted to the window. * * \sa key_msgs */#define KS_RIGHTSHIFT 0x00000001/** * \def KS_SHIFT * \brief This status indicate that either the left-Shift key or the right-Shift key * was pressed when the key or mouse message posted to the window. * * \sa key_msgs */#define KS_SHIFT 0x00000003/** * \def MASK_KS_SHIFTKEYS * \brief The mask of key status. */#define MASK_KS_SHIFTKEYS 0x00000FFF/** * \def KS_LEFTBUTTON * \brief This status indicate that left button was pressed when * the key or mouse message posted to the window. * * \sa key_msgs */#define KS_LEFTBUTTON 0x00001000/** * \def KS_RIGHTBUTTON * \brief This status indicate that right button was pressed when * the key or mouse message posted to the window. * * \sa key_msgs */#define KS_RIGHTBUTTON 0x00002000/** * \def KS_MIDDLBUTTON * \brief This status indicate that middle button was pressed when * the key or mouse message posted to the window. * * \sa key_msgs */#define KS_MIDDLBUTTON 0x00004000/** * \def MASK_KS_BUTTONS * \brief The mask of mouse button status. */#define MASK_KS_BUTTONS 0x0000F000 /** @} end of key_defs */ /** * \defgroup err_codes Error codes * @{ */#define ERR_OK 0#define ERR_INV_HWND -1#define ERR_QUEUE_FULL -2#define ERR_INVALID_HANDLE -3#define ERR_INVALID_HMENU -4#define ERR_INVALID_POS -5#define ERR_INVALID_ID -6#define ERR_RES_ALLOCATION -7#define ERR_CTRLCLASS_INVNAME -8#define ERR_CTRLCLASS_INVLEN -9#define ERR_CTRLCLASS_MEM -10#define ERR_CTRLCLASS_INUSE -11#define ERR_ALREADY_EXIST -12#define ERR_NO_MATCH -13#define ERR_BAD_OWNER -14#define ERR_IME_TOOMUCHIMEWND -15#define ERR_IME_NOSUCHIMEWND -16#define ERR_IME_NOIMEWND -17#define ERR_CONFIG_FILE -18#define ERR_FILE_IO -19#define ERR_GFX_ENGINE -20#define ERR_INPUT_ENGINE -21#define ERR_NO_ENGINE -22 /** @} end of err_codes */ /** * \defgroup misc_macros Miscellaneous macros * @{ *//** * \def TABLESIZE(table) * \brief A macro returns the number of elements in a \a table. */#define TABLESIZE(table) (sizeof(table)/sizeof(table[0]))/* MAX/MIN/ABS macors *//** * \def MAX(x, y) * \brief A macro returns the maximum of \a x and \a y. */#ifndef MAX#define MAX(x, y) ((x > y)?x:y)#endif/** * \def MIN(x, y) * \brief A macro returns the minimum of \a x and \a y. */#ifndef MIN#define MIN(x, y) ((x < y)?x:y)#endif/** * \def ABS(x) * \brief A macro returns the absolute value of \a x. */#ifndef ABS#define ABS(x) (((x)<0) ? -(x) : (x))#endif#ifndef __NOLINUX__/* Common used definitions */#ifndef PATH_MAX #include <dirent.h>#endif/** * \def MAX_PATH * \brief The possible maximal length of a path name. * \note This definition is an alias of PATH_MAX */#define MAX_PATH PATH_MAX/** * \def MAX_NAME * \brief The possible maximal length of a file name. * \note This definition is an alias of NAME_MAX */#define MAX_NAME NAME_MAX#else#define MAX_PATH 256#define MAX_NAME 64#endif /** @} end of misc_macros */ /** @} end of macros_types */#ifdef __cplusplusextern "C" {#endif#ifdef __UCOSII__/* use our own implementation of strdup */#undef HAVE_STRDUP#define strdup own_strdup/* The entry of MiniGUI */int minigui_entry (int argc, const char* argv[]);int ucos2_posix_pthread_init (void);int ucos2_malloc_init (void);#endif#ifndef HAVE_STRDUPchar *strdup(const char *s);#endif#ifndef HAVE_STRCASECMPint strcasecmp(const char *s1, const char *s2);#endif#if 0#include <sys/time.h>struct timezone;int gettimeofday(struct timeval *tv, struct timezone* tz);#endif#ifdef __cplusplus}; /* end of extern "C" */#endif#ifdef _USE_OWN_MALLOC#define USE_DL_PREFIX#include "own_malloc.h"/* wrappers for malloc functions */#define calloc dlcalloc#define free dlfree#define malloc dlmalloc#define memalign dlmemalign#define realloc dlrealloc#define valloc dlvalloc#endif#ifdef __CC_ARM /* Do not use the alloca of ARMCC */# undef HAVE_ALLOCA# undef HAVE_ALLOCA_H#endif#ifdef HAVE_ALLOCA_H# include <alloca.h># define ALLOCATE_LOCAL(size) alloca((int)(size))# define DEALLOCATE_LOCAL(ptr) /* as nothing */#else# define ALLOCATE_LOCAL(size) malloc((int)(size))# define DEALLOCATE_LOCAL(ptr) free(ptr)#endif#ifdef _USE_OWN_STDIO#ifdef __UCOSII__# undef _PRINTF_FLOATING_POINT# undef _SCANF_FLOATING_POINT#else# ifdef HAVE_MATH_H# define _PRINTF_FLOATING_POINT 1# define _SCANF_FLOATING_POINT 1# endif#endif#undef _I18N_MB_REQUIRED#include "own_stdio.h"/* wrappers for stdio functions */#define printf own_printf#define fprintf own_fprintf#define sprintf own_sprintf#define fnprintf own_fnprintf#define snprintf own_snprintf#define vprintf own_vprintf#define vfprintf own_vfprintf#define vsprintf own_vsprintf#define vfnprintf own_vfnprintf#define vsnprintf own_vsnprintf#define scanf own_scanf#define fscanf own_fscanf#define sscanf own_sscanf#define vscanf own_vscanf#define vfscanf own_vfscanf#define vsscanf own_vsscanf#endif#endif /* _MGUI_COMMON_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -