summaryrefslogtreecommitdiff
path: root/components/rtgui/widgets/widget.c
diff options
context:
space:
mode:
author[email protected] <[email protected]>2012-07-21 12:18:51 +0000
committer[email protected] <[email protected]>2012-07-21 12:18:51 +0000
commitf2503a770fdacdc01a68bfa638e9b40a7121644d (patch)
tree528c7b0e4f26e586ea5aba2f5f7c0dae7bd30d63 /components/rtgui/widgets/widget.c
parent8c0310450783ed9028221168e60551554fbee8d2 (diff)
sync with github 5892d5b7
Add update_toplevel event. As always, full log is in GitHub. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2224 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui/widgets/widget.c')
-rw-r--r--components/rtgui/widgets/widget.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/components/rtgui/widgets/widget.c b/components/rtgui/widgets/widget.c
index dbdd644ce2..97ff00fea9 100644
--- a/components/rtgui/widgets/widget.c
+++ b/components/rtgui/widgets/widget.c
@@ -145,13 +145,6 @@ void rtgui_widget_set_parent(rtgui_widget_t* widget, rtgui_widget_t* parent)
{
/* set parent and toplevel widget */
widget->parent = parent;
-
- /* update children toplevel */
- if (parent->toplevel != RT_NULL &&
- RTGUI_IS_TOPLEVEL(parent->toplevel))
- {
- widget->toplevel = rtgui_widget_get_toplevel(parent);
- }
}
void rtgui_widget_get_extent(rtgui_widget_t* widget, rtgui_rect_t *rect)
@@ -402,6 +395,22 @@ struct rtgui_win* rtgui_widget_get_toplevel(rtgui_widget_t* widget)
return RTGUI_WIN(r);
}
+rt_bool_t rtgui_widget_onupdate_toplvl(struct rtgui_object *object, struct rtgui_event *event)
+{
+ struct rtgui_widget *widget;
+ struct rtgui_event_update_toplvl *eup;
+
+ RT_ASSERT(object);
+ RT_ASSERT(event);
+
+ widget = RTGUI_WIDGET(object);
+ eup = (struct rtgui_event_update_toplvl*)event;
+
+ widget->toplevel = eup->toplvl;
+
+ return RT_FALSE;
+}
+
rt_bool_t rtgui_widget_event_handler(struct rtgui_object* object, rtgui_event_t* event)
{
RT_ASSERT(object != RT_NULL);
@@ -413,6 +422,8 @@ rt_bool_t rtgui_widget_event_handler(struct rtgui_object* object, rtgui_event_t*
return rtgui_widget_onshow(object, event);
case RTGUI_EVENT_HIDE:
return rtgui_widget_onhide(object, event);
+ case RTGUI_EVENT_UPDATE_TOPLVL:
+ return rtgui_widget_onupdate_toplvl(object, event);
#ifndef RTGUI_USING_SMALL_SIZE
case RTGUI_EVENT_PAINT:
if (widget->on_draw != RT_NULL)