improve edit/combox/mledit empty style

This commit is contained in:
lixianjing 2022-04-01 11:32:29 +08:00
parent 2f125171c2
commit d02297160c
4 changed files with 19 additions and 12 deletions

View File

@ -1,4 +1,7 @@
# 最新动态
2022/04/01
* 完善给edit、mledit和combo\_box增加了empty\_over状态感谢雨欣提供补丁
2022/03/31
* 增加带统计功能的stream (感谢林福提供)
* 增加移除和替换 qaction 的 action\_darray\_thread感谢林福提供)

View File

@ -510,8 +510,6 @@ static ret_t mledit_update_status(widget_t* widget) {
if (widget->text.size == 0) {
if (widget->focused) {
widget_set_state(widget, WIDGET_STATE_EMPTY_FOCUS);
} else if (tk_str_eq(widget->state, WIDGET_STATE_OVER)) {
widget_set_state(widget, WIDGET_STATE_EMPTY_OVER);
} else {
widget_set_state(widget, WIDGET_STATE_EMPTY);
}
@ -618,8 +616,11 @@ static ret_t mledit_on_event(widget_t* widget, event_t* e) {
break;
}
case EVT_POINTER_ENTER:
widget_set_state(widget, WIDGET_STATE_OVER);
mledit_update_status(widget);
if (widget->text.size == 0) {
widget_set_state(widget, WIDGET_STATE_EMPTY_OVER);
} else {
widget_set_state(widget, WIDGET_STATE_OVER);
}
break;
case EVT_POINTER_DOWN: {
pointer_event_t evt = *(pointer_event_t*)e;

View File

@ -101,8 +101,6 @@ static ret_t combo_box_update_status(widget_t* widget) {
if (widget->text.size == 0) {
if (widget->focused) {
widget_set_state(widget, WIDGET_STATE_EMPTY_FOCUS);
} else if (tk_str_eq(widget->state, WIDGET_STATE_OVER)) {
widget_set_state(widget, WIDGET_STATE_EMPTY_OVER);
} else {
widget_set_state(widget, WIDGET_STATE_EMPTY);
}
@ -434,8 +432,12 @@ static ret_t combo_box_on_event(widget_t* widget, event_t* e) {
return combo_box_update_status(widget);
break;
case EVT_POINTER_ENTER:
widget_set_state(widget, WIDGET_STATE_OVER);
return combo_box_update_status(widget);
if (widget->text.size == 0) {
widget_set_state(widget, WIDGET_STATE_EMPTY_OVER);
} else {
widget_set_state(widget, WIDGET_STATE_OVER);
}
return RET_OK;
break;
default:
break;

View File

@ -496,8 +496,6 @@ static ret_t edit_update_status(widget_t* widget) {
if (widget->text.size == 0) {
if (widget->focused) {
widget_set_state(widget, WIDGET_STATE_EMPTY_FOCUS);
} else if (tk_str_eq(widget->state, WIDGET_STATE_OVER)) {
widget_set_state(widget, WIDGET_STATE_EMPTY_OVER);
} else {
widget_set_state(widget, WIDGET_STATE_EMPTY);
}
@ -915,8 +913,11 @@ ret_t edit_on_event(widget_t* widget, event_t* e) {
edit_update_status(widget);
break;
case EVT_POINTER_ENTER:
widget_set_state(widget, WIDGET_STATE_OVER);
edit_update_status(widget);
if (widget->text.size == 0) {
widget_set_state(widget, WIDGET_STATE_EMPTY_OVER);
} else {
widget_set_state(widget, WIDGET_STATE_OVER);
}
break;
default:
break;