improve candidates

This commit is contained in:
xianjimli 2020-08-07 17:46:16 +08:00
parent f15413188d
commit 1e67642f3e
2 changed files with 5 additions and 1 deletions

View File

@ -1,5 +1,8 @@
# 最新动态
* 2020/08/07
* 候选字控件 (candidate) 支持设置 margin style。
* 2020/08/06
* 完善离线 lcd感谢智明提供补丁
* 完善 slist (感谢智明提供补丁)。

View File

@ -138,12 +138,13 @@ static ret_t candidates_relayout_children(widget_t* widget) {
style_t* style = children[0]->astyle;
canvas_t* c = widget_get_canvas(widget);
const char* font = system_info_fix_font_name(NULL);
int32_t child_margin = style_get_int(style, STYLE_ID_MARGIN, 0);
uint16_t font_size = style_get_int(style, STYLE_ID_FONT_SIZE, TK_DEFAULT_FONT_SIZE);
canvas_set_font(c, font, font_size);
for (i = 0; i < nr; i++) {
iter = children[i];
child_w = candidates_calc_child_width(c, iter);
child_w = candidates_calc_child_width(c, iter) + child_margin* 2;
if (iter->text.size) {
widget_set_visible(iter, TRUE, FALSE);
} else {