summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ChangeLog4
-rw-r--r--NEWS1
-rw-r--r--src/lib/evas/Evas_Eo.h16
-rw-r--r--src/lib/evas/Evas_Legacy.h16
-rw-r--r--src/lib/evas/canvas/evas_object_smart.c82
5 files changed, 119 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 27c321a6f7..f115014244 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
12013-09-05 Cedric Bail
2
3 * Evas: Add evas_object_smart_iterator_new().
4
12013-09-04 Michael Bouchaud (yoz) 52013-09-04 Michael Bouchaud (yoz)
2 6
3 * fix edje_object_scale_set to be recursive 7 * fix edje_object_scale_set to be recursive
diff --git a/NEWS b/NEWS
index 1da60c23f4..0794a9efc7 100644
--- a/NEWS
+++ b/NEWS
@@ -209,6 +209,7 @@ Improvements:
209 - Asynchronous preload of GL texture. 209 - Asynchronous preload of GL texture.
210 - Add neon assembly for upscaling and map routines 210 - Add neon assembly for upscaling and map routines
211 - Use mmap/munmap for image data allocation on system that have mmap. 211 - Use mmap/munmap for image data allocation on system that have mmap.
212 - Add iterator for walking child of smart objects, table and a box.
212 * Ecore_Con: 213 * Ecore_Con:
213 - Rebase dns.c against upstream 214 - Rebase dns.c against upstream
214 * Edje: 215 * Edje:
diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h
index e4b83e8034..232483107b 100644
--- a/src/lib/evas/Evas_Eo.h
+++ b/src/lib/evas/Evas_Eo.h
@@ -2978,6 +2978,7 @@ enum
2978 EVAS_OBJ_SMART_SUB_ID_MEMBER_ADD, 2978 EVAS_OBJ_SMART_SUB_ID_MEMBER_ADD,
2979 EVAS_OBJ_SMART_SUB_ID_MEMBER_DEL, 2979 EVAS_OBJ_SMART_SUB_ID_MEMBER_DEL,
2980 EVAS_OBJ_SMART_SUB_ID_MEMBERS_GET, 2980 EVAS_OBJ_SMART_SUB_ID_MEMBERS_GET,
2981 EVAS_OBJ_SMART_SUB_ID_ITERATOR_NEW,
2981 EVAS_OBJ_SMART_SUB_ID_CALLBACKS_DESCRIPTIONS_SET, 2982 EVAS_OBJ_SMART_SUB_ID_CALLBACKS_DESCRIPTIONS_SET,
2982 EVAS_OBJ_SMART_SUB_ID_CALLBACKS_DESCRIPTIONS_GET, 2983 EVAS_OBJ_SMART_SUB_ID_CALLBACKS_DESCRIPTIONS_GET,
2983 EVAS_OBJ_SMART_SUB_ID_CALLBACK_DESCRIPTION_FIND, 2984 EVAS_OBJ_SMART_SUB_ID_CALLBACK_DESCRIPTION_FIND,
@@ -3059,10 +3060,25 @@ enum
3059 * @param[out] list out 3060 * @param[out] list out
3060 * 3061 *
3061 * @see evas_object_smart_members_get 3062 * @see evas_object_smart_members_get
3063 * @see evas_object_smart_iterator_new
3062 */ 3064 */
3063#define evas_obj_smart_members_get(list) EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_MEMBERS_GET), EO_TYPECHECK(Eina_List **, list) 3065#define evas_obj_smart_members_get(list) EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_MEMBERS_GET), EO_TYPECHECK(Eina_List **, list)
3064 3066
3065/** 3067/**
3068 * @def evas_obj_smart_iterator_new
3069 * @since 1.8
3070 *
3071 * Retrieves an iterator of the member objects of a given Evas smart
3072 * object
3073 *
3074 * @param[out] iterator out
3075 *
3076 * @see evas_object_smart_iterator_new
3077 * @see evas_object_smart_members_get
3078 */
3079#define evas_obj_smart_iterator_new(it) EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ITERATOR_NEW), EO_TYPECHECK(Eina_Iterator **, it)
3080
3081/**
3066 * @def evas_obj_smart_callback_priority_add 3082 * @def evas_obj_smart_callback_priority_add
3067 * @since 1.8 3083 * @since 1.8
3068 * 3084 *
diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h
index 25fec60284..5294ce7909 100644
--- a/src/lib/evas/Evas_Legacy.h
+++ b/src/lib/evas/Evas_Legacy.h
@@ -6322,10 +6322,26 @@ EAPI void evas_object_smart_member_del(Evas_Object *obj) EINA_ARG_NONNUL
6322 * 6322 *
6323 * @see evas_object_smart_member_add() 6323 * @see evas_object_smart_member_add()
6324 * @see evas_object_smart_member_del() 6324 * @see evas_object_smart_member_del()
6325 * @see evas_object_smart_iterator_new()
6325 */ 6326 */
6326EAPI Eina_List *evas_object_smart_members_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); 6327EAPI Eina_List *evas_object_smart_members_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
6327 6328
6328/** 6329/**
6330 * Retrieves an iterator of the member objects of a given Evas smart
6331 * object
6332 *
6333 * @param obj the smart object to get members from
6334 * @return Returns the iterator of the member objects of @p obj.
6335 *
6336 * @since 1.8
6337 *
6338 * @see evas_object_smart_member_add()
6339 * @see evas_object_smart_member_del()
6340 * @see evas_object_smart_members_get()
6341 */
6342EAPI Eina_Iterator *evas_object_smart_iterator_new(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
6343
6344/**
6329 * Gets the parent smart object of a given Evas object, if it has one. 6345 * Gets the parent smart object of a given Evas object, if it has one.
6330 * 6346 *
6331 * @param obj the Evas object you want to get the parent smart object 6347 * @param obj the Evas object you want to get the parent smart object
diff --git a/src/lib/evas/canvas/evas_object_smart.c b/src/lib/evas/canvas/evas_object_smart.c
index 8b1d8853b9..f3f26311b3 100644
--- a/src/lib/evas/canvas/evas_object_smart.c
+++ b/src/lib/evas/canvas/evas_object_smart.c
@@ -51,6 +51,16 @@ typedef struct
51 _Evas_Event_Description *desc; 51 _Evas_Event_Description *desc;
52} _eo_evas_smart_cb_info; 52} _eo_evas_smart_cb_info;
53 53
54
55typedef struct _Evas_Object_Smart_Iterator Evas_Object_Smart_Iterator;
56struct _Evas_Object_Smart_Iterator
57{
58 Eina_Iterator iterator;
59
60 const Eina_Inlist *current;
61 Evas_Object *parent;
62};
63
54static Eina_Bool 64static Eina_Bool
55_eo_evas_smart_cb(void *data, Eo *eo_obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info) 65_eo_evas_smart_cb(void *data, Eo *eo_obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info)
56{ 66{
@@ -447,6 +457,76 @@ evas_smart_legacy_type_register(const char *type, const Eo_Class *klass)
447 eina_hash_set(_evas_smart_class_names_hash_table, type, klass); 457 eina_hash_set(_evas_smart_class_names_hash_table, type, klass);
448} 458}
449 459
460static Eina_Bool
461_evas_object_smart_iterator_next(Evas_Object_Smart_Iterator *it, void **data)
462{
463 Evas_Object *eo;
464
465 if (!it->current) return EINA_FALSE;
466
467 eo = ((const Evas_Object_Protected_Data*)(it->current))->object;
468 if (data) *data = eo;
469
470 it->current = it->current->next;
471
472 return EINA_TRUE;
473}
474
475static Evas_Object *
476_evas_object_smart_iterator_get_container(Evas_Object_Smart_Iterator *it)
477{
478 return it->parent;
479}
480
481static void
482_evas_object_smart_iterator_free(Evas_Object_Smart_Iterator *it)
483{
484 eo_unref(it->parent);
485 free(it);
486}
487
488// Should we have an eo_children_iterator_new API and just inherit from it ?
489EAPI Eina_Iterator *
490evas_object_smart_iterator_new(const Evas_Object *o)
491{
492 Eina_Iterator *ret = NULL;
493 eo_do((Eo *)o, evas_obj_smart_iterator_new(&ret));
494 return ret;
495}
496
497static void
498_iterator_new(Eo *o, void *_pd, va_list *list)
499{
500 Eina_Iterator **ret = va_arg(*list, Eina_Iterator **);
501
502 Evas_Object_Smart_Iterator *it;
503
504 const Evas_Object_Smart *priv = _pd;
505
506 if (!priv->contained)
507 {
508 *ret = NULL;
509 return ;
510 }
511
512 it = calloc(1, sizeof(Evas_Object_Smart_Iterator));
513 if (!it)
514 {
515 *ret = NULL;
516 return ;
517 }
518
519 EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR);
520 it->parent = eo_ref(o);
521 it->current = priv->contained;
522
523 it->iterator.next = FUNC_ITERATOR_NEXT(_evas_object_smart_iterator_next);
524 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_evas_object_smart_iterator_get_container);
525 it->iterator.free = FUNC_ITERATOR_FREE(_evas_object_smart_iterator_free);
526
527 *ret = &it->iterator;
528}
529
450EAPI Eina_List * 530EAPI Eina_List *
451evas_object_smart_members_get(const Evas_Object *eo_obj) 531evas_object_smart_members_get(const Evas_Object *eo_obj)
452{ 532{
@@ -1709,6 +1789,7 @@ _class_constructor(Eo_Class *klass)
1709 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_MEMBER_ADD), _smart_member_add), 1789 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_MEMBER_ADD), _smart_member_add),
1710 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_MEMBER_DEL), _smart_member_del), 1790 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_MEMBER_DEL), _smart_member_del),
1711 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_MEMBERS_GET), _smart_members_get), 1791 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_MEMBERS_GET), _smart_members_get),
1792 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ITERATOR_NEW), _iterator_new),
1712 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CALLBACKS_DESCRIPTIONS_SET), _smart_callbacks_descriptions_set), 1793 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CALLBACKS_DESCRIPTIONS_SET), _smart_callbacks_descriptions_set),
1713 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CALLBACKS_DESCRIPTIONS_GET), _smart_callbacks_descriptions_get), 1794 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CALLBACKS_DESCRIPTIONS_GET), _smart_callbacks_descriptions_get),
1714 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CALLBACK_DESCRIPTION_FIND), _smart_callback_description_find), 1795 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CALLBACK_DESCRIPTION_FIND), _smart_callback_description_find),
@@ -1749,6 +1830,7 @@ static const Eo_Op_Description op_desc[] = {
1749 EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_MEMBER_ADD, "Set an Evas object as a member of a given smart object."), 1830 EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_MEMBER_ADD, "Set an Evas object as a member of a given smart object."),
1750 EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_MEMBER_DEL, "Removes a member object from a given smart object."), 1831 EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_MEMBER_DEL, "Removes a member object from a given smart object."),
1751 EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_MEMBERS_GET, "Retrieves the list of the member objects of a given Evas smart"), 1832 EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_MEMBERS_GET, "Retrieves the list of the member objects of a given Evas smart"),
1833 EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_ITERATOR_NEW, "Retrieves an iterator of the member object of a given Evas smart"),
1752 EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_CALLBACKS_DESCRIPTIONS_SET, "Set an smart object instance's smart callbacks descriptions."), 1834 EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_CALLBACKS_DESCRIPTIONS_SET, "Set an smart object instance's smart callbacks descriptions."),
1753 EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_CALLBACKS_DESCRIPTIONS_GET, "Retrieve an smart object's know smart callback descriptions (both"), 1835 EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_CALLBACKS_DESCRIPTIONS_GET, "Retrieve an smart object's know smart callback descriptions (both"),
1754 EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_CALLBACK_DESCRIPTION_FIND, "Find callback description for callback called name."), 1836 EO_OP_DESCRIPTION(EVAS_OBJ_SMART_SUB_ID_CALLBACK_DESCRIPTION_FIND, "Find callback description for callback called name."),