From beed0687b40987f61617e407aa09a866a4141467 Mon Sep 17 00:00:00 2001 From: lixianjing Date: Mon, 9 Dec 2019 12:45:29 +0800 Subject: [PATCH] improve INPUT_CUSTOM_PASSWORD --- docs/changes.md | 1 + src/base/enums.c | 13 ++++++++++--- src/base/input_method.h | 7 ++++++- src/widgets/edit.c | 2 +- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/docs/changes.md b/docs/changes.md index 433999e21..1566f3133 100644 --- a/docs/changes.md +++ b/docs/changes.md @@ -3,6 +3,7 @@ * 2019/12/09 * 完善 dialog ex 的文本翻译。 * 支持设置 combobox popup 的 style。 + * edit 增加input type "custom_password"类型。 * 2019/12/07 * 修改 widget\_set\_state 脚本绑定时的问题(感谢大恒提供补丁)。 diff --git a/src/base/enums.c b/src/base/enums.c index a22c108c4..6e5e4a29f 100755 --- a/src/base/enums.c +++ b/src/base/enums.c @@ -36,10 +36,17 @@ static const key_type_value_t align_v_name_value[] = { {"top", 0, ALIGN_V_TOP}, {"middle", 0, ALIGN_V_MIDDLE}, {"bottom", 0, ALIGN_V_BOTTOM}}; static const key_type_value_t input_type_name_value[] = { - {"int", 0, INPUT_INT}, {"float", 0, INPUT_FLOAT}, {"uint", 0, INPUT_UINT}, - {"ufloat", 0, INPUT_UFLOAT}, {"text", 0, INPUT_TEXT}, {"password", 0, INPUT_PASSWORD}, - {"hex", 0, INPUT_HEX}, {"email", 0, INPUT_EMAIL}, {"phone", 0, INPUT_PHONE}, + {"int", 0, INPUT_INT}, + {"float", 0, INPUT_FLOAT}, + {"uint", 0, INPUT_UINT}, + {"ufloat", 0, INPUT_UFLOAT}, + {"text", 0, INPUT_TEXT}, + {"password", 0, INPUT_PASSWORD}, + {"hex", 0, INPUT_HEX}, + {"email", 0, INPUT_EMAIL}, + {"phone", 0, INPUT_PHONE}, {"custom", 0, INPUT_CUSTOM}, + {"custom_password", 0, INPUT_CUSTOM_PASSWORD}, }; static const key_type_value_t align_h_name_value[] = { diff --git a/src/base/input_method.h b/src/base/input_method.h index 7e193cfe9..83cb5381b 100644 --- a/src/base/input_method.h +++ b/src/base/input_method.h @@ -90,7 +90,12 @@ typedef enum _input_type_t { * @const INPUT_CUSTOM * 使用自定义的软键盘(如计算器等应用不希望弹出系统软键盘)。 */ - INPUT_CUSTOM + INPUT_CUSTOM, + /** + * @const INPUT_CUSTOM_PASSWORD + * 使用自定义的密码软键盘。 + */ + INPUT_CUSTOM_PASSWORD } input_type_t; /** diff --git a/src/widgets/edit.c b/src/widgets/edit.c index 9dc6e9b27..1ea63b352 100644 --- a/src/widgets/edit.c +++ b/src/widgets/edit.c @@ -69,7 +69,7 @@ ret_t edit_on_paint_self(widget_t* widget, canvas_t* c) { edit_t* edit = EDIT(widget); return_value_if_fail(edit != NULL, RET_BAD_PARAMS); - if (edit->input_type != INPUT_PASSWORD && edit->input_type != INPUT_CUSTOM) { + if (edit->input_type != INPUT_PASSWORD && edit->input_type != INPUT_CUSTOM_PASSWORD) { text_edit_set_mask(edit->model, FALSE); }