diff options
| author | bernard.xiong <[email protected]> | 2011-05-23 06:46:44 +0000 |
|---|---|---|
| committer | bernard.xiong <[email protected]> | 2011-05-23 06:46:44 +0000 |
| commit | a876302695ffafb57a8643f96697e283a814f074 (patch) | |
| tree | 50846ffca90ecdd3c7861574c69a8bfc50953ffd /components | |
| parent | 712aacd36744da94182fe2c9e8c0b05f55b3e565 (diff) | |
fix some compiling warning, errors in the new object system.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1425 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components')
| -rw-r--r-- | components/rtgui/common/rtgui_object.c | 34 | ||||
| -rw-r--r-- | components/rtgui/include/rtgui/rtgui_object.h | 16 | ||||
| -rw-r--r-- | components/rtgui/widgets/container.c | 2 | ||||
| -rw-r--r-- | components/rtgui/widgets/menu.c | 4 | ||||
| -rw-r--r-- | components/rtgui/widgets/toplevel.c | 2 | ||||
| -rw-r--r-- | components/rtgui/widgets/widget.c | 3 |
6 files changed, 30 insertions, 31 deletions
diff --git a/components/rtgui/common/rtgui_object.c b/components/rtgui/common/rtgui_object.c index 12bc29a6fb..f3f779e3a8 100644 --- a/components/rtgui/common/rtgui_object.c +++ b/components/rtgui/common/rtgui_object.c @@ -34,7 +34,7 @@ DEFINE_CLASS_TYPE(type, "object", _rtgui_object_destructor, sizeof(struct rtgui_object)); -void rtgui_type_object_construct(rtgui_type_t *type, rtgui_object_t *object) +void rtgui_type_object_construct(const rtgui_type_t *type, rtgui_object_t *object) { /* first call parent's type */ if (type->parent != RT_NULL) @@ -43,32 +43,38 @@ void rtgui_type_object_construct(rtgui_type_t *type, rtgui_object_t *object) if (type->constructor) type->constructor(object); } -void rtgui_type_destructors_call(rtgui_type_t *type, rtgui_object_t *object) -{ - while (type) +void rtgui_type_destructors_call(const rtgui_type_t *type, rtgui_object_t *object) +{
+ const rtgui_type_t *t;
+
+ t = type; + while (t) { - if (type->destructor) type->destructor(object); - type = type->parent; + if (t->destructor) t->destructor(object); + t = t->parent; } } -rt_bool_t rtgui_type_inherits_from(rtgui_type_t *type, rtgui_type_t *parent) -{ - while (type) +rt_bool_t rtgui_type_inherits_from(const rtgui_type_t *type, const rtgui_type_t *parent) +{
+ const rtgui_type_t *t;
+
+ t = type; + while (t) { - if (type == parent) return RT_TRUE; - type = type->parent; + if (t == parent) return RT_TRUE; + t = t->parent; } return RT_FALSE; } -rtgui_type_t *rtgui_type_parent_type_get(rtgui_type_t *type) +const rtgui_type_t *rtgui_type_parent_type_get(const rtgui_type_t *type) { return type->parent; } -const char *rtgui_type_name_get(rtgui_type_t *type) +const char *rtgui_type_name_get(const rtgui_type_t *type) { if (!type) return RT_NULL; @@ -165,7 +171,7 @@ rtgui_object_t *rtgui_object_check_cast(rtgui_object_t *obj, rtgui_type_t *obj_t * @param object an object * @return Returns the type of @a object (RT_NULL on failure) */ -rtgui_type_t *rtgui_object_object_type_get(rtgui_object_t *object) +const rtgui_type_t *rtgui_object_object_type_get(rtgui_object_t *object) { if (!object) return RT_NULL; diff --git a/components/rtgui/include/rtgui/rtgui_object.h b/components/rtgui/include/rtgui/rtgui_object.h index 2010d9b403..20da0485b8 100644 --- a/components/rtgui/include/rtgui/rtgui_object.h +++ b/components/rtgui/include/rtgui/rtgui_object.h @@ -60,16 +60,16 @@ typedef struct rtgui_type rtgui_type_t; const struct rtgui_type _rtgui_##type = { \
name, \
parent, \
- constructor, \
- destructor, \
+ RTGUI_CONSTRUCTOR(constructor), \
+ RTGUI_DESTRUCTOR(destructor), \
size }
-void rtgui_type_object_construct(rtgui_type_t *type, rtgui_object_t *object);
-void rtgui_type_destructors_call(rtgui_type_t *type, rtgui_object_t *object);
-rt_bool_t rtgui_type_inherits_from(rtgui_type_t *type, rtgui_type_t *parent);
-rtgui_type_t *rtgui_type_parent_type_get(rtgui_type_t *type);
-const char *rtgui_type_name_get(rtgui_type_t *type);
-rtgui_type_t *rtgui_type_get_from_name(const char *name);
+void rtgui_type_object_construct(const rtgui_type_t *type, rtgui_object_t *object);
+void rtgui_type_destructors_call(const rtgui_type_t *type, rtgui_object_t *object);
+rt_bool_t rtgui_type_inherits_from(const rtgui_type_t *type, const rtgui_type_t *parent);
+const rtgui_type_t *rtgui_type_parent_type_get(const rtgui_type_t *type);
+const char *rtgui_type_name_get(const rtgui_type_t *type);
+const rtgui_type_t *rtgui_object_object_type_get(rtgui_object_t *object); #ifdef RTGUI_USING_CAST_CHECK
#define RTGUI_OBJECT_CAST(obj, obj_type, c_type) \
diff --git a/components/rtgui/widgets/container.c b/components/rtgui/widgets/container.c index 420a2cd101..c1e90f719a 100644 --- a/components/rtgui/widgets/container.c +++ b/components/rtgui/widgets/container.c @@ -120,12 +120,10 @@ rt_bool_t rtgui_container_event_handler(rtgui_widget_t* widget, rtgui_event_t* e /* handle in child widget */ return rtgui_container_dispatch_mouse_event(container, (struct rtgui_event_mouse*)event); - break; case RTGUI_EVENT_MOUSE_MOTION: return rtgui_container_dispatch_mouse_event(container, (struct rtgui_event_mouse*)event); - break; default: /* call parent widget event handler */ diff --git a/components/rtgui/widgets/menu.c b/components/rtgui/widgets/menu.c index d327063d90..9c1d19f73a 100644 --- a/components/rtgui/widgets/menu.c +++ b/components/rtgui/widgets/menu.c @@ -137,10 +137,6 @@ static void _rtgui_menu_item_ondraw(struct rtgui_listctrl *list, struct rtgui_dc }
}
-static void _rtgui_menu_item_onmouse()
-{
-}
-
DEFINE_CLASS_TYPE(menu, "menu",
RTGUI_WIDGET_TYPE,
_rtgui_menu_constructor,
diff --git a/components/rtgui/widgets/toplevel.c b/components/rtgui/widgets/toplevel.c index 5e2387fab5..ee29015dd8 100644 --- a/components/rtgui/widgets/toplevel.c +++ b/components/rtgui/widgets/toplevel.c @@ -13,6 +13,7 @@ */ #include <rtgui/rtgui_system.h> #include <rtgui/widgets/toplevel.h> +extern void rtgui_topwin_do_clip(rtgui_widget_t* widget);
static void _rtgui_toplevel_constructor(rtgui_toplevel_t *toplevel) { @@ -100,7 +101,6 @@ rt_bool_t rtgui_toplevel_event_handler(rtgui_widget_t* widget, rtgui_event_t* ev void rtgui_toplevel_update_clip(rtgui_toplevel_t* top) { - rt_uint32_t idx; rtgui_container_t* container; struct rtgui_list_node* node; rtgui_rect_t screen_rect; diff --git a/components/rtgui/widgets/widget.c b/components/rtgui/widgets/widget.c index daed3889f9..32280c3d58 100644 --- a/components/rtgui/widgets/widget.c +++ b/components/rtgui/widgets/widget.c @@ -17,6 +17,7 @@ #include <rtgui/widgets/widget.h> #include <rtgui/widgets/window.h> #include <rtgui/widgets/view.h> +extern void rtgui_topwin_do_clip(rtgui_widget_t* widget);
static void _rtgui_widget_constructor(rtgui_widget_t *widget) { @@ -494,8 +495,6 @@ void rtgui_widget_show(rtgui_widget_t* widget) void rtgui_widget_hide(rtgui_widget_t* widget) { - rtgui_rect_t rect; - /* hide this widget */ RTGUI_WIDGET_HIDE(widget); |
