转自本人百度blog:http://hi.baidu.com/luv%5Fresplendent/blog/item/5a7cadf3822d56cc0b46e005.html
MiniGUI利用触摸屏实现屏幕键盘驱动输入法的设计思想:
1、利用MiniGUI的coolbar控件来创建一个屏幕键盘的外观;其代码以后会贴上;
#include "common.h"
#define ITEM_NUM1 14 /* coolbar */
#define ITEM_NUM2 14 /* coolbar */
#define ITEM_NUM3 12 /* coolbar */
#define ITEM_NUM4 12 /* coolbar */
#define ITEM_NUM5 8 /* coolbar */
#define IDC_NovaSKB1 1001 /* ime */
#define IDC_NovaSKB2 1002 /* ime */
#define IDC_NovaSKB3 1003 /* ime */
#define IDC_NovaSKB4 1004 /* ime */
#define IDC_NovaSKB5 1005 /* ime */
#define HEIGHT_SKB 115 /* 软键盘 */
#define WIDTH_SKB 240 /* 软键盘 */
static const char* caption1[] =
{
" ` ", " 1 ", " 2 ", " 3 ", " 4 ", " 5 "," 6 ", " 7 ", " 8 ", " 9 ", " 0 ", " - ", " = ", " <- "
};
static const int SCANCODE1[] =
{
SCANCODE_GRAVE, SCANCODE_1, SCANCODE_2, SCANCODE_3, SCANCODE_4,
SCANCODE_5, SCANCODE_6, SCANCODE_7, SCANCODE_8, SCANCODE_9,
SCANCODE_0, SCANCODE_MINUS, SCANCODE_EQUAL, SCANCODE_BACKSPACE
};
static const char* caption2[] =
{
"Tab", " q ", " w ", " e ", " r ", " t "," y ", " u ", " i ", " o ", " p ", " [ ", " ] ", " // "
};
static const int SCANCODE2[] =
{
SCANCODE_TAB, SCANCODE_Q, SCANCODE_W, SCANCODE_E, SCANCODE_R,
SCANCODE_T, SCANCODE_Y, SCANCODE_U, SCANCODE_I, SCANCODE_O,
SCANCODE_P, SCANCODE_BRACKET_LEFT, SCANCODE_BRACKET_RIGHT, SCANCODE_BACKSLASH
};
static const char* caption3[] =
{
"Shift ", " a ", " s ", " d ", " f ", " g "," h ", " j ", " k ", " l ", " ; ", " ' "
};
static const int SCANCODE3[] =
{
SCANCODE_LEFTSHIFT, SCANCODE_A, SCANCODE_S, SCANCODE_D, SCANCODE_F,
SCANCODE_G, SCANCODE_H, SCANCODE_J, SCANCODE_K, SCANCODE_L,
SCANCODE_SEMICOLON, SCANCODE_APOSTROPHE
};
static const char* caption4[] =
{
"Ctrl ", " z ", " x ", " c ", " v ", " b "," n ", " m ", " , ", " . ", " / ", " Enter "
};
static const int SCANCODE4[] =
{
SCANCODE_LEFTCONTROL, SCANCODE_Z, SCANCODE_X, SCANCODE_C, SCANCODE_V,
SCANCODE_B, SCANCODE_N, SCANCODE_M, SCANCODE_COMMA, SCANCODE_PERIOD,
SCANCODE_SLASH, SCANCODE_ENTER
};
static const char* caption5[] =
{
"Del ", " 英 ", " 中 ", " Space ",
" | ", " | ", " -> ", " <- "
};
static const int SCANCODE5[] =
{
SCANCODE_REMOVE, -1, -1, SCANCODE_SPACE, SCANCODE_CURSORBLOCKDOWN,
SCANCODE_CURSORBLOCKUP, SCANCODE_CURSORBLOCKLEFT, SCANCODE_CURSORBLOCKRIGHT
};
static void create_novaskb1 (HWND hWnd)
{
HWND cb;
COOLBARITEMINFO item;
int i;
static BITMAP del_bmp;
if (LoadBitmap (HDC_SCREEN, &del_bmp, "./little/del.bmp") != ERR_BMP_OK)
exit(1);
cb = CreateWindow (CTRL_COOLBAR,
"",