summaryrefslogtreecommitdiff
path: root/components/rtgui/widgets
diff options
context:
space:
mode:
author[email protected] <[email protected]>2011-01-25 00:05:52 +0000
committer[email protected] <[email protected]>2011-01-25 00:05:52 +0000
commit211e1aa33446574d3b6e11bd3cefc27fb6b9306b (patch)
treea0dd64fceabe8d8c46fa70e7a3c195fc7f272d79 /components/rtgui/widgets
parentffa3e22d2e7440a6e93e8142e18a7c6a17997511 (diff)
re-write external clip.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1261 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui/widgets')
-rw-r--r--components/rtgui/widgets/toplevel.c55
-rw-r--r--components/rtgui/widgets/widget.c13
2 files changed, 3 insertions, 65 deletions
diff --git a/components/rtgui/widgets/toplevel.c b/components/rtgui/widgets/toplevel.c
index 0f12c22f68..dd501cf91e 100644
--- a/components/rtgui/widgets/toplevel.c
+++ b/components/rtgui/widgets/toplevel.c
@@ -24,8 +24,6 @@ static void _rtgui_toplevel_constructor(rtgui_toplevel_t *toplevel)
/* init toplevel property */
toplevel->drawing = 0;
- toplevel->external_clip_rect = RT_NULL;
- toplevel->external_clip_size = 0;
/* hide toplevel default */
RTGUI_WIDGET_HIDE(RTGUI_WIDGET(toplevel));
@@ -38,12 +36,6 @@ static void _rtgui_toplevel_destructor(rtgui_toplevel_t* toplevel)
{
/* release external clip info */
toplevel->drawing = 0;
- if (toplevel->external_clip_size > 0)
- {
- rtgui_free(toplevel->external_clip_rect);
- toplevel->external_clip_rect = RT_NULL;
- toplevel->external_clip_size = 0;
- }
}
rtgui_type_t *rtgui_toplevel_type_get(void)
@@ -75,9 +67,6 @@ rt_bool_t rtgui_toplevel_event_handler(rtgui_widget_t* widget, rtgui_event_t* ev
break;
case RTGUI_EVENT_CLIP_INFO:
- /* set toplevel external clip info */
- rtgui_toplevel_handle_clip(toplevel, (struct rtgui_event_clip_info*)event);
-
/* update toplevel clip */
rtgui_toplevel_update_clip(toplevel);
break;
@@ -116,44 +105,6 @@ rt_bool_t rtgui_toplevel_event_handler(rtgui_widget_t* widget, rtgui_event_t* ev
return RT_FALSE;
}
-#include <rtgui/widgets/window.h>
-#include <rtgui/widgets/workbench.h>
-#include <rtgui/widgets/title.h>
-
-void rtgui_toplevel_handle_clip(struct rtgui_toplevel* top,
- struct rtgui_event_clip_info* info)
-{
- RT_ASSERT(top != RT_NULL);
- RT_ASSERT(info != RT_NULL);
-
- /* release old rect array */
- if (top->external_clip_size != 0)
- {
- rtgui_free(top->external_clip_rect);
- top->external_clip_rect = RT_NULL;
- top->external_clip_size = 0;
- }
-
- /* no rect info */
- if (info->num_rect == 0) return;
-
- top->external_clip_rect = (rtgui_rect_t*) rtgui_malloc(sizeof(rtgui_rect_t) *
- info->num_rect);
- top->external_clip_size = info->num_rect;
-
-#ifdef RTGUI_USING_SMALL_SIZE
- {
- extern void rtgui_topwin_get_clipinfo(struct rtgui_rect* list, rt_int32_t count);
-
- /* get rect list from topwin list */
- rtgui_topwin_get_clipinfo(top->external_clip_rect, top->external_clip_size);
- }
-#else
- /* copy rect array */
- rt_memcpy(top->external_clip_rect, (void*)(info + 1), sizeof(rtgui_rect_t) * info->num_rect);
-#endif
-}
-
#include <rtgui/driver.h> /* to get screen rect */
void rtgui_toplevel_update_clip(rtgui_toplevel_t* top)
@@ -176,11 +127,7 @@ void rtgui_toplevel_update_clip(rtgui_toplevel_t* top)
&screen_rect);
/* subtract the external rect */
- for (idx = 0; idx < top->external_clip_size; idx ++)
- {
- rtgui_region_subtract_rect(&(RTGUI_WIDGET(top)->clip), &(RTGUI_WIDGET(top)->clip),
- &(top->external_clip_rect[idx]));
- }
+ rtgui_topwin_do_clip(RTGUI_WIDGET(top));
/* update the clip info of each child */
container = RTGUI_CONTAINER(top);
diff --git a/components/rtgui/widgets/widget.c b/components/rtgui/widgets/widget.c
index 304e59b86c..0946dd8fa0 100644
--- a/components/rtgui/widgets/widget.c
+++ b/components/rtgui/widgets/widget.c
@@ -509,11 +509,8 @@ void rtgui_widget_hide(rtgui_widget_t* widget)
if (widget->parent != RT_NULL)
{
- int index;
rtgui_widget_t *parent;
- rtgui_toplevel_t *toplevel;
- rect = widget->extent;
parent = widget->parent;
/* get the no transparent parent */
while (parent != RT_NULL && parent->flag & RTGUI_WIDGET_FLAG_TRANSPARENT)
@@ -522,16 +519,10 @@ void rtgui_widget_hide(rtgui_widget_t* widget)
}
/* union widget rect */
- rtgui_region_union_rect(&(widget->parent->clip), &(widget->parent->clip), &rect);
+ rtgui_region_union_rect(&(parent->clip), &(parent->clip), &(widget->extent));
- /* handle extern rect */
- toplevel = RTGUI_TOPLEVEL(widget->toplevel);
/* subtract the external rect */
- for (index = 0; index < toplevel->external_clip_size; index ++)
- {
- rtgui_region_subtract_rect(&(widget->parent->clip), &(widget->parent->clip),
- &(toplevel->external_clip_rect[index]));
- }
+ rtgui_topwin_do_clip(RTGUI_WIDGET(parent));
}
}