2010-09-27 21:21:30 +08:00
|
|
|
|
/*
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>嵥<EFBFBD><EFBFBD>DC<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
*
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӻ<EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>view<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾͼ<EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "demo_view.h"
|
|
|
|
|
#include <rtgui/widgets/button.h>
|
|
|
|
|
#include <rtgui/widgets/filelist_view.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
2010-09-28 07:30:22 +08:00
|
|
|
|
#ifdef RT_USING_MODULE
|
2010-11-29 17:19:46 +08:00
|
|
|
|
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
|
2010-09-27 21:21:30 +08:00
|
|
|
|
static rtgui_view_t* _view = RT_NULL;
|
|
|
|
|
|
|
|
|
|
/* <20><EFBFBD>ť<EFBFBD>Ļص<C4BB><D8B5><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
static void open_btn_onbutton(rtgui_widget_t* widget, struct rtgui_event* event)
|
|
|
|
|
{
|
|
|
|
|
rtgui_filelist_view_t *view;
|
|
|
|
|
rtgui_workbench_t *workbench;
|
|
|
|
|
rtgui_rect_t rect;
|
|
|
|
|
|
|
|
|
|
/* <20><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD>workbench */
|
|
|
|
|
workbench = RTGUI_WORKBENCH(rtgui_widget_get_toplevel(widget));
|
|
|
|
|
rtgui_widget_get_rect(RTGUI_WIDGET(workbench), &rect);
|
|
|
|
|
|
|
|
|
|
/* WIN32ƽ̨<C6BD>Ϻ<EFBFBD><CFBA><EFBFBD>ʵ<EFBFBD>豸<EFBFBD>ϵij<CFB5>ʼ·<CABC><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
view = rtgui_filelist_view_create(workbench, "d:\\", "*.*", &rect);
|
|
|
|
|
#else
|
|
|
|
|
view = rtgui_filelist_view_create(workbench, "/", "*.*", &rect);
|
|
|
|
|
#endif
|
|
|
|
|
/* ģ̬<C4A3><CCAC>ʾһ<CABE><D2BB><EFBFBD>ļ<EFBFBD><C4BC>б<EFBFBD><D0B1><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD>ṩ<EFBFBD><E1B9A9><EFBFBD>û<EFBFBD>ѡ<EFBFBD><D1A1>ͼ<EFBFBD><CDBC><EFBFBD>ļ<EFBFBD> */
|
|
|
|
|
if (rtgui_view_show(RTGUI_VIEW(view), RT_TRUE) == RTGUI_MODAL_OK)
|
|
|
|
|
{
|
|
|
|
|
char path[32], name[8];
|
|
|
|
|
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7><EFBFBD>ı<EFBFBD>ǩ */
|
|
|
|
|
rtgui_filelist_view_get_fullpath(view, path, sizeof(path));
|
2010-10-19 17:22:56 +08:00
|
|
|
|
|
2010-09-27 21:21:30 +08:00
|
|
|
|
rt_memset(name, 0, sizeof(name));
|
|
|
|
|
|
2010-11-18 00:17:07 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
2010-10-19 17:22:56 +08:00
|
|
|
|
if (rt_strstr(path, ".mo") != RT_NULL || rt_strstr(path, ".so") != RT_NULL)
|
2010-09-27 21:21:30 +08:00
|
|
|
|
{
|
2010-11-18 00:17:07 +08:00
|
|
|
|
rt_module_open(path);
|
2010-09-27 21:21:30 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ɾ<><C9BE> <20>ļ<EFBFBD><C4BC>б<EFBFBD> <20><>ͼ */
|
|
|
|
|
rtgui_view_destroy(RTGUI_VIEW(view));
|
|
|
|
|
rtgui_view_show(_view, RT_FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾӦ<CABE><D3A6>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ͼ */
|
|
|
|
|
rtgui_view_t* demo_view_module(rtgui_workbench_t* workbench)
|
|
|
|
|
{
|
|
|
|
|
rtgui_rect_t rect;
|
|
|
|
|
rtgui_button_t* open_btn;
|
|
|
|
|
|
|
|
|
|
/* <20>ȴ<EFBFBD><C8B4><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ͼ */
|
|
|
|
|
_view = demo_view(workbench, "Ӧ<EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ");
|
|
|
|
|
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ť */
|
|
|
|
|
demo_view_get_rect(_view, &rect);
|
|
|
|
|
rect.x1 += 5; rect.x2 = rect.x1 + 120;
|
|
|
|
|
rect.y2 = rect.y1 + 20;
|
|
|
|
|
open_btn = rtgui_button_create("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>");
|
|
|
|
|
rtgui_container_add_child(RTGUI_CONTAINER(_view), RTGUI_WIDGET(open_btn));
|
|
|
|
|
rtgui_widget_set_rect(RTGUI_WIDGET(open_btn), &rect);
|
|
|
|
|
rtgui_button_set_onbutton(open_btn, open_btn_onbutton);
|
|
|
|
|
|
|
|
|
|
return _view;
|
|
|
|
|
}
|
2010-09-28 07:30:22 +08:00
|
|
|
|
#endif
|
2010-11-29 17:19:46 +08:00
|
|
|
|
#endif
|
|
|
|
|
|