mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
add arabic keyboard (#1964)
* add arabic keyboard * add arabic keyboard
This commit is contained in:
parent
5a88573fdb
commit
2ea03e3745
@ -37,40 +37,80 @@ static lv_signal_cb_t ancestor_signal;
|
|||||||
static const char * const default_kb_map_lc[] = {"1#", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", LV_SYMBOL_BACKSPACE, "\n",
|
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",
|
"ABC", "a", "s", "d", "f", "g", "h", "j", "k", "l", LV_SYMBOL_NEW_LINE, "\n",
|
||||||
"_", "-", "z", "x", "c", "v", "b", "n", "m", ".", ",", ":", "\n",
|
"_", "-", "z", "x", "c", "v", "b", "n", "m", ".", ",", ":", "\n",
|
||||||
LV_SYMBOL_CLOSE, 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_lc_map[] = {
|
static const lv_btnmatrix_ctrl_t default_kb_ctrl_lc_map[] = {
|
||||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7,
|
LV_KEYBOARD_CTRL_BTN_FLAGS | 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7,
|
||||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7,
|
LV_KEYBOARD_CTRL_BTN_FLAGS | 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, 2, 6, 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
|
||||||
|
2, 6, 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",
|
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",
|
"abc", "A", "S", "D", "F", "G", "H", "J", "K", "L", LV_SYMBOL_NEW_LINE, "\n",
|
||||||
"_", "-", "Z", "X", "C", "V", "B", "N", "M", ".", ",", ":", "\n",
|
"_", "-", "Z", "X", "C", "V", "B", "N", "M", ".", ",", ":", "\n",
|
||||||
LV_SYMBOL_CLOSE, 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[] = {
|
static const lv_btnmatrix_ctrl_t default_kb_ctrl_uc_map[] = {
|
||||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7,
|
LV_KEYBOARD_CTRL_BTN_FLAGS | 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7,
|
||||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7,
|
LV_KEYBOARD_CTRL_BTN_FLAGS | 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, 2, 6, 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
|
||||||
|
2, 6, 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",
|
static const char * const default_kb_map_spec[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", LV_SYMBOL_BACKSPACE, "\n",
|
||||||
"abc", "+", "-", "/", "*", "=", "%", "!", "?", "#", "<", ">", "\n",
|
"abc", "+", "-", "/", "*", "=", "%", "!", "?", "#", "<", ">", "\n",
|
||||||
"\\", "@", "$", "(", ")", "{", "}", "[", "]", ";", "\"", "'", "\n",
|
"\\", "@", "$", "(", ")", "{", "}", "[", "]", ";", "\"", "'", "\n",
|
||||||
LV_SYMBOL_CLOSE, 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_spec_map[] = {
|
static const lv_btnmatrix_ctrl_t default_kb_ctrl_spec_map[] = {
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
|
||||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, 2, 6, 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
|
||||||
|
2, 6, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char * const default_kb_map_num[] = {"1", "2", "3", LV_SYMBOL_CLOSE, "\n",
|
static const char * const default_kb_map_num[] = {"1", "2", "3", LV_SYMBOL_CLOSE, "\n",
|
||||||
@ -87,17 +127,23 @@ static const lv_btnmatrix_ctrl_t default_kb_ctrl_num_map[] = {
|
|||||||
};
|
};
|
||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
|
|
||||||
static const char * * kb_map[4] = {
|
static const char * * kb_map[] = {
|
||||||
(const char * *)default_kb_map_lc,
|
(const char * *)default_kb_map_lc,
|
||||||
(const char * *)default_kb_map_uc,
|
(const char * *)default_kb_map_uc,
|
||||||
(const char * *)default_kb_map_spec,
|
(const char * *)default_kb_map_spec,
|
||||||
(const char * *)default_kb_map_num
|
(const char * *)default_kb_map_num
|
||||||
|
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
|
||||||
|
,(const char * *)default_kb_map_ar
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
static const lv_btnmatrix_ctrl_t * kb_ctrl[4] = {
|
static const lv_btnmatrix_ctrl_t * kb_ctrl[] = {
|
||||||
default_kb_ctrl_lc_map,
|
default_kb_ctrl_lc_map,
|
||||||
default_kb_ctrl_uc_map,
|
default_kb_ctrl_uc_map,
|
||||||
default_kb_ctrl_spec_map,
|
default_kb_ctrl_spec_map,
|
||||||
default_kb_ctrl_num_map
|
default_kb_ctrl_num_map
|
||||||
|
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
|
||||||
|
,default_kb_ctrl_ar_map
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
@ -354,6 +400,14 @@ void lv_keyboard_def_event_cb(lv_obj_t * kb, lv_event_t event)
|
|||||||
lv_btnmatrix_set_ctrl_map(kb, kb_ctrl[LV_KEYBOARD_MODE_TEXT_LOWER]);
|
lv_btnmatrix_set_ctrl_map(kb, kb_ctrl[LV_KEYBOARD_MODE_TEXT_LOWER]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
|
||||||
|
else if(strcmp(txt, "أب") == 0) {
|
||||||
|
ext->mode = LV_KEYBOARD_MODE_TEXT_ARABIC;
|
||||||
|
lv_btnmatrix_set_map(kb, kb_map[LV_KEYBOARD_MODE_TEXT_ARABIC]);
|
||||||
|
lv_btnmatrix_set_ctrl_map(kb, kb_ctrl[LV_KEYBOARD_MODE_TEXT_ARABIC]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
else if(strcmp(txt, "ABC") == 0) {
|
else if(strcmp(txt, "ABC") == 0) {
|
||||||
ext->mode = LV_KEYBOARD_MODE_TEXT_UPPER;
|
ext->mode = LV_KEYBOARD_MODE_TEXT_UPPER;
|
||||||
lv_btnmatrix_set_map(kb, kb_map[LV_KEYBOARD_MODE_TEXT_UPPER]);
|
lv_btnmatrix_set_map(kb, kb_map[LV_KEYBOARD_MODE_TEXT_UPPER]);
|
||||||
|
@ -43,7 +43,10 @@ enum {
|
|||||||
LV_KEYBOARD_MODE_TEXT_LOWER,
|
LV_KEYBOARD_MODE_TEXT_LOWER,
|
||||||
LV_KEYBOARD_MODE_TEXT_UPPER,
|
LV_KEYBOARD_MODE_TEXT_UPPER,
|
||||||
LV_KEYBOARD_MODE_SPECIAL,
|
LV_KEYBOARD_MODE_SPECIAL,
|
||||||
LV_KEYBOARD_MODE_NUM,
|
LV_KEYBOARD_MODE_NUM
|
||||||
|
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
|
||||||
|
,LV_KEYBOARD_MODE_TEXT_ARABIC
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
typedef uint8_t lv_keyboard_mode_t;
|
typedef uint8_t lv_keyboard_mode_t;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user