fix view and workbench destroy issue.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@944 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong@gmail.com 2010-09-24 11:30:54 +00:00
parent bddae69d9c
commit b324e1a2d2
2 changed files with 18 additions and 2 deletions

View File

@ -64,6 +64,7 @@ rtgui_type_t* rtgui_workbench_type_get(void);
rtgui_workbench_t *rtgui_workbench_create(const char* panel_name, const unsigned char* title);
void rtgui_workbench_destroy(rtgui_workbench_t* workbench);
void rtgui_workbench_close(rtgui_workbench_t* workbench);
rt_bool_t rtgui_workbench_event_handler(rtgui_widget_t* widget, rtgui_event_t* event);

View File

@ -135,6 +135,20 @@ void rtgui_workbench_destroy(rtgui_workbench_t* workbench)
{
RT_ASSERT(workbench != RT_NULL);
if (workbench->flag & RTGUI_WORKBENCH_FLAG_CLOSED)
{
rtgui_widget_destroy(RTGUI_WIDGET(workbench));
}
else
{
/* just close workbench */
rtgui_workbench_close(workbench);
}
}
void rtgui_workbench_close(rtgui_workbench_t* workbench)
{
/* detach workbench in server */
if (RTGUI_TOPLEVEL(workbench)->server != RT_NULL)
{
struct rtgui_event_panel_detach edetach;
@ -148,10 +162,11 @@ void rtgui_workbench_destroy(rtgui_workbench_t* workbench)
RTGUI_EVENT(&edetach), sizeof(struct rtgui_event_panel_detach)) != RT_EOK)
return;
RTGUI_TOPLEVEL(workbench)->server = RT_NULL;
RTGUI_TOPLEVEL(workbench)->server = RT_NULL;
}
rtgui_widget_destroy(RTGUI_WIDGET(workbench));
/* set status to close */
workbench->flag |= RTGUI_WORKBENCH_FLAG_CLOSED;
}
void rtgui_workbench_set_flag(rtgui_workbench_t* workbench, rt_uint8_t flag)