From 44f9da675caa22bcb2e14fb24cecdf228b5b34da Mon Sep 17 00:00:00 2001 From: Daniel Zaoui Date: Mon, 10 Mar 2014 11:55:22 +0200 Subject: [PATCH] Eolian: Integration of Evas Smart --- src/Makefile_Evas.am | 14 +- src/lib/evas/Evas_Eo.h | 6 + src/lib/evas/canvas/common_interfaces.c | 28 +- src/lib/evas/canvas/evas_object_smart.c | 474 +++++-------------- src/lib/evas/canvas/evas_signal_interface.eo | 8 + src/lib/evas/canvas/evas_smart.eo | 354 ++++++++++++++ 6 files changed, 501 insertions(+), 383 deletions(-) create mode 100644 src/lib/evas/canvas/evas_signal_interface.eo create mode 100644 src/lib/evas/canvas/evas_smart.eo diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index 05f6f4026c..8f07399e0b 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -13,7 +13,11 @@ BUILT_SOURCES += \ lib/evas/canvas/evas_textblock.eo.c \ lib/evas/canvas/evas_textblock.eo.h \ lib/evas/canvas/evas_textgrid.eo.c \ - lib/evas/canvas/evas_textgrid.eo.h + lib/evas/canvas/evas_textgrid.eo.h \ + lib/evas/canvas/evas_signal_interface.eo.c \ + lib/evas/canvas/evas_signal_interface.eo.h \ + lib/evas/canvas/evas_smart.eo.c \ + lib/evas/canvas/evas_smart.eo.h EXTRA_DIST += \ lib/evas/canvas/evas_object.eo \ @@ -22,7 +26,9 @@ EXTRA_DIST += \ lib/evas/canvas/evas_rectangle.eo \ lib/evas/canvas/evas_text.eo \ lib/evas/canvas/evas_textblock.eo \ - lib/evas/canvas/evas_textgrid.eo + lib/evas/canvas/evas_textgrid.eo \ + lib/evas/canvas/evas_signal_interface.eo \ + lib/evas/canvas/evas_smart.eo lib_LTLIBRARIES += lib/evas/libevas.la noinst_LTLIBRARIES = @@ -43,7 +49,9 @@ nodist_installed_evascanvasheaders_DATA = \ lib/evas/canvas/evas_rectangle.eo.h \ lib/evas/canvas/evas_text.eo.h \ lib/evas/canvas/evas_textblock.eo.h \ - lib/evas/canvas/evas_textgrid.eo.h + lib/evas/canvas/evas_textgrid.eo.h \ + lib/evas/canvas/evas_signal_interface.eo.h \ + lib/evas/canvas/evas_smart.eo.h noinst_HEADERS = \ lib/evas/include/evas_inline.x \ diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h index 8d9589e7ae..6c26ff76ed 100644 --- a/src/lib/evas/Evas_Eo.h +++ b/src/lib/evas/Evas_Eo.h @@ -2,6 +2,8 @@ # error You shall not include this header directly #endif +#include "canvas/evas_signal_interface.eo.h" + EAPI extern const Eo_Event_Description _EVAS_OBJECT_EVENT_MOUSE_IN; EAPI extern const Eo_Event_Description _EVAS_OBJECT_EVENT_MOUSE_OUT; EAPI extern const Eo_Event_Description _EVAS_OBJECT_EVENT_MOUSE_DOWN; @@ -3044,6 +3046,9 @@ enum * * @{ */ +#include "canvas/evas_smart.eo.h" + +#if 0 #define EVAS_OBJ_SMART_CLASS evas_object_smart_class_get() const Eo_Class *evas_object_smart_class_get(void) EINA_CONST; @@ -3400,6 +3405,7 @@ enum */ #define evas_obj_smart_clip_unset() EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CLIP_UNSET) +#endif /** * @} */ diff --git a/src/lib/evas/canvas/common_interfaces.c b/src/lib/evas/canvas/common_interfaces.c index 44d3798dea..bfd530c9bf 100644 --- a/src/lib/evas/canvas/common_interfaces.c +++ b/src/lib/evas/canvas/common_interfaces.c @@ -173,7 +173,7 @@ _signal_interface_del(void *data) } static void -_signal_interface_constructor(Eo_Class *klass EINA_UNUSED) +_evas_signal_interface_class_constructor(Eo_Class *klass EINA_UNUSED) { signals_hash_table = eina_hash_string_superfast_new(_signal_interface_del); ADD_INTERFACE_SIGNALS(_clickable_events_desc); @@ -186,24 +186,11 @@ _signal_interface_constructor(Eo_Class *klass EINA_UNUSED) #undef ADD_SIGNAL static void -_signal_interface_destructor(Eo_Class *klass EINA_UNUSED) +_evas_signal_interface_class_destructor(Eo_Class *klass EINA_UNUSED) { eina_hash_free(signals_hash_table); } -static const Eo_Class_Description signal_interface_desc = { - EO_VERSION, - "Evas_Signal_Interface", - EO_CLASS_TYPE_INTERFACE, - EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), - NULL, - 0, - _signal_interface_constructor, - _signal_interface_destructor -}; - -EO_DEFINE_CLASS(evas_smart_signal_interface_get, &signal_interface_desc, NULL, NULL); - static const Eo_Class_Description clickable_interface_desc = { EO_VERSION, "Evas_Clickable_Interface", @@ -215,7 +202,7 @@ static const Eo_Class_Description clickable_interface_desc = { NULL }; -EO_DEFINE_CLASS(evas_smart_clickable_interface_get, &clickable_interface_desc, EVAS_SMART_SIGNAL_INTERFACE, NULL); +EO_DEFINE_CLASS(evas_smart_clickable_interface_get, &clickable_interface_desc, EVAS_SIGNAL_INTERFACE_CLASS, NULL); static const Eo_Class_Description scrollable_interface_desc = { EO_VERSION, @@ -228,7 +215,7 @@ static const Eo_Class_Description scrollable_interface_desc = { NULL }; -EO_DEFINE_CLASS(evas_smart_scrollable_interface_get, &scrollable_interface_desc, EVAS_SMART_SIGNAL_INTERFACE, NULL); +EO_DEFINE_CLASS(evas_smart_scrollable_interface_get, &scrollable_interface_desc, EVAS_SIGNAL_INTERFACE_CLASS, NULL); static const Eo_Class_Description zoomable_interface_desc = { EO_VERSION, @@ -241,7 +228,7 @@ static const Eo_Class_Description zoomable_interface_desc = { NULL }; -EO_DEFINE_CLASS(evas_smart_zoomable_interface_get, &zoomable_interface_desc, EVAS_SMART_SIGNAL_INTERFACE, NULL); +EO_DEFINE_CLASS(evas_smart_zoomable_interface_get, &zoomable_interface_desc, EVAS_SIGNAL_INTERFACE_CLASS, NULL); static const Eo_Class_Description selectable_interface_desc = { EO_VERSION, @@ -254,7 +241,7 @@ static const Eo_Class_Description selectable_interface_desc = { NULL }; -EO_DEFINE_CLASS(evas_smart_selectable_interface_get, &selectable_interface_desc, EVAS_SMART_SIGNAL_INTERFACE, NULL); +EO_DEFINE_CLASS(evas_smart_selectable_interface_get, &selectable_interface_desc, EVAS_SIGNAL_INTERFACE_CLASS, NULL); static const Eo_Class_Description draggable_interface_desc = { EO_VERSION, @@ -267,5 +254,6 @@ static const Eo_Class_Description draggable_interface_desc = { NULL }; -EO_DEFINE_CLASS(evas_smart_draggable_interface_get, &draggable_interface_desc, EVAS_SMART_SIGNAL_INTERFACE, NULL); +EO_DEFINE_CLASS(evas_smart_draggable_interface_get, &draggable_interface_desc, EVAS_SIGNAL_INTERFACE_CLASS, NULL); +#include "canvas/evas_signal_interface.eo.c" diff --git a/src/lib/evas/canvas/evas_object_smart.c b/src/lib/evas/canvas/evas_object_smart.c index 119702aa87..0301056e33 100644 --- a/src/lib/evas/canvas/evas_object_smart.c +++ b/src/lib/evas/canvas/evas_object_smart.c @@ -3,8 +3,6 @@ #include "Eo.h" -EAPI Eo_Op EVAS_OBJ_SMART_BASE_ID = EO_NOOP; - #define MY_CLASS EVAS_OBJ_SMART_CLASS #define MY_CLASS_NAME "Evas_Smart" @@ -14,9 +12,9 @@ extern Eina_Hash* signals_hash_table; static Eina_Hash *_evas_smart_class_names_hash_table = NULL; -typedef struct _Evas_Object_Smart Evas_Object_Smart; +typedef struct _Evas_Smart_Data Evas_Smart_Data; -struct _Evas_Object_Smart +struct _Evas_Smart_Data { struct { Evas_Coord_Rectangle bounding_box; @@ -116,20 +114,9 @@ static const Evas_Object_Func object_func = /* public funcs */ -EAPI void -evas_object_smart_data_set(Evas_Object *eo_obj, void *data) +EOLIAN static void +_evas_smart_data_set(Eo *eo_obj EINA_UNUSED, Evas_Smart_Data *o, void *data) { - MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); - return; - MAGIC_CHECK_END(); - eo_do(eo_obj, evas_obj_smart_data_set(data)); -} - -static void -_smart_data_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) -{ - void *data = va_arg(*list, void *); - Evas_Object_Smart *o = _pd; if (o->data) eo_data_unref(eo_obj, o->data); o->data = data; eo_data_ref(eo_obj, NULL); @@ -146,12 +133,10 @@ evas_object_smart_data_get(const Evas_Object *eo_obj) return data; } -static void -_smart_data_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static void* +_evas_smart_evas_object_smart_data_get(Eo *eo_obj EINA_UNUSED, Evas_Smart_Data *o) { - const Evas_Object_Smart *o = _pd; - void **data = va_arg(*list, void **); - *data = o->data; + return o->data; } EAPI const void * @@ -191,7 +176,7 @@ evas_object_smart_interface_data_get(const Evas_Object *eo_obj, const Evas_Smart_Interface *iface) { unsigned int i; - Evas_Object_Smart *obj; + Evas_Smart_Data *obj; Evas_Smart *s; MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); @@ -214,23 +199,11 @@ evas_object_smart_interface_data_get(const Evas_Object *eo_obj, return NULL; } -EAPI Evas_Smart * -evas_object_smart_smart_get(const Evas_Object *eo_obj) -{ - MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); - return NULL; - MAGIC_CHECK_END(); - Evas_Smart *smart = NULL; - eo_do((Eo *)eo_obj, evas_obj_smart_smart_get(&smart)); - return smart; -} - -static void -_smart_smart_get(Eo *eo_obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static Evas_Smart* +_evas_smart_smart_get(Eo *eo_obj EINA_UNUSED, Evas_Smart_Data *o EINA_UNUSED) { Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); - Evas_Smart **smart = va_arg(*list, Evas_Smart **); - if (smart) *smart = obj->smart.smart; + return obj->smart.smart; } EAPI void @@ -242,14 +215,12 @@ evas_object_smart_member_add(Evas_Object *eo_obj, Evas_Object *smart_obj) eo_do(smart_obj, evas_obj_smart_member_add(eo_obj)); } -static void -_smart_member_add(Eo *smart_obj, void *_pd, va_list *list) +EOLIAN static void +_evas_smart_member_add(Eo *smart_obj, Evas_Smart_Data *o, Evas_Object *eo_obj) { - Evas_Object *eo_obj = va_arg(*list, Evas_Object *); Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); Evas_Object_Protected_Data *smart = eo_data_scope_get(smart_obj, EVAS_OBJ_CLASS); - Evas_Object_Smart *o = _pd; if (obj->delete_me) { @@ -318,10 +289,9 @@ evas_object_smart_member_del(Evas_Object *eo_obj) eo_do(smart_obj, evas_obj_smart_member_del(eo_obj)); } -static void -_smart_member_del(Eo *smart_obj, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static void +_evas_smart_member_del(Eo *smart_obj, Evas_Smart_Data *_pd EINA_UNUSED, Evas_Object *eo_obj) { - Evas_Object *eo_obj = va_arg(*list, Evas_Object *); Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); if (!obj->smart.parent) return; @@ -330,7 +300,7 @@ _smart_member_del(Eo *smart_obj, void *_pd EINA_UNUSED, va_list *list) if (smart->smart.smart && smart->smart.smart->smart_class->member_del) smart->smart.smart->smart_class->member_del(smart_obj, eo_obj); - Evas_Object_Smart *o = eo_data_scope_get(smart_obj, MY_CLASS); + Evas_Smart_Data *o = eo_data_scope_get(smart_obj, MY_CLASS); o->contained = eina_inlist_remove(o->contained, EINA_INLIST_GET(obj)); eo_data_unref(eo_obj, obj); o->member_count--; @@ -372,39 +342,34 @@ evas_object_smart_type_check(const Evas_Object *eo_obj, const char *type) return type_check; } -static void -_smart_type_check(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static Eina_Bool +_evas_smart_evas_object_smart_type_check(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED, const char *type) { - const char *type = va_arg(*list, const char *); - Eina_Bool *type_check = va_arg(*list, Eina_Bool *); - *type_check = EINA_FALSE; - const Evas_Smart_Class *sc; Eo_Class *klass; + Eina_Bool type_check = EINA_FALSE; Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); - if (!obj) return; + if (!obj) return EINA_FALSE; klass = eina_hash_find(_evas_smart_class_names_hash_table, type); - if (klass) *type_check = eo_isa(eo_obj, klass); + if (klass) type_check = eo_isa(eo_obj, klass); /* Backward compatibility - walk over smart classes and compare type */ - if (EINA_FALSE == *type_check) + if (EINA_FALSE == type_check) { if (obj->smart.smart) { sc = obj->smart.smart->smart_class; while (sc) { - if (!strcmp(sc->name, type)) - { - *type_check = EINA_TRUE; - return; - } + if (!strcmp(sc->name, type)) return EINA_TRUE; sc = sc->parent; } } } + + return type_check; } EAPI Eina_Bool @@ -418,38 +383,34 @@ evas_object_smart_type_check_ptr(const Evas_Object *eo_obj, const char *type) return type_check_ptr; } -static void -_smart_type_check_ptr(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static Eina_Bool +_evas_smart_evas_object_smart_type_check_ptr(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED, const char* type) { Eo_Class *klass; const Evas_Smart_Class *sc; - const char* type = va_arg(*list, const char *); - Eina_Bool *type_check = va_arg(*list, Eina_Bool *); - *type_check = EINA_FALSE; + Eina_Bool type_check = EINA_FALSE; Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); - if (!obj) return; + if (!obj) return EINA_FALSE; klass = eina_hash_find(_evas_smart_class_names_hash_table, type); - if (klass) *type_check = eo_isa(eo_obj, klass); + if (klass) type_check = eo_isa(eo_obj, klass); /* Backward compatibility - walk over smart classes and compare type */ - if (EINA_FALSE == *type_check) + if (EINA_FALSE == type_check) { if (obj->smart.smart) { sc = obj->smart.smart->smart_class; while (sc) { - if (sc->name == type) - { - if (type_check) *type_check = EINA_TRUE; - return; - } + if (sc->name == type) return EINA_TRUE; sc = sc->parent; } } } + + return type_check; } EAPI void @@ -487,35 +448,15 @@ _evas_object_smart_iterator_free(Evas_Object_Smart_Iterator *it) } // Should we have an eo_children_iterator_new API and just inherit from it ? -EAPI Eina_Iterator * -evas_object_smart_iterator_new(const Evas_Object *o) +EOLIAN static Eina_Iterator* +_evas_smart_iterator_new(Eo *o, Evas_Smart_Data *priv) { - Eina_Iterator *ret = NULL; - eo_do((Eo *)o, evas_obj_smart_iterator_new(&ret)); - return ret; -} - -static void -_iterator_new(Eo *o, void *_pd, va_list *list) -{ - Eina_Iterator **ret = va_arg(*list, Eina_Iterator **); - Evas_Object_Smart_Iterator *it; - const Evas_Object_Smart *priv = _pd; - - if (!priv->contained) - { - *ret = NULL; - return ; - } + if (!priv->contained) return NULL; it = calloc(1, sizeof(Evas_Object_Smart_Iterator)); - if (!it) - { - *ret = NULL; - return ; - } + if (!it) return NULL; EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR); it->parent = eo_ref(o); @@ -525,26 +466,12 @@ _iterator_new(Eo *o, void *_pd, va_list *list) it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_evas_object_smart_iterator_get_container); it->iterator.free = FUNC_ITERATOR_FREE(_evas_object_smart_iterator_free); - *ret = &it->iterator; + return &it->iterator; } -EAPI Eina_List * -evas_object_smart_members_get(const Evas_Object *eo_obj) +EOLIAN static Eina_List* +_evas_smart_members_get(Eo *eo_obj EINA_UNUSED, Evas_Smart_Data *o) { - MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); - return NULL; - MAGIC_CHECK_END(); - if (!eo_isa(eo_obj, MY_CLASS)) return NULL; - Eina_List *list = NULL; - eo_do((Eo *)eo_obj, evas_obj_smart_members_get(&list)); - return list; -} - -static void -_smart_members_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) -{ - Eina_List **members_list = va_arg(*list, Eina_List **); - const Evas_Object_Smart *o = _pd; Eina_List *members; Eina_Inlist *member; @@ -553,7 +480,7 @@ _smart_members_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) for (member = o->contained; member; member = member->next) members = eina_list_append(members, ((Evas_Object_Protected_Data *)member)->object); - *members_list = members; + return members; } const Eina_Inlist * @@ -563,14 +490,14 @@ evas_object_smart_members_get_direct(const Evas_Object *eo_obj) return NULL; MAGIC_CHECK_END(); if (!eo_isa(eo_obj, MY_CLASS)) return NULL; - Evas_Object_Smart *o = eo_data_scope_get(eo_obj, MY_CLASS); + Evas_Smart_Data *o = eo_data_scope_get(eo_obj, MY_CLASS); return o->contained; } void _evas_object_smart_members_all_del(Evas_Object *eo_obj) { - Evas_Object_Smart *o = eo_data_scope_get(eo_obj, MY_CLASS); + Evas_Smart_Data *o = eo_data_scope_get(eo_obj, MY_CLASS); Evas_Object_Protected_Data *memobj; Eina_Inlist *itrn; EINA_INLIST_FOREACH_SAFE(o->contained, itrn, memobj) @@ -583,7 +510,7 @@ static void _evas_smart_class_ifaces_private_data_alloc(Evas_Object *eo_obj, Evas_Smart *s) { - Evas_Object_Smart *obj; + Evas_Smart_Data *obj; const Evas_Smart_Class *sc; unsigned char *ptr; unsigned int i, total_priv_sz = 0; @@ -659,11 +586,11 @@ evas_object_smart_add(Evas *eo_e, Evas_Smart *s) return eo_obj; } -static void -_constructor(Eo *eo_obj, void *class_data, va_list *list EINA_UNUSED) +EOLIAN static void +_evas_smart_constructor(Eo *eo_obj, Evas_Smart_Data *class_data EINA_UNUSED) { Evas_Object_Protected_Data *obj; - Evas_Object_Smart *smart; + Evas_Smart_Data *smart; Eo *parent; smart = class_data; @@ -680,8 +607,8 @@ _constructor(Eo *eo_obj, void *class_data, va_list *list EINA_UNUSED) evas_obj_smart_add()); } -static void -_smart_add(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) +EOLIAN static void +_evas_smart_add(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED) { // If this function is reached, so we do nothing except trying to call // the function of the legacy smart class. @@ -690,16 +617,14 @@ _smart_add(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) if (s && s->smart_class->add) s->smart_class->add(eo_obj); } -static void -_smart_del(Eo *eo_obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) +EOLIAN static void +_evas_smart_del(Eo *eo_obj EINA_UNUSED, Evas_Smart_Data *o EINA_UNUSED) { } -static void -_smart_resize(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static void +_evas_smart_resize(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED, Evas_Coord w, Evas_Coord h) { - Evas_Coord w = va_arg(*list, Evas_Coord); - Evas_Coord h = va_arg(*list, Evas_Coord); // If this function is reached, so we do nothing except trying to call // the function of the legacy smart class. Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); @@ -707,11 +632,9 @@ _smart_resize(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) if (s && s->smart_class->resize) s->smart_class->resize(eo_obj, w, h); } -static void -_smart_move(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) +EOLIAN static void +_evas_smart_move(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED, Evas_Coord x, Evas_Coord y) { - Evas_Coord x = va_arg(*list, Evas_Coord); - Evas_Coord y = va_arg(*list, Evas_Coord); // If this function is reached, so we do nothing except trying to call // the function of the legacy smart class. Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); @@ -719,8 +642,8 @@ _smart_move(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) if (s && s->smart_class->move) s->smart_class->move(eo_obj, x, y); } -static void -_smart_show(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) +EOLIAN static void +_evas_smart_show(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED) { // If this function is reached, so we do nothing except trying to call // the function of the legacy smart class. @@ -729,8 +652,8 @@ _smart_show(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) if (s && s->smart_class->show) s->smart_class->show(eo_obj); } -static void -_smart_hide(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) +EOLIAN static void +_evas_smart_hide(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED) { // If this function is reached, so we do nothing except trying to call // the function of the legacy smart class. @@ -739,13 +662,9 @@ _smart_hide(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) if (s && s->smart_class->hide) s->smart_class->hide(eo_obj); } -static void -_smart_color_set(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static void +_evas_smart_color_set(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED, int r, int g, int b, int a) { - int r = va_arg(*list, int); - int g = va_arg(*list, int); - int b = va_arg(*list, int); - int a = va_arg(*list, int); // If this function is reached, so we do nothing except trying to call // the function of the legacy smart class. Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); @@ -753,10 +672,9 @@ _smart_color_set(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) if (s && s->smart_class->color_set) s->smart_class->color_set(eo_obj, r, g, b, a); } -static void -_smart_clip_set(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static void +_evas_smart_clip_set(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED, Evas_Object *clip) { - Evas_Object *clip = va_arg(*list, Evas_Object *); // If this function is reached, so we do nothing except trying to call // the function of the legacy smart class. Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); @@ -764,8 +682,8 @@ _smart_clip_set(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) if (s && s->smart_class->clip_set) s->smart_class->clip_set(eo_obj, clip); } -static void -_smart_clip_unset(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) +EOLIAN static void +_evas_smart_clip_unset(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED) { // If this function is reached, so we do nothing except trying to call // the function of the legacy smart class. @@ -775,9 +693,8 @@ _smart_clip_unset(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) } static void -_smart_attach(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) +_evas_smart_attach(Eo *eo_obj, Evas_Smart_Data *_pd EINA_UNUSED, Evas_Smart *s) { - Evas_Smart *s = va_arg(*list, Evas_Smart *); MAGIC_CHECK(s, Evas_Smart, MAGIC_SMART); return; MAGIC_CHECK_END(); @@ -818,7 +735,7 @@ evas_object_smart_callback_add(Evas_Object *eo_obj, const char *event, Evas_Smar EAPI void evas_object_smart_callback_priority_add(Evas_Object *eo_obj, const char *event, Evas_Callback_Priority priority, Evas_Smart_Cb func, const void *data) { - Evas_Object_Smart *o; + Evas_Smart_Data *o; MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); return; @@ -852,7 +769,7 @@ evas_object_smart_callback_priority_add(Evas_Object *eo_obj, const char *event, EAPI void * evas_object_smart_callback_del(Evas_Object *eo_obj, const char *event, Evas_Smart_Cb func) { - Evas_Object_Smart *o; + Evas_Smart_Data *o; _eo_evas_smart_cb_info *info; MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); @@ -884,7 +801,7 @@ evas_object_smart_callback_del(Evas_Object *eo_obj, const char *event, Evas_Smar EAPI void * evas_object_smart_callback_del_full(Evas_Object *eo_obj, const char *event, Evas_Smart_Cb func, const void *data) { - Evas_Object_Smart *o; + Evas_Smart_Data *o; _eo_evas_smart_cb_info *info; MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); @@ -927,67 +844,35 @@ evas_object_smart_callback_call(Evas_Object *eo_obj, const char *event, void *ev eo_do(eo_obj, eo_event_callback_call(event_desc->eo_desc, event_info, NULL)); } -EAPI Eina_Bool -evas_object_smart_callbacks_descriptions_set(Evas_Object *eo_obj, const Evas_Smart_Cb_Description *descriptions) +EOLIAN static Eina_Bool +_evas_smart_callbacks_descriptions_set(Eo *eo_obj EINA_UNUSED, Evas_Smart_Data *o, const Evas_Smart_Cb_Description *descriptions) { - MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); - return EINA_FALSE; - MAGIC_CHECK_END(); - Eina_Bool result = EINA_FALSE; - eo_do(eo_obj, evas_obj_smart_callbacks_descriptions_set(descriptions, &result)); - return result; -} - -static void -_smart_callbacks_descriptions_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) -{ - const Evas_Smart_Cb_Description *descriptions = va_arg(*list, Evas_Smart_Cb_Description *); - Eina_Bool *result = va_arg(*list, Eina_Bool *); - if (result) *result = EINA_TRUE; - const Evas_Smart_Cb_Description *d; - Evas_Object_Smart *o = _pd; unsigned int i, count = 0; if ((!descriptions) || (!descriptions->name)) { evas_smart_cb_descriptions_resize(&o->callbacks_descriptions, 0); - return; + return EINA_TRUE; } for (count = 0, d = descriptions; d->name; d++) count++; evas_smart_cb_descriptions_resize(&o->callbacks_descriptions, count); - if (count == 0) return; + if (count == 0) return EINA_TRUE; for (i = 0, d = descriptions; i < count; d++, i++) o->callbacks_descriptions.array[i] = d; evas_smart_cb_descriptions_fix(&o->callbacks_descriptions); + + return EINA_TRUE; } -EAPI void -evas_object_smart_callbacks_descriptions_get(const Evas_Object *eo_obj, const Evas_Smart_Cb_Description ***class_descriptions, unsigned int *class_count, const Evas_Smart_Cb_Description ***instance_descriptions, unsigned int *instance_count) +EOLIAN static void +_evas_smart_callbacks_descriptions_get(Eo *eo_obj, Evas_Smart_Data *o, const Evas_Smart_Cb_Description ***class_descriptions, unsigned int *class_count, const Evas_Smart_Cb_Description ***instance_descriptions, unsigned int *instance_count) { - MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); - if (class_descriptions) *class_descriptions = NULL; - if (class_count) *class_count = 0; - if (instance_descriptions) *instance_descriptions = NULL; - if (instance_count) *instance_count = 0; - return; - MAGIC_CHECK_END(); - eo_do((Eo *)eo_obj, evas_obj_smart_callbacks_descriptions_get(class_descriptions, class_count, instance_descriptions, instance_count)); -} - -static void -_smart_callbacks_descriptions_get(Eo *eo_obj, void *_pd, va_list *list) -{ - const Evas_Smart_Cb_Description ***class_descriptions = va_arg(*list, const Evas_Smart_Cb_Description ***); - unsigned int *class_count = va_arg(*list, unsigned int *); - const Evas_Smart_Cb_Description ***instance_descriptions = va_arg(*list, const Evas_Smart_Cb_Description ***); - unsigned int *instance_count = va_arg(*list, unsigned int *); - const Evas_Object_Smart *o = _pd; if (class_descriptions) *class_descriptions = NULL; if (class_count) *class_count = 0; @@ -1003,23 +888,9 @@ _smart_callbacks_descriptions_get(Eo *eo_obj, void *_pd, va_list *list) *instance_count = o->callbacks_descriptions.size; } -EAPI void -evas_object_smart_callback_description_find(const Evas_Object *eo_obj, const char *name, const Evas_Smart_Cb_Description **class_description, const Evas_Smart_Cb_Description **instance_description) +EOLIAN static void +_evas_smart_callback_description_find(Eo *eo_obj, Evas_Smart_Data *o, const char *name, const Evas_Smart_Cb_Description **class_description, const Evas_Smart_Cb_Description **instance_description) { - MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); - if (class_description) *class_description = NULL; - if (instance_description) *instance_description = NULL; - return; - MAGIC_CHECK_END(); - eo_do((Eo *)eo_obj, evas_obj_smart_callback_description_find(name, class_description, instance_description)); -} - -static void -_smart_callback_description_find(Eo *eo_obj, void *_pd, va_list *list) -{ - const char *name = va_arg(*list, const char *); - const Evas_Smart_Cb_Description **class_description = va_arg(*list, const Evas_Smart_Cb_Description **); - const Evas_Smart_Cb_Description **instance_description = va_arg(*list, const Evas_Smart_Cb_Description **); if (!name) { @@ -1029,7 +900,6 @@ _smart_callback_description_find(Eo *eo_obj, void *_pd, va_list *list) } Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); - const Evas_Object_Smart *o = _pd; if (class_description) *class_description = evas_smart_cb_description_find (&obj->smart.smart->callbacks, name); @@ -1039,20 +909,9 @@ _smart_callback_description_find(Eo *eo_obj, void *_pd, va_list *list) (&o->callbacks_descriptions, name); } -EAPI void -evas_object_smart_need_recalculate_set(Evas_Object *eo_obj, Eina_Bool value) +EOLIAN static void +_evas_smart_need_recalculate_set(Eo *eo_obj, Evas_Smart_Data *o, Eina_Bool value) { - MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); - return; - MAGIC_CHECK_END(); - eo_do(eo_obj, evas_obj_smart_need_recalculate_set(value)); -} - -static void -_smart_need_recalculate_set(Eo *eo_obj, void *_pd, va_list *list) -{ - Eina_Bool value = va_arg(*list, int); - Evas_Object_Smart *o = _pd; Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); // XXX: do i need this? @@ -1079,39 +938,16 @@ _smart_need_recalculate_set(Eo *eo_obj, void *_pd, va_list *list) o->need_recalculate = value; } -EAPI Eina_Bool -evas_object_smart_need_recalculate_get(const Evas_Object *eo_obj) +EOLIAN static Eina_Bool +_evas_smart_need_recalculate_get(Eo *eo_obj EINA_UNUSED, Evas_Smart_Data *o) { - MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); - return EINA_FALSE; - MAGIC_CHECK_END(); - Eina_Bool need_recalculate = EINA_FALSE; - eo_do((Eo *)eo_obj, evas_obj_smart_need_recalculate_get(&need_recalculate)); - return need_recalculate; + return o->need_recalculate; } -static void -_smart_need_recalculate_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) -{ - Eina_Bool *need_recalculate = va_arg(*list, Eina_Bool *); - const Evas_Object_Smart *o = _pd; - if (need_recalculate) *need_recalculate = o->need_recalculate; -} - -EAPI void -evas_object_smart_calculate(Evas_Object *eo_obj) -{ - MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); - return; - MAGIC_CHECK_END(); - eo_do(eo_obj, evas_obj_smart_calculate()); -} - -static void -_smart_calculate(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED) +EOLIAN static void +_evas_smart_calculate(Eo *eo_obj, Evas_Smart_Data *o) { Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); - Evas_Object_Smart *o = _pd; if (!obj->smart.smart || !obj->smart.smart->smart_class->calculate) return; @@ -1127,7 +963,7 @@ evas_smart_objects_calculate(Evas *eo_e) } void -_canvas_smart_objects_calculate(Eo *eo_e, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) +_canvas_smart_objects_calculate(Eo *eo_e, void *o EINA_UNUSED, va_list *list EINA_UNUSED) { evas_call_smarts_calculate(eo_e); } @@ -1159,7 +995,7 @@ _canvas_smart_objects_calculate_count_get(Eo *eo_e EINA_UNUSED, void *_pd, va_li void evas_call_smarts_calculate(Evas *eo_e) { - Evas_Object_Smart *o; + Evas_Smart_Data *o; Eina_Clist *elem; Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CLASS); @@ -1171,7 +1007,7 @@ evas_call_smarts_calculate(Evas *eo_e) Evas_Object_Protected_Data *obj; /* move the item to the processed list */ - o = EINA_CLIST_ENTRY(elem, Evas_Object_Smart, calc_entry); + o = EINA_CLIST_ENTRY(elem, Evas_Smart_Data, calc_entry); eina_clist_remove(&o->calc_entry); obj = eo_data_scope_get(o->object, EVAS_OBJ_CLASS); @@ -1190,7 +1026,7 @@ evas_call_smarts_calculate(Evas *eo_e) while (NULL != (elem = eina_clist_head(&e->calc_done))) { - o = EINA_CLIST_ENTRY(elem, Evas_Object_Smart, calc_entry); + o = EINA_CLIST_ENTRY(elem, Evas_Smart_Data, calc_entry); o->recalculate_cycle = 0; eina_clist_remove(&o->calc_entry); } @@ -1201,17 +1037,8 @@ evas_call_smarts_calculate(Evas *eo_e) evas_event_thaw_eval(eo_e); } -EAPI void -evas_object_smart_changed(Evas_Object *eo_obj) -{ - MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); - return; - MAGIC_CHECK_END(); - eo_do(eo_obj, evas_obj_smart_changed()); -} - -static void -_smart_changed(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) +EOLIAN static void +_evas_smart_changed(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED) { Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); evas_object_change(eo_obj, obj); @@ -1248,7 +1075,7 @@ void evas_object_smart_del(Evas_Object *eo_obj) { Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); - Evas_Object_Smart *sobj; + Evas_Smart_Data *sobj; Evas_Smart *s; unsigned int i; @@ -1281,7 +1108,7 @@ evas_object_smart_del(Evas_Object *eo_obj) void evas_object_update_bounding_box(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) { - Evas_Object_Smart *s = NULL; + Evas_Smart_Data *s = NULL; Eina_Bool propagate = EINA_FALSE; Eina_Bool computeminmax = EINA_FALSE; Evas_Coord x, y, w, h; @@ -1324,7 +1151,7 @@ evas_object_update_bounding_box(Evas_Object *eo_obj, Evas_Object_Protected_Data * That's why we initialiaze min and max search to geometry of the parent object. */ Evas_Object_Protected_Data *smart_obj = eo_data_scope_get(obj->smart.parent, EVAS_OBJ_CLASS); - Evas_Object_Smart *smart_parent = eo_data_scope_get(obj->smart.parent, MY_CLASS); + Evas_Smart_Data *smart_parent = eo_data_scope_get(obj->smart.parent, MY_CLASS); if (!smart_parent || !smart_obj) return; if (smart_obj->cur->valid_bounding_box) @@ -1418,7 +1245,7 @@ evas_object_smart_bounding_box_get(Evas_Object *eo_obj, Evas_Coord_Rectangle *cur_bounding_box, Evas_Coord_Rectangle *prev_bounding_box) { - Evas_Object_Smart *s = eo_data_scope_get(eo_obj, MY_CLASS); + Evas_Smart_Data *s = eo_data_scope_get(eo_obj, MY_CLASS); if (cur_bounding_box) memcpy(cur_bounding_box, &s->cur.bounding_box, @@ -1438,7 +1265,7 @@ evas_object_smart_cleanup(Evas_Object *eo_obj) if (obj->is_smart) { - Evas_Object_Smart *o = eo_data_scope_get(eo_obj, MY_CLASS); + Evas_Smart_Data *o = eo_data_scope_get(eo_obj, MY_CLASS); if (o->calc_entry.next) eina_clist_remove(&o->calc_entry); @@ -1486,7 +1313,7 @@ evas_object_smart_member_cache_invalidate(Evas_Object *eo_obj, obj->parent_cache.src_invisible_valid = EINA_FALSE; if (!obj->is_smart) return; - Evas_Object_Smart *o = eo_data_scope_get(eo_obj, MY_CLASS); + Evas_Smart_Data *o = eo_data_scope_get(eo_obj, MY_CLASS); EINA_INLIST_FOREACH(o->contained, member) { Evas_Object *eo_member = member->object; @@ -1499,7 +1326,7 @@ evas_object_smart_member_cache_invalidate(Evas_Object *eo_obj, void evas_object_smart_member_raise(Evas_Object *eo_member) { - Evas_Object_Smart *o; + Evas_Smart_Data *o; Evas_Object_Protected_Data *member = eo_data_scope_get(eo_member, EVAS_OBJ_CLASS); o = eo_data_scope_get(member->smart.parent, MY_CLASS); o->contained = eina_inlist_demote(o->contained, EINA_INLIST_GET(member)); @@ -1508,7 +1335,7 @@ evas_object_smart_member_raise(Evas_Object *eo_member) void evas_object_smart_member_lower(Evas_Object *eo_member) { - Evas_Object_Smart *o; + Evas_Smart_Data *o; Evas_Object_Protected_Data *member = eo_data_scope_get(eo_member, EVAS_OBJ_CLASS); o = eo_data_scope_get(member->smart.parent, MY_CLASS); o->contained = eina_inlist_promote(o->contained, EINA_INLIST_GET(member)); @@ -1517,7 +1344,7 @@ evas_object_smart_member_lower(Evas_Object *eo_member) void evas_object_smart_member_stack_above(Evas_Object *eo_member, Evas_Object *eo_other) { - Evas_Object_Smart *o; + Evas_Smart_Data *o; Evas_Object_Protected_Data *member = eo_data_scope_get(eo_member, EVAS_OBJ_CLASS); Evas_Object_Protected_Data *other = eo_data_scope_get(eo_other, EVAS_OBJ_CLASS); o = eo_data_scope_get(member->smart.parent, MY_CLASS); @@ -1528,7 +1355,7 @@ evas_object_smart_member_stack_above(Evas_Object *eo_member, Evas_Object *eo_oth void evas_object_smart_member_stack_below(Evas_Object *eo_member, Evas_Object *eo_other) { - Evas_Object_Smart *o; + Evas_Smart_Data *o; Evas_Object_Protected_Data *member = eo_data_scope_get(eo_member, EVAS_OBJ_CLASS); Evas_Object_Protected_Data *other = eo_data_scope_get(eo_other, EVAS_OBJ_CLASS); o = eo_data_scope_get(member->smart.parent, MY_CLASS); @@ -1543,7 +1370,7 @@ evas_object_smart_need_bounding_box_update(Evas_Object *eo_obj) return; MAGIC_CHECK_END(); Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); - Evas_Object_Smart *o = eo_data_scope_get(eo_obj, MY_CLASS); + Evas_Smart_Data *o = eo_data_scope_get(eo_obj, MY_CLASS); if (o->update_boundingbox_needed) return; o->update_boundingbox_needed = EINA_TRUE; @@ -1554,7 +1381,7 @@ evas_object_smart_need_bounding_box_update(Evas_Object *eo_obj) void evas_object_smart_bounding_box_update(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) { - Evas_Object_Smart *os; + Evas_Smart_Data *os; Eina_Inlist *list; Evas_Object_Protected_Data *o; Evas_Coord minx; @@ -1587,7 +1414,7 @@ evas_object_smart_bounding_box_update(Evas_Object *eo_obj, Evas_Object_Protected if (o->is_smart) { - Evas_Object_Smart *s = eo_data_scope_get(o->object, MY_CLASS); + Evas_Smart_Data *s = eo_data_scope_get(o->object, MY_CLASS); evas_object_smart_bounding_box_update(o->object, o); @@ -1660,7 +1487,7 @@ evas_object_smart_render_pre(Evas_Object *eo_obj, { #if 0 // REDO to handle smart move - Evas_Object_Smart *o; + Evas_Smart_Data *o; fprintf(stderr, ""); o = type_private_data; @@ -1739,116 +1566,43 @@ evas_object_smart_render_pre(Evas_Object *eo_obj, static void evas_object_smart_render_post(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj EINA_UNUSED, void *type_private_data) { - Evas_Object_Smart *o = type_private_data; + Evas_Smart_Data *o = type_private_data; evas_object_cur_prev(eo_obj); o->prev = o->cur; } static unsigned int evas_object_smart_id_get(Evas_Object *eo_obj) { - Evas_Object_Smart *o = eo_data_scope_get(eo_obj, MY_CLASS); + Evas_Smart_Data *o = eo_data_scope_get(eo_obj, MY_CLASS); if (!o) return 0; return MAGIC_OBJ_SMART; } static unsigned int evas_object_smart_visual_id_get(Evas_Object *eo_obj) { - Evas_Object_Smart *o = eo_data_scope_get(eo_obj, MY_CLASS); + Evas_Smart_Data *o = eo_data_scope_get(eo_obj, MY_CLASS); if (!o) return 0; return MAGIC_OBJ_CONTAINER; } static void *evas_object_smart_engine_data_get(Evas_Object *eo_obj) { - Evas_Object_Smart *o = eo_data_scope_get(eo_obj, MY_CLASS); + Evas_Smart_Data *o = eo_data_scope_get(eo_obj, MY_CLASS); if (!o) return NULL; return o->engine_data; } static void -_class_constructor(Eo_Class *klass) +_evas_smart_class_constructor(Eo_Class *klass EINA_UNUSED) { - const Eo_Op_Func_Description func_desc[] = { - EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor), - EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_SMART_TYPE_CHECK), _smart_type_check), - EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_SMART_TYPE_CHECK_PTR), _smart_type_check_ptr), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_DATA_SET), _smart_data_set), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_SMART_GET), _smart_smart_get), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_MEMBER_ADD), _smart_member_add), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_MEMBER_DEL), _smart_member_del), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_MEMBERS_GET), _smart_members_get), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ITERATOR_NEW), _iterator_new), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CALLBACKS_DESCRIPTIONS_SET), _smart_callbacks_descriptions_set), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CALLBACKS_DESCRIPTIONS_GET), _smart_callbacks_descriptions_get), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CALLBACK_DESCRIPTION_FIND), _smart_callback_description_find), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_NEED_RECALCULATE_SET), _smart_need_recalculate_set), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_NEED_RECALCULATE_GET), _smart_need_recalculate_get), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CALCULATE), _smart_calculate), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CHANGED), _smart_changed), - EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_SMART_DATA_GET), _smart_data_get), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ATTACH), _smart_attach), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ADD), _smart_add), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_DEL), _smart_del), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_RESIZE), _smart_resize), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_MOVE), _smart_move), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_SHOW), _smart_show), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_HIDE), _smart_hide), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_COLOR_SET), _smart_color_set), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CLIP_SET), _smart_clip_set), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CLIP_UNSET), _smart_clip_unset), - EO_OP_FUNC_SENTINEL - }; - - eo_class_funcs_set(klass, func_desc); - _evas_smart_class_names_hash_table = eina_hash_string_small_new(NULL); - evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass); } static void -_class_destructor(Eo_Class *klass EINA_UNUSED) +_evas_smart_class_destructor(Eo_Class *klass EINA_UNUSED) { eina_hash_free(_evas_smart_class_names_hash_table); } -static const Eo_Op_Description op_desc[] = { - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_DATA_SET, "Store a pointer to user data for a given smart object."), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_SMART_GET, "Get the #Evas_Smart from which obj smart object was created."), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_MEMBER_ADD, "Set an Evas object as a member of a given smart object."), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_MEMBER_DEL, "Removes a member object from a given smart object."), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_MEMBERS_GET, "Retrieves the list of the member objects of a given Evas smart"), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_ITERATOR_NEW, "Retrieves an iterator of the member object of a given Evas smart"), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_CALLBACKS_DESCRIPTIONS_SET, "Set an smart object instance's smart callbacks descriptions."), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_CALLBACKS_DESCRIPTIONS_GET, "Retrieve an smart object's know smart callback descriptions (both"), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_CALLBACK_DESCRIPTION_FIND, "Find callback description for callback called name."), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_NEED_RECALCULATE_SET, "Set or unset the flag signalling that a given smart object needs to"), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_NEED_RECALCULATE_GET, "Get the value of the flag signalling that a given smart object needs to"), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_CALCULATE, "Call the calculate() smart function immediately on a given smart"), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_CHANGED, "Mark smart object as changed, dirty."), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_ATTACH, "Attach an object to a canvas."), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_ADD, "Add an object to a canvas."), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_DEL, "Remove an object from a canvas."), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_RESIZE, "Resize an object on a canvas."), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_MOVE, "Move an object on a canvas."), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_SHOW, "Show an object on a canvas."), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_HIDE, "Hide an object on a canvas."), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_COLOR_SET, "Set color of an object on a canvas."), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_CLIP_SET, "Set a clipper of an object on a canvas."), - EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_CLIP_UNSET, "Unset a clipper of an object on a canvas."), - EO_OP_DESCRIPTION_SENTINEL -}; - -static const Eo_Class_Description class_desc = { - EO_VERSION, - MY_CLASS_NAME, - EO_CLASS_TYPE_REGULAR, - EO_CLASS_DESCRIPTION_OPS(&EVAS_OBJ_SMART_BASE_ID, op_desc, EVAS_OBJ_SMART_SUB_ID_LAST), - NULL, - sizeof(Evas_Object_Smart), - _class_constructor, - _class_destructor -}; - -EO_DEFINE_CLASS(evas_object_smart_class_get, &class_desc, EVAS_OBJ_CLASS, EVAS_SMART_SIGNAL_INTERFACE, NULL); - +#include "canvas/evas_smart.eo.c" diff --git a/src/lib/evas/canvas/evas_signal_interface.eo b/src/lib/evas/canvas/evas_signal_interface.eo new file mode 100644 index 0000000000..f15ea3a588 --- /dev/null +++ b/src/lib/evas/canvas/evas_signal_interface.eo @@ -0,0 +1,8 @@ +interface Evas_Signal_Interface () +{ + data: null; + implements { + class::constructor; + class::destructor; + } +} diff --git a/src/lib/evas/canvas/evas_smart.eo b/src/lib/evas/canvas/evas_smart.eo new file mode 100644 index 0000000000..39f3c21e52 --- /dev/null +++ b/src/lib/evas/canvas/evas_smart.eo @@ -0,0 +1,354 @@ +class Evas_Smart (Evas_Object, Evas_Signal_Interface) +{ + legacy_prefix: evas_object_smart; + eo_prefix: evas_obj_smart; + properties { + need_recalculate { + set { + /*@ + Set or unset the flag signalling that a given smart object needs to + get recalculated. + + If this flag is set, then the @c calculate() smart function of @p + obj will be called, if one is provided, during rendering phase of + Evas (see evas_render()), after which this flag will be + automatically unset. + + If that smart function is not provided for the given object, this + flag will be left unchanged. + + @note just setting this flag will not make the canvas' whole scene + dirty, by itself, and evas_render() will have no effect. To + force that, use evas_object_smart_changed(), that will also + call this function automatically, with @c EINA_TRUE as parameter. + + @see evas_object_smart_need_recalculate_get() + @see evas_object_smart_calculate() + @see evas_smart_objects_calculate() + + @ingroup Evas_Smart_Object_Group */ + } + get { + /*@ + Get the value of the flag signalling that a given smart object needs to + get recalculated. + + @return if flag is set or not. + + @note this flag will be unset during the rendering phase, when the + @c calculate() smart function is called, if one is provided. + If it's not provided, then the flag will be left unchanged + after the rendering phase. + + @see evas_object_smart_need_recalculate_set(), for more details + + @ingroup Evas_Smart_Object_Group */ + } + values { + Eina_Bool value; /*@ whether one wants to set (@c EINA_TRUE) or to unset + (@c EINA_FALSE) the flag. */ + } + } + clip { + set { + /*@ No description supplied by the EAPI. */ + } + values { + Evas_Object *clip; + } + } + color { + set { + /*@ No description supplied by the EAPI. */ + } + values { + int r; + int g; + int b; + int a; + } + } + data { + set { + /*@ + Store a pointer to user data for a given smart object. + + This data is stored @b independently of the one set by + evas_object_data_set(), naturally. + + @see evas_object_smart_data_get() + + @ingroup Evas_Smart_Object_Group */ + } + values { + void *data; /*@ A pointer to user data */ + } + } + members { + get { + /*@ + Retrieves the list of the member objects of a given Evas smart + object + + @return Returns the list of the member objects of @p obj. + + The returned list should be freed with @c eina_list_free() when you + no longer need it. + + @since 1.7 This function will return @c NULL when a non-smart object is passed. + + @see evas_object_smart_member_add() + @see evas_object_smart_member_del() + @see evas_object_smart_iterator_new() */ + return Eina_List * @warn_unused; + } + } + smart { + get { + /*@ + Get the #Evas_Smart from which @p obj smart object was created. + + @return the #Evas_Smart handle or @c NULL, on errors + + @ingroup Evas_Smart_Object_Group */ + return Evas_Smart * @warn_unused; + } + } + } + methods { + show { + /*@ No description supplied by the EAPI. */ + } + move { + /*@ No description supplied by the EAPI. */ + params { + @in Evas_Coord x; + @in Evas_Coord y; + } + } + callbacks_descriptions_set { + /*@ + Set an smart object @b instance's smart callbacks descriptions. + + @return @c EINA_TRUE on success, @c EINA_FALSE on failure. + + These descriptions are hints to be used by introspection and are + not enforced in any way. + + It will not be checked if instance callbacks descriptions have the + same name as respective possibly registered in the smart object + @b class. Both are kept in different arrays and users of + evas_object_smart_callbacks_descriptions_get() should handle this + case as they wish. + + @note Becase @p descriptions must be @c NULL terminated, and + because a @c NULL name makes little sense, too, + Evas_Smart_Cb_Description::name must @b not be @c NULL. + + @note While instance callbacks descriptions are possible, they are + @b not recommended. Use @b class callbacks descriptions + instead as they make you smart object user's life simpler and + will use less memory, as descriptions and arrays will be + shared among all instances. + + @ingroup Evas_Smart_Object_Group */ + + return Eina_Bool; + params { + @in const Evas_Smart_Cb_Description *descriptions; /*@ @c NULL terminated array with + #Evas_Smart_Cb_Description descriptions. Array elements won't be + modified at run time, but references to them and their contents + will be made, so this array should be kept alive during the whole + object's lifetime. */ + } + } + callbacks_descriptions_get { + /*@ + Retrieve an smart object's know smart callback descriptions (both + instance and class ones). + + This call searches for registered callback descriptions for both + instance and class of the given smart object. These arrays will be + sorted by Evas_Smart_Cb_Description::name and also @c NULL + terminated, so both @a class_count and @a instance_count can be + ignored, if the caller wishes so. The terminator @c NULL is not + counted in these values. + + @note If just class descriptions are of interest, try + evas_smart_callbacks_descriptions_get() instead. + + @note Use @c NULL pointers on the descriptions/counters you're not + interested in: they'll be ignored by the function. + + @see evas_smart_callbacks_descriptions_get() + + @ingroup Evas_Smart_Object_Group */ + + const; + params { + @out const Evas_Smart_Cb_Description **class_descriptions; /*@ Where to store class callbacks + descriptions array, if any is known. If no descriptions are + known, @c NULL is returned */ + @out unsigned int class_count; /*@ Returns how many class callbacks descriptions + are known. */ + @out const Evas_Smart_Cb_Description **instance_descriptions; /*@ Where to store instance callbacks + descriptions array, if any is known. If no descriptions are + known, @c NULL is returned. */ + @out unsigned int instance_count; /*@ Returns how many instance callbacks + descriptions are known. */ + } + } + iterator_new { + /*@ + Retrieves an iterator of the member objects of a given Evas smart + object + + @return Returns the iterator of the member objects of @p obj. + + @since 1.8 + + @see evas_object_smart_member_add() + @see evas_object_smart_member_del() + @see evas_object_smart_members_get() */ + + const; + return Eina_Iterator * @warn_unused; + } + callback_description_find { + /*@ + Find callback description for callback called @a name. + + or @c NULL if not found. If parameter is @c NULL, no search + will be done on instance descriptions. + @return reference to description if found, @c NULL if not found. */ + + const; + params { + @in const char *name @nonull; /*@ name of desired callback, must @b not be @c NULL. The + search have a special case for @a name being the same + pointer as registered with Evas_Smart_Cb_Description, one + can use it to avoid excessive use of strcmp(). */ + @out const Evas_Smart_Cb_Description *class_description; /*@ pointer to return class description or + @c NULL if not found. If parameter is @c NULL, no search will + be done on class descriptions. */ + @out const Evas_Smart_Cb_Description *instance_description; /*@ pointer to return instance description */ + } + } + hide { + /*@ No description supplied by the EAPI. */ + } + calculate { + /*@ + Call the @b calculate() smart function immediately on a given smart + object. + + This will force immediate calculations (see #Evas_Smart_Class) + needed for renderization of this object and, besides, unset the + flag on it telling it needs recalculation for the next rendering + phase. + + @see evas_object_smart_need_recalculate_set() + + @ingroup Evas_Smart_Object_Group */ + + } + add { + /*@ + Instantiates a new smart object described by @p s. + + @return a new #Evas_Object handle + + This is the function one should use when defining the public + function @b adding an instance of the new smart object to a given + canvas. It will take care of setting all of its internals to work + as they should, if the user set things properly, as seem on the + #EVAS_SMART_SUBCLASS_NEW, for example. + + @ingroup Evas_Smart_Object_Group */ + legacy null; + } + member_add { + /*@ + Set an Evas object as a member of a given smart object. + + Members will automatically be stacked and layered together with the + smart object. The various stacking functions will operate on + members relative to the other members instead of the entire canvas, + since they now live on an exclusive layer (see + evas_object_stack_above(), for more details). + + Any @p smart_obj object's specific implementation of the @c + member_add() smart function will take place too, naturally. + + @see evas_object_smart_member_del() + @see evas_object_smart_members_get() + + @ingroup Evas_Smart_Object_Group */ + + params { + @in Evas_Object *sub_obj @nonull; /*@ The member object */ + } + legacy null; + } + resize { + /*@ No description supplied by the EAPI. */ + params { + @in Evas_Coord w; + @in Evas_Coord h; + } + } + clip_unset { + /*@ No description supplied by the EAPI. */ + } + changed { + /*@ + Mark smart object as changed, dirty. + + This will flag the given object as needing recalculation, + forcefully. As an effect, on the next rendering cycle its @b + calculate() (see #Evas_Smart_Class) smart function will be called. + + @see evas_object_smart_need_recalculate_set(). + @see evas_object_smart_calculate(). + + @ingroup Evas_Smart_Object_Group */ + + } + member_del { + /*@ + Removes a member object from a given smart object. + + This removes a member object from a smart object, if it was added + to any. The object will still be on the canvas, but no longer + associated with whichever smart object it was associated with. + + @see evas_object_smart_member_add() for more details + @see evas_object_smart_members_get() */ + + params { + @in Evas_Object *sub_obj; /*@ the member object + @ingroup Evas_Smart_Object_Group */ + } + legacy null; + } + del { + /*@ Deletes a smart object. */ + legacy null; + } + attach { + /*@ Attach a given smart data to a given smart object. */ + params { + @in Evas_Smart *s; + } + legacy null; + } + } + implements { + class::constructor; + class::destructor; + Eo_Base::constructor; + Evas_Object::smart_type_check_ptr; + Evas_Object::smart_type_check; + Evas_Object::smart_data::get; + } +}