add return action in listview demo.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@364 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
7669398ee7
commit
d117e5a4fe
|
@ -5,6 +5,8 @@
|
||||||
#include <rtgui/widgets/list_view.h>
|
#include <rtgui/widgets/list_view.h>
|
||||||
|
|
||||||
static rtgui_workbench_t* workbench = RT_NULL;
|
static rtgui_workbench_t* workbench = RT_NULL;
|
||||||
|
static rtgui_view_t* _view = RT_NULL;
|
||||||
|
static rtgui_image_t* return_image = RT_NULL;
|
||||||
|
|
||||||
static void listitem_action(void* parameter)
|
static void listitem_action(void* parameter)
|
||||||
{
|
{
|
||||||
|
@ -33,35 +35,44 @@ static void listitem_action(void* parameter)
|
||||||
rtgui_win_show(win, RT_FALSE);
|
rtgui_win_show(win, RT_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct rtgui_list_item items[] =
|
static void return_action(void* parameter)
|
||||||
|
{
|
||||||
|
if (_view != RT_NULL)
|
||||||
|
{
|
||||||
|
rtgui_view_destroy(_view);
|
||||||
|
_view = RT_NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct rtgui_list_item items[] =
|
||||||
{
|
{
|
||||||
{"ÁбíÏî1", RT_NULL, listitem_action, (void*)1},
|
{"ÁбíÏî1", RT_NULL, listitem_action, (void*)1},
|
||||||
{"ÁбíÏî2", RT_NULL, listitem_action, (void*)2},
|
{"ÁбíÏî2", RT_NULL, listitem_action, (void*)2},
|
||||||
{"ÁбíÏî3", RT_NULL, listitem_action, (void*)3},
|
{"ÁбíÏî3", RT_NULL, listitem_action, (void*)3},
|
||||||
{"ÁбíÏî4", RT_NULL, listitem_action, (void*)4},
|
{"ÁбíÏî4", RT_NULL, listitem_action, (void*)4},
|
||||||
{"ÁбíÏî5", RT_NULL, listitem_action, (void*)5},
|
{"ÁбíÏî5", RT_NULL, listitem_action, (void*)5},
|
||||||
|
{"·µ»Ø", RT_NULL, return_action, RT_NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
static void open_btn_onbutton(rtgui_widget_t* widget, struct rtgui_event* event)
|
static void open_btn_onbutton(rtgui_widget_t* widget, struct rtgui_event* event)
|
||||||
{
|
{
|
||||||
/* create a file list view */
|
/* create a file list view */
|
||||||
rtgui_rect_t rect;
|
rtgui_rect_t rect;
|
||||||
rtgui_list_view_t *view;
|
|
||||||
|
|
||||||
workbench = RTGUI_WORKBENCH(rtgui_widget_get_toplevel(widget));
|
workbench = RTGUI_WORKBENCH(rtgui_widget_get_toplevel(widget));
|
||||||
rtgui_widget_get_rect(RTGUI_WIDGET(workbench), &rect);
|
rtgui_widget_get_rect(RTGUI_WIDGET(workbench), &rect);
|
||||||
|
|
||||||
view = rtgui_list_view_create(items, sizeof(items)/sizeof(struct rtgui_list_item), &rect);
|
_view = rtgui_list_view_create(items, sizeof(items)/sizeof(struct rtgui_list_item), &rect);
|
||||||
rtgui_workbench_add_view(workbench, RTGUI_VIEW(view));
|
rtgui_workbench_add_view(workbench, RTGUI_VIEW(_view));
|
||||||
|
|
||||||
/* ģʽÏÔʾÊÓͼ */
|
/* ģʽÏÔʾÊÓͼ */
|
||||||
rtgui_view_show(RTGUI_VIEW(view), RT_FALSE);
|
rtgui_view_show(RTGUI_VIEW(_view), RT_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
rtgui_view_t* demo_listview_view(rtgui_workbench_t* workbench)
|
rtgui_view_t* demo_listview_view(rtgui_workbench_t* workbench)
|
||||||
{
|
{
|
||||||
rtgui_rect_t rect;
|
rtgui_rect_t rect;
|
||||||
rtgui_view_t* view;
|
rtgui_list_view_t *view;
|
||||||
rtgui_button_t* open_btn;
|
rtgui_button_t* open_btn;
|
||||||
|
|
||||||
view = demo_view(workbench, "ÁбíÊÓͼÑÝʾ");
|
view = demo_view(workbench, "ÁбíÊÓͼÑÝʾ");
|
||||||
|
|
Loading…
Reference in New Issue