add event_cast/widget_cast/g

This commit is contained in:
xianjimli 2018-08-12 19:11:37 +08:00
parent beaafbafa5
commit 7e335f8a19
5 changed files with 69 additions and 1 deletions

View File

@ -87,3 +87,7 @@ ret_t pointer_event_rotate(pointer_event_t* evt, system_info_t* info) {
return RET_OK;
}
event_t* event_cast(event_t* event) {
return event;
}

View File

@ -303,6 +303,16 @@ typedef struct _event_t {
void* target;
} event_t;
/**
* @method event_cast
* @annotation ["cast", "scriptable"]
* event对象转wheel_event_t对象使
* @param {event_t*} event event对象
*
* @return {event_t*}
*/
event_t* event_cast(event_t* event);
/**
* @class wheel_event_t
* @annotation ["scriptable"]

View File

@ -1475,3 +1475,8 @@ const char* widget_get_type(widget_t* widget) {
return widget->vt->type;
}
widget_t* widget_cast(widget_t* widget) {
return widget;
}

View File

@ -855,6 +855,16 @@ ret_t widget_set_children_layout_params(widget_t* widget, const char* params);
*/
ret_t widget_layout(widget_t* widget);
/**
* @method widget_cast
* widget对象(使)
* @annotation ["cast", "scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {widget_t*} widget对象
*/
widget_t* widget_cast(widget_t* widget);
/**
* @method widget_destroy
*

View File

@ -3381,7 +3381,27 @@
},
{
"type": "class",
"methods": [],
"methods": [
{
"params": [
{
"type": "event_t*",
"name": "event",
"desc": "event对象。"
}
],
"annotation": {
"cast": true,
"scriptable": true
},
"desc": "把event对象转wheel_event_t对象主要给脚本语言使用。",
"name": "event_cast",
"return": {
"type": "event_t*",
"desc": "对象。"
}
}
],
"properties": [
{
"name": "type",
@ -15142,6 +15162,25 @@
"desc": "返回RET_OK表示成功否则表示失败。"
}
},
{
"params": [
{
"type": "widget_t*",
"name": "widget",
"desc": "widget对象。"
}
],
"annotation": {
"cast": true,
"scriptable": true
},
"desc": "转换为widget对象(供脚本语言使用)。",
"name": "widget_cast",
"return": {
"type": "widget_t*",
"desc": "widget对象。"
}
},
{
"params": [
{