improve edit/mledit to handle resize event

This commit is contained in:
xianjimli 2019-08-17 08:23:32 +08:00
parent 48ed82673e
commit 098b215a63
4 changed files with 38 additions and 0 deletions

View File

@ -1,6 +1,7 @@
# 最新动态
* 2019/08/16
* slider 支持非正方形的icon感谢俊杰提供补丁
* edit/mledit处理resize事件。
* 2019/08/16
* 引入片段帧缓存(Fragment Frame Buffer)部分解决STMF103上由于没足够内存做FrameBuffer导致闪烁的问题。

View File

@ -260,8 +260,35 @@ ret_t text_edit_set_mask_char(text_edit_t* text_edit, wchar_t mask_char);
*/
ret_t text_edit_paint(text_edit_t* text_edit, canvas_t* c);
/**
* @method text_edit_layout
*
* @param {text_edit_t*} text_edit text_edit对象
*
* @return {ret_t} RET_OK表示成功
*/
ret_t text_edit_layout(text_edit_t* text_edit);
/**
* @method text_edit_set_offset
*
* @param {text_edit_t*} text_edit text_edit对象
* @param {int32_t} ox x偏移量
* @param {int32_t} oy y偏移量
*
* @return {ret_t} RET_OK表示成功
*/
ret_t text_edit_set_offset(text_edit_t* text_edit, int32_t ox, int32_t oy);
/**
* @method text_edit_set_on_state_changed
*
* @param {text_edit_t*} text_edit text_edit对象
* @param {text_edit_on_state_changed_t} on_state_changed
* @param {void*} ctx
*
* @return {ret_t} RET_OK表示成功
*/
ret_t text_edit_set_on_state_changed(text_edit_t* text_edit,
text_edit_on_state_changed_t on_state_changed, void* ctx);

View File

@ -397,6 +397,11 @@ static ret_t mledit_on_event(widget_t* widget, event_t* e) {
}
break;
}
case EVT_RESIZE:
case EVT_MOVE_RESIZE: {
text_edit_layout(mledit->model);
break;
}
case EVT_VALUE_CHANGING: {
mledit_update_status(widget);
break;

View File

@ -546,6 +546,11 @@ ret_t edit_on_event(widget_t* widget, event_t* e) {
}
break;
}
case EVT_RESIZE:
case EVT_MOVE_RESIZE: {
text_edit_layout(edit->model);
break;
}
case EVT_VALUE_CHANGING: {
edit_update_status(widget);
break;