add widget parameter in item action function callback.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@863 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong@gmail.com 2010-08-17 23:29:32 +00:00
parent 9a3f67746f
commit 0c31a7c3ae
2 changed files with 7 additions and 4 deletions

View File

@ -21,7 +21,7 @@
#include <rtgui/widgets/view.h>
typedef void (*item_action)(void* parameter);
typedef void (*item_action)(struct rtgui_widget* widget, void* parameter);
struct rtgui_list_item
{
char* name;

View File

@ -373,7 +373,8 @@ static rt_bool_t rtgui_list_view_onmouse(struct rtgui_list_view* view, struct rt
/* up event */
if (view->items[view->current_item].action != RT_NULL)
{
view->items[view->current_item].action(view->items[view->current_item].parameter);
view->items[view->current_item].action(RTGUI_WIDGET(view),
view->items[view->current_item].parameter);
}
}
}
@ -407,7 +408,8 @@ static rt_bool_t rtgui_list_view_onmouse(struct rtgui_list_view* view, struct rt
/* up event */
if (view->items[view->current_item].action != RT_NULL)
{
view->items[view->current_item].action(view->items[view->current_item].parameter);
view->items[view->current_item].action(RTGUI_WIDGET(view),
view->items[view->current_item].parameter);
}
}
}
@ -537,7 +539,8 @@ rt_bool_t rtgui_list_view_event_handler(struct rtgui_widget* widget, struct rtgu
case RTGUIK_RETURN:
if (view->items[view->current_item].action != RT_NULL)
{
view->items[view->current_item].action(view->items[view->current_item].parameter);
view->items[view->current_item].action(RTGUI_WIDGET(view),
view->items[view->current_item].parameter);
}
return RT_FALSE;