summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
author[email protected] <[email protected]>2010-09-24 11:30:54 +0000
committer[email protected] <[email protected]>2010-09-24 11:30:54 +0000
commitb324e1a2d218dd85a87e9f3266f0891f058bef78 (patch)
tree9fd79ec64c1bb71910c716057c7b7bff5141476e /components
parentbddae69d9c2e2b980cdeb6e1195517a6e8bee73a (diff)
fix view and workbench destroy issue.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@944 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components')
-rw-r--r--components/rtgui/include/rtgui/widgets/workbench.h1
-rw-r--r--components/rtgui/widgets/workbench.c19
2 files changed, 18 insertions, 2 deletions
diff --git a/components/rtgui/include/rtgui/widgets/workbench.h b/components/rtgui/include/rtgui/widgets/workbench.h
index 1038c92e09..7ada3553ca 100644
--- a/components/rtgui/include/rtgui/widgets/workbench.h
+++ b/components/rtgui/include/rtgui/widgets/workbench.h
@@ -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);
diff --git a/components/rtgui/widgets/workbench.c b/components/rtgui/widgets/workbench.c
index fd203f91e0..1ccc177453 100644
--- a/components/rtgui/widgets/workbench.c
+++ b/components/rtgui/widgets/workbench.c
@@ -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)