2012-04-18 23:06:12 +08:00
|
|
|
|
/*
|
2012-08-13 16:32:01 +08:00
|
|
|
|
* 3<EFBFBD><EFBFBD>D<EFBFBD><EFBFBD>??<EFBFBD>̣<EFBFBD><EFBFBD><EFBFBD>oDC<EFBFBD><EFBFBD>???<EFBFBD><EFBFBD>?<EFBFBD><EFBFBD>????Y<EFBFBD><EFBFBD>?
|
2012-04-18 23:06:12 +08:00
|
|
|
|
*
|
2012-08-13 16:32:01 +08:00
|
|
|
|
* ?a??<EFBFBD><EFBFBD>y<EFBFBD><EFBFBD><EFBFBD><EFBFBD>?<EFBFBD><EFBFBD>?<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?<EFBFBD><EFBFBD>3?<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
|
|
|
|
|
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_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-08-13 16:32:01 +08:00
|
|
|
|
/* <20>䨰?a<><61><EFBFBD><EFBFBD>?<3F><><EFBFBD><EFBFBD>???<3F>̡<EFBFBD>o<EFBFBD><6F><EFBFBD><EFBFBD>y */
|
|
|
|
|
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-08-13 16:32:01 +08:00
|
|
|
|
/* ??<3F><>??<3F><>2?<3F><>?workbench */
|
|
|
|
|
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-08-13 16:32:01 +08:00
|
|
|
|
/* WIN32??<3F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?o<><6F>??<3F><><EFBFBD>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD>?<3F><>?<3F><>?3?<3F><>??<3F><>??<3F><>|<7C><><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-08-13 16:32:01 +08:00
|
|
|
|
/* ?<3F>ꨬ???<3F><>?<3F><>??????t<><74>D<EFBFBD><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?<3F><>?<3F><>?<3F><><EFBFBD><EFBFBD>1???<3F><>??<3F><>????<3F><>??????t */
|
|
|
|
|
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-08-13 16:32:01 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD>?????t?<3F><>??<3F><>?<3F><><EFBFBD><EFBFBD>?? */
|
|
|
|
|
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-08-13 16:32:01 +08:00
|
|
|
|
/* ??<3F><>?<3F><>|<7C><>??<3F><>?<3F><><EFBFBD><EFBFBD>?<3F><><EFBFBD><EFBFBD>D<EFBFBD><44> */
|
|
|
|
|
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-08-13 16:32:01 +08:00
|
|
|
|
/* <20><>?3y ???t<><74>D<EFBFBD><44><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>? */
|
|
|
|
|
rtgui_container_destroy(RTGUI_CONTAINER(view));
|
|
|
|
|
rtgui_container_show(_view, RT_FALSE);
|
2012-04-18 23:06:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD>?<3F><><EFBFBD><EFBFBD>?<3F><><EFBFBD><EFBFBD>??<3F><>?<3F><>|<7C><>??<3F><>?<3F><><EFBFBD><EFBFBD>??Y<><59>?<3F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>? */
|
|
|
|
|
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-08-13 16:32:01 +08:00
|
|
|
|
/* ?<3F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?<3F><><EFBFBD><EFBFBD>????Y<><59>?<3F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>? */
|
|
|
|
|
_view = demo_view(workbench, "<EFBFBD><EFBFBD>|<7C><>??<3F><>?<3F><>?Y<><59>?");
|
2012-04-18 23:06:12 +08:00
|
|
|
|
|
2012-08-13 16:32:01 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD>?<3F><><EFBFBD><EFBFBD>???<3F><><EFBFBD><EFBFBD>?<3F><> */
|
|
|
|
|
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>䨰?a<><61>|<7C><>??<3F><>?<3F><>");
|
|
|
|
|
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
|
|
|
|
|
|