edje: add edje_object_color_class_clear() 76/90076/2
authorJee-Yong Um <conr2d@gmail.com>
Wed, 28 Sep 2016 07:50:37 +0000 (16:50 +0900)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Wed, 28 Sep 2016 08:17:03 +0000 (01:17 -0700)
===============================================================
commit c963a0f9cb3009b7ad1a5cdc623b0d7c9f8d3e4f
Author: Jee-Yong Um <conr2d@gmail.com>
Date:   Mon Jan 4 15:10:58 2016 -0800

    edje: add edje_object_color_class_clear()

    Summary: clear all color classes defined in edje object

    Reviewers: raster, jpeg

    Subscribers: woohyun, cedric, kimcinoo

    Differential Revision: https://phab.enlightenment.org/D3514

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
===============================================================

Signed-Off-By: Jee-Yong Um <jc9.um@samsung.com>
Change-Id: Ifae7a3b2672ed416a6707ac70e2b81c975caf421

src/lib/edje/edje_object.eo
src/lib/edje/edje_util.c

index fcebbed..097b8c4 100644 (file)
@@ -1910,6 +1910,12 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File)
             @in color_class: const(char)*;
          }
       }
+      color_class_clear @const {
+         [[Clear object color classes.
+
+           @since 1.17.0]]
+         return: bool; [[$true, on success or $false, on error]]
+      }
       part_drag_step {
          [[Steps the dragable x,y steps.
 
index 2d151ed..e0b9567 100644 (file)
@@ -1035,6 +1035,52 @@ edje_object_color_class_del(Evas_Object *obj, const char *color_class)
    _edje_emit(ed, "color_class,del", color_class);
 }
 
+EOLIAN Eina_Bool
+_edje_object_color_class_clear(const Eo *obj EINA_UNUSED, Edje *ed)
+{
+   Edje_List_Foreach_Data fdata;
+   Edje_Color_Class *cc = NULL;
+   Eina_List *l;
+   char *color_class;
+   unsigned short i;
+   Eina_Bool int_ret = EINA_TRUE;
+
+   if (!ed) return EINA_FALSE;
+
+   memset(&fdata, 0, sizeof(Edje_List_Foreach_Data));
+   eina_hash_foreach(ed->color_classes, _edje_color_class_list_foreach, &fdata);
+
+   EINA_LIST_FOREACH(fdata.list, l, color_class)
+     eina_hash_del(ed->color_classes, color_class, cc);
+
+   for (i = 0; i < ed->table_parts_size; i++)
+     {
+        Edje_Real_Part *rp;
+
+        rp = ed->table_parts[i];
+        if ((rp->part->type == EDJE_PART_TYPE_GROUP) &&
+            ((rp->type == EDJE_RP_TYPE_SWALLOW) &&
+             (rp->typedata.swallow)) &&
+            (rp->typedata.swallow->swallowed_object))
+          int_ret &= edje_object_color_class_clear(rp->typedata.swallow->swallowed_object);
+     }
+
+   ed->dirty = EINA_TRUE;
+   ed->recalc_call = EINA_TRUE;
+#ifdef EDJE_CALC_CACHE
+   ed->all_part_change = EINA_TRUE;
+#endif
+   _edje_recalc(ed);
+
+   EINA_LIST_FREE(fdata.list, color_class)
+     {
+        _edje_emit(ed, "color_class,del", color_class);
+        free(color_class);
+     }
+
+   return int_ret;
+}
+
 typedef struct _Edje_File_Color_Class_Iterator Edje_File_Color_Class_Iterator;
 struct _Edje_File_Color_Class_Iterator
 {