forked from enlightenment/efl
Replace supported_types
Signed-off-by: Daniel Zaoui <daniel.zaoui@samsung.com> SVN revision: 83802
This commit is contained in:
parent
825df518a9
commit
ec7a42b204
|
@ -10,7 +10,7 @@ EAPI Eo_Op EDJE_OBJ_BASE_ID = EO_NOOP;
|
||||||
|
|
||||||
#define MY_CLASS EDJE_OBJ_CLASS
|
#define MY_CLASS EDJE_OBJ_CLASS
|
||||||
|
|
||||||
#define MY_CLASS_NAME "Edje_Smart"
|
#define MY_CLASS_NAME "edje"
|
||||||
|
|
||||||
Eina_List *_edje_edjes = NULL;
|
Eina_List *_edje_edjes = NULL;
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ _edje_smart_constructor(Eo *obj, void *class_data, va_list *list EINA_UNUSED)
|
||||||
ed->base = eo_data_get(obj, EVAS_OBJ_SMART_CLIPPED_CLASS);
|
ed->base = eo_data_get(obj, EVAS_OBJ_SMART_CLIPPED_CLASS);
|
||||||
|
|
||||||
eo_do_super(obj, eo_constructor());
|
eo_do_super(obj, eo_constructor());
|
||||||
eo_do(obj, evas_obj_type_set("edje"));
|
eo_do(obj, evas_obj_type_set(MY_CLASS_NAME));
|
||||||
_edje_lib_ref();
|
_edje_lib_ref();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,6 +489,8 @@ _edje_smart_class_constructor(Eo_Class *klass)
|
||||||
};
|
};
|
||||||
|
|
||||||
eo_class_funcs_set(klass, func_desc);
|
eo_class_funcs_set(klass, func_desc);
|
||||||
|
|
||||||
|
evas_smart_legacy_type_register(MY_CLASS_NAME, klass);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const Eo_Op_Description op_desc[] = {
|
static const Eo_Op_Description op_desc[] = {
|
||||||
|
|
|
@ -13583,10 +13583,11 @@ EAPI Evas_Object *evas_object_smart_parent_get(const Evas_Object *obj) EINA_WARN
|
||||||
* type, @c EINA_FALSE otherwise
|
* type, @c EINA_FALSE otherwise
|
||||||
*
|
*
|
||||||
* If @p obj is not a smart object, this call will fail
|
* If @p obj is not a smart object, this call will fail
|
||||||
* immediately. Otherwise, make sure evas_smart_class_inherit() or its
|
* immediately.
|
||||||
* sibling functions were used correctly when creating the smart
|
*
|
||||||
* object's class, so it has a valid @b parent smart class pointer
|
* This function supports Eo and legacy inheritance mechanisms. However,
|
||||||
* set.
|
* it is recommended to use eo_isa instead if your object is using Eo from
|
||||||
|
* top to bottom.
|
||||||
*
|
*
|
||||||
* The checks use smart classes names and <b>string
|
* The checks use smart classes names and <b>string
|
||||||
* comparison</b>. There is a version of this same check using
|
* comparison</b>. There is a version of this same check using
|
||||||
|
@ -13594,7 +13595,7 @@ EAPI Evas_Object *evas_object_smart_parent_get(const Evas_Object *obj) EINA_WARN
|
||||||
* string in Evas.
|
* string in Evas.
|
||||||
*
|
*
|
||||||
* @see evas_object_smart_type_check_ptr()
|
* @see evas_object_smart_type_check_ptr()
|
||||||
* @see #EVAS_SMART_SUBCLASS_NEW
|
* @see eo_isa
|
||||||
*
|
*
|
||||||
* @ingroup Evas_Smart_Object_Group
|
* @ingroup Evas_Smart_Object_Group
|
||||||
*/
|
*/
|
||||||
|
@ -13610,11 +13611,32 @@ EAPI Eina_Bool evas_object_smart_type_check(const Evas_Object *obj, const cha
|
||||||
* type, @c EINA_FALSE otherwise
|
* type, @c EINA_FALSE otherwise
|
||||||
*
|
*
|
||||||
* @see evas_object_smart_type_check() for more details
|
* @see evas_object_smart_type_check() for more details
|
||||||
|
* @see eo_isa
|
||||||
*
|
*
|
||||||
* @ingroup Evas_Smart_Object_Group
|
* @ingroup Evas_Smart_Object_Group
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Bool evas_object_smart_type_check_ptr(const Evas_Object *obj, const char *type) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2);
|
EAPI Eina_Bool evas_object_smart_type_check_ptr(const Evas_Object *obj, const char *type) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers an object type and its associated class. LEGACY MECHANISM SUPPORT.
|
||||||
|
*
|
||||||
|
* This function is invoked in the class constructor of smart classes. It will
|
||||||
|
* add the type and the class into a hash table that will then be used to check
|
||||||
|
* the type of an object.
|
||||||
|
* This function has been implemented to support legacy mechanism that checks
|
||||||
|
* objects types by name.
|
||||||
|
* USE IT ONLY FOR LEGACY SUPPORT.
|
||||||
|
* Otherwise, it is HIGHLY recommended to use eo_isa.
|
||||||
|
*
|
||||||
|
* @param type The type (name string) to add.
|
||||||
|
* @param klass The class to associate to the type.
|
||||||
|
*
|
||||||
|
* @see eo_isa
|
||||||
|
*
|
||||||
|
* @ingroup Evas_Smart_Object_Group
|
||||||
|
*/
|
||||||
|
EAPI void evas_smart_legacy_type_register(const char *type, const Eo_Class *klass) EINA_ARG_NONNULL(1, 2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the #Evas_Smart from which @p obj smart object was created.
|
* Get the #Evas_Smart from which @p obj smart object was created.
|
||||||
*
|
*
|
||||||
|
@ -17434,7 +17456,6 @@ enum
|
||||||
EVAS_OBJ_SUB_ID_STACK_BELOW,
|
EVAS_OBJ_SUB_ID_STACK_BELOW,
|
||||||
EVAS_OBJ_SUB_ID_ABOVE_GET,
|
EVAS_OBJ_SUB_ID_ABOVE_GET,
|
||||||
EVAS_OBJ_SUB_ID_BELOW_GET,
|
EVAS_OBJ_SUB_ID_BELOW_GET,
|
||||||
EVAS_OBJ_SUB_ID_TYPE_CHECK,
|
|
||||||
EVAS_OBJ_SUB_ID_LAST
|
EVAS_OBJ_SUB_ID_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -18399,21 +18420,6 @@ enum
|
||||||
*/
|
*/
|
||||||
#define evas_obj_below_get(ret) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_BELOW_GET), EO_TYPECHECK(Evas_Object **, ret)
|
#define evas_obj_below_get(ret) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_BELOW_GET), EO_TYPECHECK(Evas_Object **, ret)
|
||||||
|
|
||||||
/**
|
|
||||||
* @def evas_obj_type_check
|
|
||||||
* @since 1.8
|
|
||||||
*
|
|
||||||
* Checks whether a given object is of a given class.
|
|
||||||
*
|
|
||||||
* @param[in] type in
|
|
||||||
* @param[out] type_check out
|
|
||||||
*
|
|
||||||
* This function has been implemented to support legacy smart inheritance
|
|
||||||
* and needs to be removed when all the objects are Eo objects (inc. Edje and ELM)
|
|
||||||
* @see evas_object_smart_type_check
|
|
||||||
*/
|
|
||||||
#define evas_obj_type_check(type, type_check) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_TYPE_CHECK), EO_TYPECHECK(const char *, type), EO_TYPECHECK(Eina_Bool *, type_check)
|
|
||||||
|
|
||||||
#define EVAS_OBJ_CLASS evas_object_class_get()
|
#define EVAS_OBJ_CLASS evas_object_class_get()
|
||||||
|
|
||||||
const Eo_Class *evas_object_class_get(void) EINA_CONST;
|
const Eo_Class *evas_object_class_get(void) EINA_CONST;
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
EAPI Eo_Op EVAS_OBJ_BOX_BASE_ID = EO_NOOP;
|
EAPI Eo_Op EVAS_OBJ_BOX_BASE_ID = EO_NOOP;
|
||||||
|
|
||||||
|
#define MY_CLASS_NAME "Evas_Object_Box"
|
||||||
|
|
||||||
#define MY_CLASS EVAS_OBJ_BOX_CLASS
|
#define MY_CLASS EVAS_OBJ_BOX_CLASS
|
||||||
|
|
||||||
typedef struct _Evas_Object_Box_Iterator Evas_Object_Box_Iterator;
|
typedef struct _Evas_Object_Box_Iterator Evas_Object_Box_Iterator;
|
||||||
|
@ -30,7 +32,6 @@ struct _Evas_Object_Box_Accessor
|
||||||
const Evas_Object *box;
|
const Evas_Object *box;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define _evas_object_box_type "Evas_Object_Box"
|
|
||||||
#define SIG_CHILD_ADDED "child,added"
|
#define SIG_CHILD_ADDED "child,added"
|
||||||
#define SIG_CHILD_REMOVED "child,removed"
|
#define SIG_CHILD_REMOVED "child,removed"
|
||||||
|
|
||||||
|
@ -502,24 +503,13 @@ evas_object_box_add(Evas *evas)
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_type_check(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
|
|
||||||
{
|
|
||||||
const char *type = va_arg(*list, const char *);
|
|
||||||
Eina_Bool *type_check = va_arg(*list, Eina_Bool *);
|
|
||||||
if (0 == strcmp(type, _evas_object_box_type))
|
|
||||||
*type_check = EINA_TRUE;
|
|
||||||
else
|
|
||||||
eo_do_super(obj, evas_obj_type_check(type, type_check));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
|
_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
|
||||||
{
|
{
|
||||||
eo_do_super(obj, eo_constructor());
|
eo_do_super(obj, eo_constructor());
|
||||||
eo_do(obj,
|
eo_do(obj,
|
||||||
evas_obj_smart_callbacks_descriptions_set(_signals, NULL),
|
evas_obj_smart_callbacks_descriptions_set(_signals, NULL),
|
||||||
evas_obj_type_set(_evas_object_box_type));
|
evas_obj_type_set(MY_CLASS_NAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Evas_Object *
|
EAPI Evas_Object *
|
||||||
|
@ -2308,7 +2298,6 @@ _class_constructor(Eo_Class *klass)
|
||||||
const Eo_Op_Func_Description func_desc[] = {
|
const Eo_Op_Func_Description func_desc[] = {
|
||||||
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
|
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
|
||||||
|
|
||||||
EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_TYPE_CHECK), _type_check),
|
|
||||||
EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_SMART_DATA_GET), _smart_data_get),
|
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_ADD), _smart_add),
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ADD), _smart_add),
|
||||||
|
@ -2359,6 +2348,8 @@ _class_constructor(Eo_Class *klass)
|
||||||
};
|
};
|
||||||
|
|
||||||
eo_class_funcs_set(klass, func_desc);
|
eo_class_funcs_set(klass, func_desc);
|
||||||
|
|
||||||
|
evas_smart_legacy_type_register(MY_CLASS_NAME, klass);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const Eo_Op_Description op_desc[] = {
|
static const Eo_Op_Description op_desc[] = {
|
||||||
|
@ -2406,7 +2397,7 @@ static const Eo_Op_Description op_desc[] = {
|
||||||
|
|
||||||
static const Eo_Class_Description class_desc = {
|
static const Eo_Class_Description class_desc = {
|
||||||
EO_VERSION,
|
EO_VERSION,
|
||||||
"Evas_Object_Box",
|
MY_CLASS_NAME,
|
||||||
EO_CLASS_TYPE_REGULAR,
|
EO_CLASS_TYPE_REGULAR,
|
||||||
EO_CLASS_DESCRIPTION_OPS(&EVAS_OBJ_BOX_BASE_ID, op_desc, EVAS_OBJ_BOX_SUB_ID_LAST),
|
EO_CLASS_DESCRIPTION_OPS(&EVAS_OBJ_BOX_BASE_ID, op_desc, EVAS_OBJ_BOX_SUB_ID_LAST),
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -618,7 +618,6 @@ _destructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
|
||||||
obj->delete_me = 1;
|
obj->delete_me = 1;
|
||||||
evas_object_change(eo_obj, obj);
|
evas_object_change(eo_obj, obj);
|
||||||
end:
|
end:
|
||||||
obj->supported_types = eina_list_free(obj->supported_types);
|
|
||||||
eo_do_super(eo_obj, eo_destructor());
|
eo_do_super(eo_obj, eo_destructor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2265,8 +2264,6 @@ _type_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
|
||||||
Evas_Object_Protected_Data *obj = _pd;
|
Evas_Object_Protected_Data *obj = _pd;
|
||||||
const char *type = va_arg(*list, const char *);
|
const char *type = va_arg(*list, const char *);
|
||||||
obj->type = type; // Store it as the top type of this class
|
obj->type = type; // Store it as the top type of this class
|
||||||
// Need to add this type to the list of all the types supported
|
|
||||||
obj->supported_types = eina_list_append(obj->supported_types, type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
@ -2394,101 +2391,21 @@ _smart_data_get(Eo *eo_obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_type_check(Eo *eo_obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
|
_smart_type_check(Eo *eo_obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
|
||||||
{
|
{
|
||||||
const char *type = va_arg(*list, const char *);
|
va_arg(*list, const char *);
|
||||||
Eina_Bool *type_check = va_arg(*list, Eina_Bool *);
|
Eina_Bool *type_check = va_arg(*list, Eina_Bool *);
|
||||||
if (0 == strcmp(type, "Evas_Object"))
|
|
||||||
*type_check = EINA_TRUE;
|
|
||||||
else
|
|
||||||
*type_check = EINA_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_smart_type_check(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
|
|
||||||
{
|
|
||||||
const char *type = va_arg(*list, const char *);
|
|
||||||
Eina_Bool *type_check = va_arg(*list, Eina_Bool *);
|
|
||||||
|
|
||||||
const Evas_Smart_Class *sc;
|
|
||||||
|
|
||||||
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
|
||||||
if (!obj) return;
|
|
||||||
if (!obj->is_smart)
|
|
||||||
{
|
|
||||||
*type_check = EINA_FALSE;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obj->supported_types)
|
|
||||||
{
|
|
||||||
Eina_List *l;
|
|
||||||
const char *type_in_list;
|
|
||||||
EINA_LIST_FOREACH(obj->supported_types, l, type_in_list)
|
|
||||||
if (!strcmp(type_in_list, type))
|
|
||||||
{
|
|
||||||
*type_check = EINA_TRUE;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
eo_do((Eo *)eo_obj, evas_obj_type_check(type, 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;
|
|
||||||
}
|
|
||||||
sc = sc->parent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*type_check = EINA_FALSE;
|
*type_check = EINA_FALSE;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_smart_type_check_ptr(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
|
_smart_type_check_ptr(Eo *eo_obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
|
||||||
{
|
{
|
||||||
const Evas_Smart_Class *sc;
|
va_arg(*list, const char *);
|
||||||
const char* type = va_arg(*list, const char *);
|
|
||||||
Eina_Bool *type_check = va_arg(*list, Eina_Bool *);
|
Eina_Bool *type_check = va_arg(*list, Eina_Bool *);
|
||||||
|
*type_check = EINA_FALSE;
|
||||||
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
return;
|
||||||
if (!obj) return;
|
|
||||||
if (!obj->is_smart)
|
|
||||||
{
|
|
||||||
if (type_check) *type_check = EINA_FALSE;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
eo_do((Eo *)eo_obj, evas_obj_type_check(type, 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;
|
|
||||||
}
|
|
||||||
sc = sc->parent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type_check) *type_check = EINA_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2574,7 +2491,6 @@ _class_constructor(Eo_Class *klass)
|
||||||
EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_STACK_BELOW), _stack_below),
|
EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_STACK_BELOW), _stack_below),
|
||||||
EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_ABOVE_GET), _above_get),
|
EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_ABOVE_GET), _above_get),
|
||||||
EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_BELOW_GET), _below_get),
|
EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_BELOW_GET), _below_get),
|
||||||
EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_TYPE_CHECK), _type_check),
|
|
||||||
EO_OP_FUNC_SENTINEL
|
EO_OP_FUNC_SENTINEL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2657,7 +2573,6 @@ static const Eo_Op_Description op_desc[] = {
|
||||||
EO_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_STACK_BELOW, "Stack obj immediately below below"),
|
EO_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_STACK_BELOW, "Stack obj immediately below below"),
|
||||||
EO_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_ABOVE_GET, "Get the Evas object stacked right above obj"),
|
EO_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_ABOVE_GET, "Get the Evas object stacked right above obj"),
|
||||||
EO_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_BELOW_GET, "Get the Evas object stacked right below obj"),
|
EO_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_BELOW_GET, "Get the Evas object stacked right below obj"),
|
||||||
EO_OP_DESCRIPTION(EVAS_OBJ_SUB_ID_TYPE_CHECK, "description here"),
|
|
||||||
EO_OP_DESCRIPTION_SENTINEL
|
EO_OP_DESCRIPTION_SENTINEL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@ EAPI Eo_Op EVAS_OBJ_SMART_BASE_ID = EO_NOOP;
|
||||||
|
|
||||||
extern Eina_Hash* signals_hash_table;
|
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_Object_Smart Evas_Object_Smart;
|
||||||
typedef struct _Evas_Smart_Callback Evas_Smart_Callback;
|
typedef struct _Evas_Smart_Callback Evas_Smart_Callback;
|
||||||
|
|
||||||
|
@ -307,17 +309,6 @@ evas_object_smart_parent_get(const Evas_Object *eo_obj)
|
||||||
return smart_parent;
|
return smart_parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_type_check(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
|
|
||||||
{
|
|
||||||
const char *type = va_arg(*list, const char *);
|
|
||||||
Eina_Bool *type_check = va_arg(*list, Eina_Bool *);
|
|
||||||
if (0 == strcmp(type, "Evas_Object_Smart"))
|
|
||||||
*type_check = EINA_TRUE;
|
|
||||||
else
|
|
||||||
eo_do_super(eo_obj, evas_obj_type_check(type, type_check));
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
evas_object_smart_type_check(const Evas_Object *eo_obj, const char *type)
|
evas_object_smart_type_check(const Evas_Object *eo_obj, const char *type)
|
||||||
{
|
{
|
||||||
|
@ -329,6 +320,41 @@ evas_object_smart_type_check(const Evas_Object *eo_obj, const char *type)
|
||||||
return type_check;
|
return type_check;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_smart_type_check(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
||||||
|
if (!obj) return;
|
||||||
|
|
||||||
|
klass = eina_hash_find(_evas_smart_class_names_hash_table, type);
|
||||||
|
if (klass) *type_check = eo_isa(eo_obj, klass);
|
||||||
|
|
||||||
|
/* Backward compatibility - walk over smart classes and compare type */
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
sc = sc->parent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
evas_object_smart_type_check_ptr(const Evas_Object *eo_obj, const char *type)
|
evas_object_smart_type_check_ptr(const Evas_Object *eo_obj, const char *type)
|
||||||
{
|
{
|
||||||
|
@ -340,6 +366,46 @@ evas_object_smart_type_check_ptr(const Evas_Object *eo_obj, const char *type)
|
||||||
return type_check_ptr;
|
return type_check_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_smart_type_check_ptr(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
|
Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
|
||||||
|
if (!obj) return;
|
||||||
|
|
||||||
|
klass = eina_hash_find(_evas_smart_class_names_hash_table, type);
|
||||||
|
if (klass) *type_check = eo_isa(eo_obj, klass);
|
||||||
|
|
||||||
|
/* Backward compatibility - walk over smart classes and compare type */
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
sc = sc->parent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
evas_smart_legacy_type_register(const char *type, const Eo_Class *klass)
|
||||||
|
{
|
||||||
|
eina_hash_set(_evas_smart_class_names_hash_table, type, klass);
|
||||||
|
}
|
||||||
|
|
||||||
EAPI Eina_List *
|
EAPI Eina_List *
|
||||||
evas_object_smart_members_get(const Evas_Object *eo_obj)
|
evas_object_smart_members_get(const Evas_Object *eo_obj)
|
||||||
{
|
{
|
||||||
|
@ -1442,7 +1508,8 @@ _class_constructor(Eo_Class *klass)
|
||||||
{
|
{
|
||||||
const Eo_Op_Func_Description func_desc[] = {
|
const Eo_Op_Func_Description func_desc[] = {
|
||||||
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
|
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
|
||||||
EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_TYPE_CHECK), _type_check),
|
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_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_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_ADD), _smart_member_add),
|
||||||
|
@ -1470,6 +1537,16 @@ _class_constructor(Eo_Class *klass)
|
||||||
};
|
};
|
||||||
|
|
||||||
eo_class_funcs_set(klass, func_desc);
|
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, klass);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_class_destructor(Eo_Class *klass EINA_UNUSED)
|
||||||
|
{
|
||||||
|
eina_hash_free(_evas_smart_class_names_hash_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const Eo_Op_Description op_desc[] = {
|
static const Eo_Op_Description op_desc[] = {
|
||||||
|
@ -1506,7 +1583,7 @@ static const Eo_Class_Description class_desc = {
|
||||||
NULL,
|
NULL,
|
||||||
sizeof(Evas_Object_Smart),
|
sizeof(Evas_Object_Smart),
|
||||||
_class_constructor,
|
_class_constructor,
|
||||||
NULL
|
_class_destructor
|
||||||
};
|
};
|
||||||
|
|
||||||
EO_DEFINE_CLASS(evas_object_smart_class_get, &class_desc, EVAS_OBJ_CLASS, EVAS_SMART_SIGNAL_INTERFACE, NULL);
|
EO_DEFINE_CLASS(evas_object_smart_class_get, &class_desc, EVAS_OBJ_CLASS, EVAS_SMART_SIGNAL_INTERFACE, NULL);
|
||||||
|
|
|
@ -282,17 +282,6 @@ evas_object_smart_clipped_class_get(void)
|
||||||
return class;
|
return class;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_type_check(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
|
|
||||||
{
|
|
||||||
const char *type = va_arg(*list, const char *);
|
|
||||||
Eina_Bool *type_check = va_arg(*list, Eina_Bool *);
|
|
||||||
if (0 == strcmp(type, "EvasObjectSmartClipped"))
|
|
||||||
*type_check = EINA_TRUE;
|
|
||||||
else
|
|
||||||
eo_do_super(eo_obj, evas_obj_type_check(type, type_check));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_constructor(Eo *eo_obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
|
_constructor(Eo *eo_obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
@ -304,7 +293,6 @@ _class_constructor(Eo_Class *klass)
|
||||||
{
|
{
|
||||||
const Eo_Op_Func_Description func_desc[] = {
|
const Eo_Op_Func_Description func_desc[] = {
|
||||||
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
|
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
|
||||||
EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_TYPE_CHECK), _type_check),
|
|
||||||
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_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_DEL), _smart_del),
|
||||||
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_MOVE), _smart_move),
|
||||||
|
|
|
@ -1588,6 +1588,8 @@ _class_constructor(Eo_Class *klass)
|
||||||
EO_OP_FUNC_SENTINEL
|
EO_OP_FUNC_SENTINEL
|
||||||
};
|
};
|
||||||
eo_class_funcs_set(klass, func_desc);
|
eo_class_funcs_set(klass, func_desc);
|
||||||
|
|
||||||
|
evas_smart_legacy_type_register(MY_CLASS_NAME, klass);
|
||||||
}
|
}
|
||||||
static const Eo_Op_Description op_desc[] = {
|
static const Eo_Op_Description op_desc[] = {
|
||||||
EO_OP_DESCRIPTION(EVAS_OBJ_TABLE_SUB_ID_ADD_TO, "Create a table that is child of a given element parent."),
|
EO_OP_DESCRIPTION(EVAS_OBJ_TABLE_SUB_ID_ADD_TO, "Create a table that is child of a given element parent."),
|
||||||
|
|
|
@ -614,7 +614,6 @@ struct _Evas_Object_Protected_Data
|
||||||
void **interface_privates;
|
void **interface_privates;
|
||||||
|
|
||||||
unsigned int ref;
|
unsigned int ref;
|
||||||
Eina_List *supported_types;
|
|
||||||
|
|
||||||
unsigned char delete_me;
|
unsigned char delete_me;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue