summaryrefslogtreecommitdiff
path: root/components/rtgui/common/rtgui_object.c
diff options
context:
space:
mode:
author[email protected] <[email protected]>2012-04-18 15:06:12 +0000
committer[email protected] <[email protected]>2012-04-18 15:06:12 +0000
commitdb0646020812efc16ff0beebe35f9049dcc2bfed (patch)
tree5e949e9ba679a07b0198745853e900a016a3834e /components/rtgui/common/rtgui_object.c
parent06d45f0c42f2aa3678d509403fcf9cd82be106e6 (diff)
merge new RTGUI in to trunk
The full log is at https://github.com/RTGUI/RTGUI/commits/merge_1 and it's difficult to merge the new tree commit by commit. I also converted all the file into unix eol so there are many fake diff. Big changes are noted in rtgui/doc/road_map.txt and rtgui/doc/attention.txt. Keep an eye on them if you want to migrate your old code. Note that the work is still in progress and the bsp is not prepared in trunk so far. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2092 bbd45198-f89e-11dd-88c7-29a3b14d5316
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;
+}
+