mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
feat(keyboard): ported arabic keyboard from release 7.10.0 (#3728)
This commit is contained in:
parent
e40a82a1b7
commit
d788cd9d7b
@ -49,40 +49,79 @@ const lv_obj_class_t lv_keyboard_class = {
|
||||
static const char * const default_kb_map_lc[] = {"1#", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", LV_SYMBOL_BACKSPACE, "\n",
|
||||
"ABC", "a", "s", "d", "f", "g", "h", "j", "k", "l", LV_SYMBOL_NEW_LINE, "\n",
|
||||
"_", "-", "z", "x", "c", "v", "b", "n", "m", ".", ",", ":", "\n",
|
||||
LV_SYMBOL_KEYBOARD, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""
|
||||
LV_SYMBOL_KEYBOARD,
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
|
||||
"أب",
|
||||
#endif
|
||||
LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""
|
||||
};
|
||||
|
||||
static const lv_btnmatrix_ctrl_t default_kb_ctrl_lc_map[] = {
|
||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 5, LV_KB_BTN(4), LV_KB_BTN(4), LV_KB_BTN(4), LV_KB_BTN(4), LV_KB_BTN(4), LV_KB_BTN(4), LV_KB_BTN(4), LV_KB_BTN(4), LV_KB_BTN(4), LV_KB_BTN(4), LV_BTNMATRIX_CTRL_CHECKED | 7,
|
||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 6, LV_KB_BTN(3), LV_KB_BTN(3), LV_KB_BTN(3), LV_KB_BTN(3), LV_KB_BTN(3), LV_KB_BTN(3), LV_KB_BTN(3), LV_KB_BTN(3), LV_KB_BTN(3), LV_BTNMATRIX_CTRL_CHECKED | 7,
|
||||
LV_BTNMATRIX_CTRL_CHECKED | LV_KB_BTN(1), LV_BTNMATRIX_CTRL_CHECKED | LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_BTNMATRIX_CTRL_CHECKED | LV_KB_BTN(1), LV_BTNMATRIX_CTRL_CHECKED | LV_KB_BTN(1), LV_BTNMATRIX_CTRL_CHECKED | LV_KB_BTN(1),
|
||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, LV_BTNMATRIX_CTRL_CHECKED | 2, 6, LV_BTNMATRIX_CTRL_CHECKED | 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2
|
||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 2,
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
|
||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 2,
|
||||
#endif
|
||||
LV_BTNMATRIX_CTRL_CHECKED | 2, 6, LV_BTNMATRIX_CTRL_CHECKED | 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2
|
||||
};
|
||||
|
||||
static const char * const default_kb_map_uc[] = {"1#", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", LV_SYMBOL_BACKSPACE, "\n",
|
||||
"abc", "A", "S", "D", "F", "G", "H", "J", "K", "L", LV_SYMBOL_NEW_LINE, "\n",
|
||||
"_", "-", "Z", "X", "C", "V", "B", "N", "M", ".", ",", ":", "\n",
|
||||
LV_SYMBOL_KEYBOARD, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""
|
||||
LV_SYMBOL_CLOSE,
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
|
||||
"أب",
|
||||
#endif
|
||||
LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""
|
||||
};
|
||||
|
||||
static const lv_btnmatrix_ctrl_t default_kb_ctrl_uc_map[] = {
|
||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 5, LV_KB_BTN(4), LV_KB_BTN(4), LV_KB_BTN(4), LV_KB_BTN(4), LV_KB_BTN(4), LV_KB_BTN(4), LV_KB_BTN(4), LV_KB_BTN(4), LV_KB_BTN(4), LV_KB_BTN(4), LV_BTNMATRIX_CTRL_CHECKED | 7,
|
||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 6, LV_KB_BTN(3), LV_KB_BTN(3), LV_KB_BTN(3), LV_KB_BTN(3), LV_KB_BTN(3), LV_KB_BTN(3), LV_KB_BTN(3), LV_KB_BTN(3), LV_KB_BTN(3), LV_BTNMATRIX_CTRL_CHECKED | 7,
|
||||
LV_BTNMATRIX_CTRL_CHECKED | LV_KB_BTN(1), LV_BTNMATRIX_CTRL_CHECKED | LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_BTNMATRIX_CTRL_CHECKED | LV_KB_BTN(1), LV_BTNMATRIX_CTRL_CHECKED | LV_KB_BTN(1), LV_BTNMATRIX_CTRL_CHECKED | LV_KB_BTN(1),
|
||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, LV_BTNMATRIX_CTRL_CHECKED | 2, 6, LV_BTNMATRIX_CTRL_CHECKED | 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2
|
||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 2,
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
|
||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 2,
|
||||
#endif
|
||||
LV_BTNMATRIX_CTRL_CHECKED | 2, 6, LV_BTNMATRIX_CTRL_CHECKED | 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2
|
||||
};
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
|
||||
static const char * const default_kb_map_ar[] = {
|
||||
"1#", "ض", "ص", "ث", "ق", "ف", "غ", "ع", "ه", "خ", "ح", "ج", "\n",
|
||||
"ش", "س", "ي", "ب", "ل", "ا", "ت", "ن", "م", "ك", "ط", LV_SYMBOL_BACKSPACE, "\n",
|
||||
"ذ", "ء", "ؤ", "ر", "ى", "ة", "و", "ز", "ظ", "د", "ز", "ظ", "د", "\n",
|
||||
LV_SYMBOL_CLOSE, "abc", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_NEW_LINE, LV_SYMBOL_OK, ""
|
||||
};
|
||||
|
||||
static const lv_btnmatrix_ctrl_t default_kb_ctrl_ar_map[] = {
|
||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2, 2, 6, 2, 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 2
|
||||
};
|
||||
#endif
|
||||
|
||||
static const char * const default_kb_map_spec[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", LV_SYMBOL_BACKSPACE, "\n",
|
||||
"abc", "+", "-", "/", "*", "=", "%", "!", "?", "#", "<", ">", "\n",
|
||||
"\\", "@", "$", "(", ")", "{", "}", "[", "]", ";", "\"", "'", "\n",
|
||||
LV_SYMBOL_KEYBOARD, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""
|
||||
LV_SYMBOL_KEYBOARD,
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
|
||||
"أب",
|
||||
#endif
|
||||
LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""
|
||||
};
|
||||
|
||||
static const lv_btnmatrix_ctrl_t default_kb_ctrl_spec_map[] = {
|
||||
LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_BTNMATRIX_CTRL_CHECKED | 2,
|
||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1),
|
||||
LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1), LV_KB_BTN(1),
|
||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, LV_BTNMATRIX_CTRL_CHECKED | 2, 6, LV_BTNMATRIX_CTRL_CHECKED | 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2
|
||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 2,
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
|
||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 2,
|
||||
#endif
|
||||
LV_BTNMATRIX_CTRL_CHECKED | 2, 6, LV_BTNMATRIX_CTRL_CHECKED | 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2
|
||||
};
|
||||
|
||||
static const char * const default_kb_map_num[] = {"1", "2", "3", LV_SYMBOL_KEYBOARD, "\n",
|
||||
@ -98,7 +137,7 @@ static const lv_btnmatrix_ctrl_t default_kb_ctrl_num_map[] = {
|
||||
1, 1, 1, 1, 1
|
||||
};
|
||||
|
||||
static const char * * kb_map[9] = {
|
||||
static const char * * kb_map[10] = {
|
||||
(const char * *)default_kb_map_lc,
|
||||
(const char * *)default_kb_map_uc,
|
||||
(const char * *)default_kb_map_spec,
|
||||
@ -107,9 +146,12 @@ static const char * * kb_map[9] = {
|
||||
(const char * *)default_kb_map_lc,
|
||||
(const char * *)default_kb_map_lc,
|
||||
(const char * *)default_kb_map_lc,
|
||||
(const char * *)NULL,
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
|
||||
(const char * *)default_kb_map_ar,
|
||||
#endif
|
||||
(const char * *)NULL
|
||||
};
|
||||
static const lv_btnmatrix_ctrl_t * kb_ctrl[9] = {
|
||||
static const lv_btnmatrix_ctrl_t * kb_ctrl[10] = {
|
||||
default_kb_ctrl_lc_map,
|
||||
default_kb_ctrl_uc_map,
|
||||
default_kb_ctrl_spec_map,
|
||||
@ -118,7 +160,10 @@ static const lv_btnmatrix_ctrl_t * kb_ctrl[9] = {
|
||||
default_kb_ctrl_lc_map,
|
||||
default_kb_ctrl_lc_map,
|
||||
default_kb_ctrl_lc_map,
|
||||
NULL,
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
|
||||
default_kb_ctrl_ar_map,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
/**********************
|
||||
@ -288,6 +333,14 @@ void lv_keyboard_def_event_cb(lv_event_t * e)
|
||||
lv_keyboard_update_ctrl_map(obj);
|
||||
return;
|
||||
}
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
|
||||
else if(strcmp(txt, "أب") == 0) {
|
||||
keyboard->mode = LV_KEYBOARD_MODE_TEXT_ARABIC;
|
||||
lv_btnmatrix_set_map(obj, kb_map[LV_KEYBOARD_MODE_TEXT_ARABIC]);
|
||||
lv_keyboard_update_ctrl_map(obj);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
else if(strcmp(txt, "ABC") == 0) {
|
||||
keyboard->mode = LV_KEYBOARD_MODE_TEXT_UPPER;
|
||||
lv_btnmatrix_set_map(obj, kb_map[LV_KEYBOARD_MODE_TEXT_UPPER]);
|
||||
|
@ -45,6 +45,9 @@ enum {
|
||||
LV_KEYBOARD_MODE_USER_2,
|
||||
LV_KEYBOARD_MODE_USER_3,
|
||||
LV_KEYBOARD_MODE_USER_4,
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
|
||||
LV_KEYBOARD_MODE_TEXT_ARABIC
|
||||
#endif
|
||||
};
|
||||
typedef uint8_t lv_keyboard_mode_t;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user