Files
player/Project/Src/MyWin/Window/mywin_input.h

112 lines
2.4 KiB
C
Raw Permalink Normal View History

2025-06-27 00:32:57 +08:00
#ifndef MYWIN_INPUT_H__
#define MYWIN_INPUT_H__
//定义最大输入字符数
#define INPUT_WORDS_MAXNUM 256
//定义输入法状态
#define INPUT_MODE_PINYIN 0
#define INPUT_MODE_BIG 1
#define INPUT_MODE_MINI 2
#define INPUT_MODE_NUM 3
#define INPUT_MODE_SYMBOL 4
typedef struct
{
int x;
int y;
int x_size;
int y_size;
int press;
char txt[10];
}INPUT_ButtonStruct;
typedef struct
{
WIN_WindowStruct win;
int pinyin_y; //拼音的显示坐标
int button_ysize; //按键Y轴方向的尺寸
int exit; //把此项设为1输入法返回
int press_x; //屏幕按下时的坐标
int press_y;
int press_down_index; //处于按下状态的键值索引
int press_down_index_word; //处于按下状态的候选字索引
int word_page; //候选字翻页
int num_symbol_page; //数字字符翻页
u8 *word_const; //候选字待选数组
int inputMode; //输入法状态0拼音1大写2小写3数字4符号
char inputPinyin[10]; //输入的拼音
char candidateWord[3]; //候选字;
INPUT_ButtonStruct word[10];//候选字按键
char inputWords[INPUT_WORDS_MAXNUM]; //输入的字符
INPUT_ButtonStruct button[37];
}WIN_InputStruct;
//在堆中创建一个输入法
WIN_InputStruct *WIN_CreatInput (WIN_WindowStruct *base,
void (*msgLoop)(struct _WIN_WindowStruct *win,WIN_MsgStruct *msg),
int x,int y,int x_size,int y_size);
//键盘切换至字母大写
void INPUT_SetToAscBig (WIN_InputStruct *input);
//键盘切换至字母小写
void INPUT_SetToAscMini (WIN_InputStruct *input);
//键盘切换至数字
void INPUT_SetToNum (WIN_InputStruct *input);
//按键按下
void INPUT_SetPressDown (WIN_InputStruct *input);
//按键抬起
void INPUT_SetPressUp (WIN_InputStruct *input);
//添加拼音
void INPUT_PinYinAppend (WIN_InputStruct *input);
//拼音截短
void INPUT_PinYinCut (WIN_InputStruct *input);
//输入字符截短
void INPUT_WordCut (WIN_InputStruct *input);
//追加输入字符
void INPUT_WordAppend (WIN_InputStruct *input);
//查询候选字符
void INPUT_FindWord (WIN_InputStruct *input);
//默认绘制函数
void INPUT_DefaultPaint (WIN_InputStruct *input);
//默认消息处理函数
void INPUT_DefaultMsgLoop (WIN_InputStruct *input,WIN_MsgStruct *msg);
//使用键盘输入一些数据
int INPUT_KeyBoard (WIN_WindowStruct *win,char *txt,int len);
#endif