mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-02 03:58:33 +08:00
improve list view
This commit is contained in:
parent
c20db258ed
commit
28f7ac2c3a
@ -1,5 +1,8 @@
|
||||
# 最新动态
|
||||
|
||||
2024/04/03
|
||||
* list_view 屏蔽组合键功能(感谢兆坤提供补丁)
|
||||
|
||||
2024/04/02
|
||||
* 完善针对特定语言加载字体,用'_'代替'.'连接语言名后缀。
|
||||
* 修复在agge模式下圆形进度条修改值的过程中修改风格颜色或者其他属性会导致画面不正常的问题(感谢智明提供补丁)
|
||||
|
@ -931,7 +931,6 @@ typedef struct _key_event_t {
|
||||
/**
|
||||
* @property {bool_t} ctrl
|
||||
* @annotation ["readable", "scriptable"]
|
||||
* right alt键是否按下。
|
||||
* ctrl键是否按下。
|
||||
*/
|
||||
bool_t ctrl;
|
||||
@ -968,7 +967,6 @@ typedef struct _key_event_t {
|
||||
/**
|
||||
* @property {bool_t} cmd
|
||||
* @annotation ["readable", "scriptable"]
|
||||
* left shift键是否按下。
|
||||
* cmd/win键是否按下。
|
||||
*/
|
||||
bool_t cmd;
|
||||
|
@ -88,7 +88,7 @@ static ret_t list_view_set_prop(widget_t* widget, const char* name, const value_
|
||||
return RET_NOT_FOUND;
|
||||
}
|
||||
|
||||
static ret_t list_view_hanlde_wheel_event(list_view_t* list_view, event_t* e) {
|
||||
static ret_t list_view_handle_wheel_event(list_view_t* list_view, event_t* e) {
|
||||
wheel_event_t* evt = (wheel_event_t*)e;
|
||||
int32_t delta = -evt->dy;
|
||||
if (list_view->scroll_bar != NULL) {
|
||||
@ -99,7 +99,7 @@ static ret_t list_view_hanlde_wheel_event(list_view_t* list_view, event_t* e) {
|
||||
}
|
||||
|
||||
static ret_t list_view_on_wheel_before(void* ctx, event_t* e) {
|
||||
return list_view_hanlde_wheel_event(LIST_VIEW(ctx), e);
|
||||
return list_view_handle_wheel_event(LIST_VIEW(ctx), e);
|
||||
}
|
||||
|
||||
static bool_t list_view_is_play_floating_scroll_bar_animtion(list_view_t* list_view) {
|
||||
@ -148,27 +148,29 @@ static ret_t list_view_on_event(widget_t* widget, event_t* e) {
|
||||
switch (e->type) {
|
||||
case EVT_WHEEL: {
|
||||
if (list_view->is_over) {
|
||||
ret = list_view_hanlde_wheel_event(list_view, e);
|
||||
ret = list_view_handle_wheel_event(list_view, e);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EVT_KEY_DOWN: {
|
||||
key_event_t* evt = (key_event_t*)e;
|
||||
if (evt->key == TK_KEY_PAGEDOWN) {
|
||||
scroll_view_scroll_delta_to(list_view->scroll_view, 0, widget->h, TK_ANIMATING_TIME);
|
||||
ret = RET_STOP;
|
||||
} else if (evt->key == TK_KEY_PAGEUP) {
|
||||
scroll_view_scroll_delta_to(list_view->scroll_view, 0, -widget->h, TK_ANIMATING_TIME);
|
||||
ret = RET_STOP;
|
||||
} else if (keyboard_type == KEYBOARD_NORMAL) {
|
||||
if (evt->key == TK_KEY_UP) {
|
||||
uint32_t item_height = tk_max(list_view->item_height, list_view->default_item_height);
|
||||
scroll_view_scroll_delta_to(list_view->scroll_view, 0, -item_height, TK_ANIMATING_TIME);
|
||||
if (!evt->alt && !evt->ctrl && !evt->shift && !evt->cmd && !evt->menu) {
|
||||
if (evt->key == TK_KEY_PAGEDOWN) {
|
||||
scroll_view_scroll_delta_to(list_view->scroll_view, 0, widget->h, TK_ANIMATING_TIME);
|
||||
ret = RET_STOP;
|
||||
} else if (evt->key == TK_KEY_DOWN) {
|
||||
uint32_t item_height = tk_max(list_view->item_height, list_view->default_item_height);
|
||||
scroll_view_scroll_delta_to(list_view->scroll_view, 0, item_height, TK_ANIMATING_TIME);
|
||||
} else if (evt->key == TK_KEY_PAGEUP) {
|
||||
scroll_view_scroll_delta_to(list_view->scroll_view, 0, -widget->h, TK_ANIMATING_TIME);
|
||||
ret = RET_STOP;
|
||||
} else if (keyboard_type == KEYBOARD_NORMAL) {
|
||||
if (evt->key == TK_KEY_UP) {
|
||||
uint32_t item_height = tk_max(list_view->item_height, list_view->default_item_height);
|
||||
scroll_view_scroll_delta_to(list_view->scroll_view, 0, -item_height, TK_ANIMATING_TIME);
|
||||
ret = RET_STOP;
|
||||
} else if (evt->key == TK_KEY_DOWN) {
|
||||
uint32_t item_height = tk_max(list_view->item_height, list_view->default_item_height);
|
||||
scroll_view_scroll_delta_to(list_view->scroll_view, 0, item_height, TK_ANIMATING_TIME);
|
||||
ret = RET_STOP;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user