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
|
* 整理API文档:progress\_circle/rich\_text/slide\_menu
|
||||||
* 增加progress\_circle c语言demo。
|
* 增加progress\_circle c语言demo。
|
||||||
* 增加slide\_menu c语言demo。
|
* 增加slide\_menu c语言demo。
|
||||||
|
* 增加INPUT\_CUSTOM用于关闭系统缺省软键盘。
|
||||||
|
|
||||||
* 2019/01/14
|
* 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},
|
{"int", 0, INPUT_INT}, {"float", 0, INPUT_FLOAT}, {"uint", 0, INPUT_UINT},
|
||||||
{"ufloat", 0, INPUT_UFLOAT}, {"text", 0, INPUT_TEXT}, {"password", 0, INPUT_PASSWORD},
|
{"ufloat", 0, INPUT_UFLOAT}, {"text", 0, INPUT_TEXT}, {"password", 0, INPUT_PASSWORD},
|
||||||
{"hex", 0, INPUT_HEX}, {"email", 0, INPUT_EMAIL}, {"phone", 0, INPUT_PHONE},
|
{"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[] = {
|
static const key_type_value_t align_h_name_value[] = {
|
||||||
|
@ -85,7 +85,12 @@ typedef enum _input_type_t {
|
|||||||
* @const INPUT_PHONE
|
* @const INPUT_PHONE
|
||||||
* 电话号码。
|
* 电话号码。
|
||||||
*/
|
*/
|
||||||
INPUT_PHONE
|
INPUT_PHONE,
|
||||||
|
/**
|
||||||
|
* @const INPUT_CUSTOM
|
||||||
|
* 使用自定义的软键盘(如计算器等应用不希望弹出系统软键盘)。
|
||||||
|
*/
|
||||||
|
INPUT_CUSTOM
|
||||||
} input_type_t;
|
} input_type_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,7 +84,7 @@ BEGIN_C_DECLS
|
|||||||
*
|
*
|
||||||
* > 完整示例请参考:
|
* > 完整示例请参考:
|
||||||
* [canvas demo](https://github.com/zlgopen/awtk-c-demos/blob/master/demos/canvas.c)
|
* [canvas demo](https://github.com/zlgopen/awtk-c-demos/blob/master/demos/canvas.c)
|
||||||
*
|
*
|
||||||
* 参考:
|
* 参考:
|
||||||
*
|
*
|
||||||
* * [canvas接口描述](canvas_t.md)
|
* * [canvas接口描述](canvas_t.md)
|
||||||
|
@ -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来设置控件的显示风格,如背景颜色和边框等等,不过一般情况并不需要。
|
* 可用通过style来设置控件的显示风格,如背景颜色和边框等等,不过一般情况并不需要。
|
||||||
*
|
*
|
||||||
|
@ -31,7 +31,7 @@ BEGIN_C_DECLS
|
|||||||
* @parent widget_t
|
* @parent widget_t
|
||||||
* 软键盘。
|
* 软键盘。
|
||||||
*
|
*
|
||||||
* 软键盘是一个特殊的窗口,由编辑器通过输入法自动打开和关闭。
|
* 软键盘是一个特殊的窗口,由编辑器通过输入法自动打开和关闭。
|
||||||
*
|
*
|
||||||
* 这里介绍一下定制软键盘的方法:
|
* 这里介绍一下定制软键盘的方法:
|
||||||
*
|
*
|
||||||
@ -47,7 +47,8 @@ BEGIN_C_DECLS
|
|||||||
*| INPUT\_HEX | kb\_hex.xml |
|
*| INPUT\_HEX | kb\_hex.xml |
|
||||||
*| INPUT\_EMAIL | kb\_ascii.xml |
|
*| INPUT\_EMAIL | kb\_ascii.xml |
|
||||||
*| INPUT\_PASSWORD | kb\_ascii.xml |
|
*| INPUT\_PASSWORD | kb\_ascii.xml |
|
||||||
*| 其它 | kb\_default.xml |
|
*| INPUT\_CUSTOM | 使用自定义的键盘 |
|
||||||
|
*| 其它 | kb\_default.xml |
|
||||||
*
|
*
|
||||||
* keyboard中按钮子控件的名称有些特殊要求:
|
* 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来设置控件的显示风格,如字体的大小和颜色等等。如:
|
* 可用通过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 {
|
typedef struct _progress_circle_t {
|
||||||
|
@ -38,10 +38,10 @@ BEGIN_C_DECLS
|
|||||||
* 在xml中使用"rich\_text"标签创建图文混排控件。如:
|
* 在xml中使用"rich\_text"标签创建图文混排控件。如:
|
||||||
*
|
*
|
||||||
* ```xml
|
* ```xml
|
||||||
* <rich_text x="0" y="0" w="100%" h="60"
|
* <rich_text x="0" y="0" w="100%" h="60"
|
||||||
* text="<image name="a;bricks"a;/><font align_v="a;middle"a;>hello awtk!</font>" />
|
* text="<image name="a;bricks"a;/><font align_v="a;middle"a;>hello awtk!</font>" />
|
||||||
* ```
|
* ```
|
||||||
* >
|
* >
|
||||||
*
|
*
|
||||||
* > 更多用法请参考:
|
* > 更多用法请参考:
|
||||||
* [rich_text.xml](https://github.com/zlgopen/awtk/blob/master/demos/assets/raw/ui/rich_text.xml)
|
* [rich_text.xml](https://github.com/zlgopen/awtk/blob/master/demos/assets/raw/ui/rich_text.xml)
|
||||||
|
@ -72,7 +72,7 @@ BEGIN_C_DECLS
|
|||||||
* ```c
|
* ```c
|
||||||
* widget_on(slide_menu, EVT_VALUE_CHANGED, on_current_changed, slide_menu);
|
* widget_on(slide_menu, EVT_VALUE_CHANGED, on_current_changed, slide_menu);
|
||||||
* ```
|
* ```
|
||||||
|
|
||||||
* 可按下面的方法关注当前按钮被点击的事件:
|
* 可按下面的方法关注当前按钮被点击的事件:
|
||||||
*
|
*
|
||||||
* ```c
|
* ```c
|
||||||
@ -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 {
|
typedef struct _slide_menu_t {
|
||||||
|
@ -56,6 +56,10 @@ static const char* input_type_to_keyboard_name(int32_t input_type) {
|
|||||||
keyboard = "kb_hex";
|
keyboard = "kb_hex";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case INPUT_CUSTOM: {
|
||||||
|
log_debug("custom keyboard\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
case INPUT_EMAIL:
|
case INPUT_EMAIL:
|
||||||
case INPUT_PASSWORD: {
|
case INPUT_PASSWORD: {
|
||||||
keyboard = "kb_ascii";
|
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* open_anim_hint = open_anim ? close_anim_hint : "";
|
||||||
const char* keyboard = input_type_to_keyboard_name(input_type);
|
const char* keyboard = input_type_to_keyboard_name(input_type);
|
||||||
|
|
||||||
|
if (keyboard == NULL) {
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
widget_to_screen(widget, &p);
|
widget_to_screen(widget, &p);
|
||||||
im->keyboard = window_open(keyboard);
|
im->keyboard = window_open(keyboard);
|
||||||
if (im->keyboard == NULL) {
|
if (im->keyboard == NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user