mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-30 02:58:26 +08:00
add INPUT_CUSTOM and format code
This commit is contained in:
parent
17698fa57b
commit
f39839dea7
@ -3,6 +3,7 @@
|
||||
* 整理API文档:progress\_circle/rich\_text/slide\_menu
|
||||
* 增加progress\_circle c语言demo。
|
||||
* 增加slide\_menu c语言demo。
|
||||
* 增加INPUT\_CUSTOM用于关闭系统缺省软键盘。
|
||||
|
||||
* 2019/01/14
|
||||
* 完善脚本绑定(增加函数和注释)。
|
||||
|
@ -37,6 +37,7 @@ 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},
|
||||
{"custom", 0, INPUT_CUSTOM},
|
||||
};
|
||||
|
||||
static const key_type_value_t align_h_name_value[] = {
|
||||
|
@ -85,7 +85,12 @@ typedef enum _input_type_t {
|
||||
* @const INPUT_PHONE
|
||||
* 电话号码。
|
||||
*/
|
||||
INPUT_PHONE
|
||||
INPUT_PHONE,
|
||||
/**
|
||||
* @const INPUT_CUSTOM
|
||||
* 使用自定义的软键盘(如计算器等应用不希望弹出系统软键盘)。
|
||||
*/
|
||||
INPUT_CUSTOM
|
||||
} input_type_t;
|
||||
|
||||
/**
|
||||
|
@ -54,7 +54,8 @@ BEGIN_C_DECLS
|
||||
* ```
|
||||
*
|
||||
* > 完整示例请参考:
|
||||
* [image_animation demo](https://github.com/zlgopen/awtk-c-demos/blob/master/demos/image_animation.c)
|
||||
* [image_animation
|
||||
* demo](https://github.com/zlgopen/awtk-c-demos/blob/master/demos/image_animation.c)
|
||||
*
|
||||
* 可用通过style来设置控件的显示风格,如背景颜色和边框等等,不过一般情况并不需要。
|
||||
*
|
||||
|
@ -47,6 +47,7 @@ BEGIN_C_DECLS
|
||||
*| INPUT\_HEX | kb\_hex.xml |
|
||||
*| INPUT\_EMAIL | kb\_ascii.xml |
|
||||
*| INPUT\_PASSWORD | kb\_ascii.xml |
|
||||
*| INPUT\_CUSTOM | 使用自定义的键盘 |
|
||||
*| 其它 | kb\_default.xml |
|
||||
*
|
||||
* keyboard中按钮子控件的名称有些特殊要求:
|
||||
|
@ -52,7 +52,8 @@ BEGIN_C_DECLS
|
||||
* ```
|
||||
*
|
||||
* > 完整示例请参考:
|
||||
* [progress_circle demo](https://github.com/zlgopen/awtk-c-demos/blob/master/demos/progress_circle.c)
|
||||
* [progress_circle
|
||||
* demo](https://github.com/zlgopen/awtk-c-demos/blob/master/demos/progress_circle.c)
|
||||
*
|
||||
* 可用通过style来设置控件的显示风格,如字体的大小和颜色等等。如:
|
||||
*
|
||||
@ -63,7 +64,8 @@ BEGIN_C_DECLS
|
||||
* ```
|
||||
*
|
||||
* > 更多用法请参考:
|
||||
* [theme default](https://github.com/zlgopen/awtk/blob/master/demos/assets/raw/styles/default.xml#L467)
|
||||
* [theme
|
||||
* default](https://github.com/zlgopen/awtk/blob/master/demos/assets/raw/styles/default.xml#L467)
|
||||
*
|
||||
*/
|
||||
typedef struct _progress_circle_t {
|
||||
|
@ -91,7 +91,8 @@ BEGIN_C_DECLS
|
||||
* ```
|
||||
*
|
||||
* > 更多用法请参考:
|
||||
* [theme default](https://github.com/zlgopen/awtk/blob/master/demos/assets/raw/styles/default.xml#L493)
|
||||
* [theme
|
||||
default](https://github.com/zlgopen/awtk/blob/master/demos/assets/raw/styles/default.xml#L493)
|
||||
*
|
||||
*/
|
||||
typedef struct _slide_menu_t {
|
||||
|
@ -56,6 +56,10 @@ static const char* input_type_to_keyboard_name(int32_t input_type) {
|
||||
keyboard = "kb_hex";
|
||||
break;
|
||||
}
|
||||
case INPUT_CUSTOM: {
|
||||
log_debug("custom keyboard\n");
|
||||
break;
|
||||
}
|
||||
case INPUT_EMAIL:
|
||||
case INPUT_PASSWORD: {
|
||||
keyboard = "kb_ascii";
|
||||
@ -114,6 +118,10 @@ static ret_t input_type_open_keyboard(input_method_t* im, int32_t input_type, bo
|
||||
const char* open_anim_hint = open_anim ? close_anim_hint : "";
|
||||
const char* keyboard = input_type_to_keyboard_name(input_type);
|
||||
|
||||
if (keyboard == NULL) {
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
widget_to_screen(widget, &p);
|
||||
im->keyboard = window_open(keyboard);
|
||||
if (im->keyboard == NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user