mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-02 03:58:33 +08:00
improve get/set prop for state
This commit is contained in:
parent
25ac3f411e
commit
c03494f84a
@ -2,6 +2,7 @@
|
||||
|
||||
2024/02/19
|
||||
* 补充事件名(感谢兆坤提供补丁)
|
||||
* 增加widget 通过 get_prop/set_prop函数设置state属性的功能。(感谢兆坤提供补丁)
|
||||
|
||||
2024/02/07
|
||||
* 增加函数tk\_bits\_data\_to\_bytes\_data/tk\_bits\_data\_from\_bytes\_data
|
||||
|
@ -2145,6 +2145,9 @@ ret_t widget_set_prop(widget_t* widget, const char* name, const value_t* v) {
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_STYLE)) {
|
||||
const char* name = value_str(v);
|
||||
return widget_use_style(widget, name);
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_STATE)) {
|
||||
const char* name = value_str(v);
|
||||
return widget_set_state(widget, name);
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_ENABLE)) {
|
||||
widget_set_enable(widget, value_bool(v));
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_FEEDBACK)) {
|
||||
@ -2292,6 +2295,8 @@ ret_t widget_get_prop(widget_t* widget, const char* name, value_t* v) {
|
||||
value_set_int(v, widget->dirty_rect_tolerance);
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_STYLE)) {
|
||||
value_set_str(v, widget->style);
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_STATE)) {
|
||||
value_set_str(v, widget->state);
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_ENABLE)) {
|
||||
value_set_bool(v, widget->enable);
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_FEEDBACK)) {
|
||||
|
@ -453,7 +453,7 @@ struct _widget_t {
|
||||
uint8_t destroying : 1;
|
||||
/**
|
||||
* @property {char*} state
|
||||
* @annotation ["readable"]
|
||||
* @annotation ["set_prop","get_prop","readable"]
|
||||
* 控件的状态(取值参考widget_state_t)。
|
||||
*/
|
||||
char* state;
|
||||
@ -1557,7 +1557,7 @@ ret_t widget_set_focusable(widget_t* widget, bool_t focusable);
|
||||
* 设置控件的状态。
|
||||
* @annotation ["scriptable"]
|
||||
* @param {widget_t*} widget 控件对象。
|
||||
* @param {const char*} state 状态(必须为真正的常量字符串,在widget的整个生命周期有效)。
|
||||
* @param {const char*} state 状态。
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*/
|
||||
|
@ -353,6 +353,12 @@ BEGIN_C_DECLS
|
||||
*/
|
||||
#define WIDGET_PROP_STYLE "style"
|
||||
|
||||
/**
|
||||
* @const WIDGET_PROP_STATE
|
||||
* 状态。
|
||||
*/
|
||||
#define WIDGET_PROP_STATE "state"
|
||||
|
||||
/**
|
||||
* @const WIDGET_PROP_ENABLE
|
||||
* 是否启用。
|
||||
|
Loading…
Reference in New Issue
Block a user