summaryrefslogtreecommitdiff
path: root/components/rtgui/common/rtgui_object.c
diff options
context:
space:
mode:
Diffstat (limited to 'components/rtgui/common/rtgui_object.c')
-rw-r--r--components/rtgui/common/rtgui_object.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/components/rtgui/common/rtgui_object.c b/components/rtgui/common/rtgui_object.c
index f3f779e3a8..a4248cfb29 100644
--- a/components/rtgui/common/rtgui_object.c
+++ b/components/rtgui/common/rtgui_object.c
@@ -17,9 +17,10 @@
static void _rtgui_object_constructor(rtgui_object_t *object)
{
- if (!object) return;
+ if (!object)
+ return;
- object->is_static = RT_FALSE;
+ object->flag = RTGUI_OBJECT_FLAG_NONE;
}
/* Destroys the object */
@@ -28,7 +29,7 @@ static void _rtgui_object_destructor(rtgui_object_t *object)
/* nothing */
}
-DEFINE_CLASS_TYPE(type, "object",
+DEFINE_CLASS_TYPE(type, "object",
RT_NULL,
_rtgui_object_constructor,
_rtgui_object_destructor,
@@ -44,9 +45,9 @@ void rtgui_type_object_construct(const rtgui_type_t *type, rtgui_object_t *objec
}
void rtgui_type_destructors_call(const rtgui_type_t *type, rtgui_object_t *object)
-{
- const rtgui_type_t *t;
-
+{
+ const rtgui_type_t *t;
+
t = type;
while (t)
{
@@ -56,9 +57,9 @@ void rtgui_type_destructors_call(const rtgui_type_t *type, rtgui_object_t *objec
}
rt_bool_t rtgui_type_inherits_from(const rtgui_type_t *type, const rtgui_type_t *parent)
-{
- const rtgui_type_t *t;
-
+{
+ const rtgui_type_t *t;
+
t = type;
while (t)
{
@@ -115,7 +116,6 @@ rtgui_object_t *rtgui_object_create(rtgui_type_t *object_type)
#endif
new_object->type = object_type;
- new_object->is_static = RT_FALSE;
rtgui_type_object_construct(object_type, new_object);
@@ -131,7 +131,8 @@ rtgui_object_t *rtgui_object_create(rtgui_type_t *object_type)
*/
void rtgui_object_destroy(rtgui_object_t *object)
{
- if (!object || object->is_static == RT_TRUE) return;
+ if (!object || object->flag & RTGUI_OBJECT_FLAG_STATIC)
+ return;
#ifdef RTGUI_OBJECT_TRACE
obj_info.objs_number --;
@@ -178,3 +179,15 @@ const rtgui_type_t *rtgui_object_object_type_get(rtgui_object_t *object)
return object->type;
}
+void rtgui_object_set_event_handler(struct rtgui_object *object, rtgui_event_handler_ptr handler)
+{
+ RT_ASSERT(object != RT_NULL);
+
+ object->event_handler = handler;
+}
+
+rt_bool_t rtgui_object_event_handler(struct rtgui_object *object, struct rtgui_event* event)
+{
+ return RT_FALSE;
+}
+