/* * 3足D辰??米ㄓ㏒oDC谷???那?赤????Y那? * * ?a??角y℅車?芍?迆∩∩?“3?米?view谷???那?赤??? */ #include "demo_view.h" #include #include #include #ifdef RT_USING_MODULE #if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW) static rtgui_container_t *_view = RT_NULL; /* ∩辰?a∼∩?ㄓ米???米‾o‘那y */ 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; /* ??米??ㄓ2?米?workbench */ workbench = RTGUI_WORKBENCH(rtgui_widget_get_toplevel(widget)); rtgui_widget_get_rect(RTGUI_WIDGET(workbench), &rect); /* WIN32??足“谷?o赤??那米谷豕㊣?谷?米?3?那??﹞??∩|角赤 */ #ifdef _WIN32 view = rtgui_filelist_view_create(workbench, "d:\\", "*.*", &rect); #else view = rtgui_filelist_view_create(workbench, "/", "*.*", &rect); #endif /* ?㏒足???那?辰??????t芍D㊣赤那車赤?㏒?辰?足芍1???車??∫????赤??????t */ if (rtgui_container_show(RTGUI_CONTAINER(view), RT_TRUE) == RTGUI_MODAL_OK) { char path[32], name[8]; /* 谷豕?????t?﹞??米?㊣那?? */ rtgui_filelist_view_get_fullpath(view, path, sizeof(path)); rt_memset(name, 0, sizeof(name)); /* ??米?車|車??㏒?谷米?角角D赤 */ if (rt_strstr(path, ".mo") != RT_NULL || rt_strstr(path, ".so") != RT_NULL) { rt_module_open(path); } } /* 谷?3y ???t芍D㊣赤 那車赤? */ rtgui_container_destroy(RTGUI_CONTAINER(view)); rtgui_container_show(_view, RT_FALSE); } /* ∩∩?“車?車迆??那?車|車??㏒?谷米??Y那?那車赤? */ rtgui_container_t *demo_view_module(rtgui_workbench_t *workbench) { rtgui_rect_t rect; rtgui_button_t *open_btn; /* ?豕∩∩?“辰????Y那?那車赤? */ _view = demo_view(workbench, "車|車??㏒?谷?Y那?"); /* 足赤?車辰???∼∩?ㄓ */ demo_view_get_rect(_view, &rect); rect.x1 += 5; rect.x2 = rect.x1 + 120; rect.y2 = rect.y1 + 20; open_btn = rtgui_button_create("∩辰?a車|車??㏒?谷"); 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; } #endif #endif