mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-02 03:58:33 +08:00
improve hscroll_label
This commit is contained in:
parent
8c9e92f75b
commit
acfbb49056
@ -1,7 +1,8 @@
|
||||
# 最新动态
|
||||
|
||||
2021/04/06
|
||||
* add idle\_queue\_ex/timer\_queue\_ex for script binding.
|
||||
* 增加 idle\_queue\_ex/timer\_queue\_ex 方便脚本绑定时使用。
|
||||
* 增加 hscroll\_label检测焦点状态下长度变化重新播放动画的机制(感谢智明提供补丁)
|
||||
|
||||
2021/04/04
|
||||
* 增加 gui\_app\_start\_ex,方便嵌入式系统指定资源路径。
|
||||
|
@ -40,6 +40,12 @@ static ret_t hscroll_label_do_paint_self(widget_t* widget, canvas_t* c, uint32_t
|
||||
hscroll_label_t* hscroll_label = HSCROLL_LABEL(widget);
|
||||
|
||||
hscroll_label->text_w = canvas_measure_text(c, text->str, text->size);
|
||||
if (hscroll_label->text_w != hscroll_label->old_text_w) {
|
||||
if (tk_str_eq(widget->state, WIDGET_STATE_FOCUSED)) {
|
||||
hscroll_label_start(widget);
|
||||
}
|
||||
hscroll_label->old_text_w = hscroll_label->text_w;
|
||||
}
|
||||
if (w < hscroll_label->text_w && hscroll_label->ellipses && !hscroll_label_is_running(widget)) {
|
||||
r = rect_init(left_margin, 0, w, widget->h);
|
||||
|
||||
@ -332,6 +338,10 @@ static ret_t hscroll_label_on_timer(const timer_info_t* info) {
|
||||
}
|
||||
}
|
||||
|
||||
if (ret != RET_REPEAT) {
|
||||
hscroll_label->timer_id = TK_INVALID_ID;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -125,6 +125,7 @@ typedef struct _hscroll_label_t {
|
||||
int32_t text_w;
|
||||
|
||||
/*private*/
|
||||
int32_t old_text_w;
|
||||
uint32_t timer_id;
|
||||
uint32_t elapsed;
|
||||
bool_t paused;
|
||||
|
Loading…
Reference in New Issue
Block a user