2012-04-18 23:06:12 +08:00
|
|
|
|
/*
|
2012-09-07 09:50:13 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>嵥<EFBFBD><EFBFBD>DC<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
2012-04-18 23:06:12 +08:00
|
|
|
|
*
|
2012-09-07 09:50:13 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӻ<EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>view<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾͼ<EFBFBD><EFBFBD>
|
2012-04-18 23:06:12 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "demo_view.h"
|
|
|
|
|
#include <rtgui/widgets/button.h>
|
|
|
|
|
#include <rtgui/widgets/filelist_view.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
#ifdef RT_USING_MODULE
|
2012-09-07 09:50:13 +08:00
|
|
|
|
#if defined(RTGUI_USING_DFS_FILERW)
|
2012-08-13 16:32:01 +08:00
|
|
|
|
static rtgui_container_t *_view = RT_NULL;
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-09-07 09:50:13 +08:00
|
|
|
|
/* <20><EFBFBD>ť<EFBFBD>Ļص<C4BB><D8B5><EFBFBD><EFBFBD><EFBFBD> */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
static void open_btn_onbutton(rtgui_widget_t *widget, struct rtgui_event *event)
|
2012-04-18 23:06:12 +08:00
|
|
|
|
{
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rtgui_filelist_view_t *view;
|
|
|
|
|
rtgui_workbench_t *workbench;
|
|
|
|
|
rtgui_rect_t rect;
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-09-07 09:50:13 +08:00
|
|
|
|
/* <20><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD>workbench */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
workbench = RTGUI_WORKBENCH(rtgui_widget_get_toplevel(widget));
|
|
|
|
|
rtgui_widget_get_rect(RTGUI_WIDGET(workbench), &rect);
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-09-07 09:50:13 +08:00
|
|
|
|
/* WIN32ƽ̨<C6BD>Ϻ<EFBFBD><CFBA><EFBFBD>ʵ<EFBFBD>豸<EFBFBD>ϵij<CFB5>ʼ·<CABC><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
2012-04-18 23:06:12 +08:00
|
|
|
|
#ifdef _WIN32
|
2012-08-13 16:32:01 +08:00
|
|
|
|
view = rtgui_filelist_view_create(workbench, "d:\\", "*.*", &rect);
|
2012-04-18 23:06:12 +08:00
|
|
|
|
#else
|
2012-08-13 16:32:01 +08:00
|
|
|
|
view = rtgui_filelist_view_create(workbench, "/", "*.*", &rect);
|
2012-04-18 23:06:12 +08:00
|
|
|
|
#endif
|
2012-09-07 09:50:13 +08:00
|
|
|
|
/* ģ̬<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> */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
if (rtgui_container_show(RTGUI_CONTAINER(view), RT_TRUE) == RTGUI_MODAL_OK)
|
|
|
|
|
{
|
|
|
|
|
char path[32], name[8];
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-09-07 09:50:13 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7><EFBFBD>ı<EFBFBD>ǩ */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rtgui_filelist_view_get_fullpath(view, path, sizeof(path));
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rt_memset(name, 0, sizeof(name));
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-09-07 09:50:13 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
if (rt_strstr(path, ".mo") != RT_NULL || rt_strstr(path, ".so") != RT_NULL)
|
|
|
|
|
{
|
|
|
|
|
rt_module_open(path);
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-09-07 09:50:13 +08:00
|
|
|
|
/* ɾ<><C9BE> <20>ļ<EFBFBD><C4BC>б<EFBFBD> <20><>ͼ */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rtgui_container_destroy(RTGUI_CONTAINER(view));
|
|
|
|
|
rtgui_container_show(_view, RT_FALSE);
|
2012-04-18 23:06:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-07 09:50:13 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾӦ<CABE><D3A6>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ͼ */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rtgui_container_t *demo_view_module(rtgui_workbench_t *workbench)
|
2012-04-18 23:06:12 +08:00
|
|
|
|
{
|
2012-08-13 16:32:01 +08:00
|
|
|
|
rtgui_rect_t rect;
|
|
|
|
|
rtgui_button_t *open_btn;
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-09-07 09:50:13 +08:00
|
|
|
|
/* <20>ȴ<EFBFBD><C8B4><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ͼ */
|
|
|
|
|
_view = demo_view(workbench, "Ӧ<EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ");
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-09-07 09:50:13 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ť */
|
2012-08-13 16:32:01 +08:00
|
|
|
|
demo_view_get_rect(_view, &rect);
|
|
|
|
|
rect.x1 += 5;
|
|
|
|
|
rect.x2 = rect.x1 + 120;
|
|
|
|
|
rect.y2 = rect.y1 + 20;
|
2012-09-07 09:50:13 +08:00
|
|
|
|
open_btn = rtgui_button_create("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>");
|
2012-08-13 16:32:01 +08:00
|
|
|
|
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);
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
return _view;
|
2012-04-18 23:06:12 +08:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|