elementary: apply Tizen's color_class features 50/167050/7
authorYoungbok Shin <youngb.shin@samsung.com>
Mon, 15 Jan 2018 05:52:29 +0000 (14:52 +0900)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Tue, 16 Jan 2018 04:27:10 +0000 (04:27 +0000)
It adds the following APIs for public.
- elm_color_class_color_set/get
- elm_color_class_color2_set/get
- elm_color_class_color3_set/get
- elm_color_class_del
- elm_object_color_class_color_set/get
- elm_object_color_class_color2_set/get
- elm_object_color_class_color3_set/get
- elm_object_color_class_del
- elm_object_color_class_clear

@tizen_feature

Change-Id: Ife85be6aacc13ff985d27399b44447561a622f37

src/lib/elementary/efl_ui_widget.c
src/lib/elementary/efl_ui_widget.eo
src/lib/elementary/elm_entry.c
src/lib/elementary/elm_gengrid.c
src/lib/elementary/elm_main.c
src/lib/elementary/elm_object.h
src/lib/elementary/elm_priv.h
src/lib/elementary/elm_toolbar.c
src/lib/elementary/elm_widget.h

index c84f633..3890c48 100644 (file)
@@ -4006,6 +4006,15 @@ _elm_widget_item_efl_object_destructor(Eo *eo_item, Elm_Widget_Item_Data *item)
      efl_access_relation_set_free(&item->atspi_custom_relations);
    //
 
+   /***********************************************************************************
+    * TIZEN_ONLY_FEATURE: apply Tizen's color_class features.                         *
+    ***********************************************************************************/
+   if (item->color_classes)
+     ELM_SAFE_FREE(item->color_classes, eina_hash_free);
+   /*******
+    * END *
+    *******/
+
    EINA_MAGIC_SET(item, EINA_MAGIC_NONE);
 
    efl_destructor(efl_super(eo_item, ELM_WIDGET_ITEM_CLASS));
@@ -7424,8 +7433,54 @@ _elm_widget_item_efl_access_widget_action_elm_actions_get(Eo *obj EINA_UNUSED, E
 /***********************************************************************************
  * TIZEN_ONLY_FEATURE: apply Tizen's color_class features.                         *
  ***********************************************************************************/
+void
+_elm_widget_color_class_parent_set(Evas_Object *obj, Evas_Object *parent)
+{
+   Evas_Object *edje = NULL, *parent_edje = NULL;
+
+   if (!obj || !parent) return;
+
+   if (efl_isa(obj, EFL_UI_LAYOUT_CLASS))
+     edje =  elm_layout_edje_get(obj);
+   else if (efl_isa(obj, EFL_CANVAS_LAYOUT_CLASS))
+     edje = obj;
+
+   if (efl_isa(parent, EFL_UI_LAYOUT_CLASS))
+     parent_edje =  elm_layout_edje_get(parent);
+   else if (efl_isa(parent, EFL_CANVAS_LAYOUT_CLASS))
+     parent_edje = parent;
+
+   if (!edje || !parent_edje) return;
+
+   edje_object_color_class_parent_set(edje, parent_edje);
+}
+
+void
+_elm_widget_color_class_parent_unset(Evas_Object *obj)
+{
+   Evas_Object *edje = NULL;
+
+   if (!obj) return;
+
+   if (efl_isa(obj, EFL_UI_LAYOUT_CLASS))
+     edje =  elm_layout_edje_get(obj);
+   else if (efl_isa(obj, EFL_CANVAS_LAYOUT_CLASS))
+     edje = obj;
+
+   if (!edje) return;
+
+   edje_object_color_class_parent_unset(edje);
+}
+
+void
+_edje_color_class_free(void *data)
+{
+   Edje_Color_Class *cc = data;
+
+   if (cc->name) eina_stringshare_del(cc->name);
+   free(cc);
+}
 
-//TIZEN_ONLY(20160926): add customization interface
 Eina_Stringshare *
 _elm_widget_edje_class_get(const Efl_Class *klass, const char *style, const char *part)
 {
@@ -7434,11 +7489,9 @@ _elm_widget_edje_class_get(const Efl_Class *klass, const char *style, const char
 
    buf = eina_strbuf_new();
 
-   eina_strbuf_append(buf, efl_class_name_get(klass));
+   eina_strbuf_append(buf, strchr(efl_class_name_get(klass), '_') + 1);
    eina_strbuf_tolower(buf);
 
-   eina_strbuf_replace_first(buf, "elm_", "");
-
    if (style)
      {
         eina_strbuf_append_printf(buf, "/%s/%s", style, part);
@@ -7454,133 +7507,471 @@ _elm_widget_edje_class_get(const Efl_Class *klass, const char *style, const char
    return str;
 }
 
-#define ELM_COLOR_CLASS_SET_UPPER(klass) \
-   Eina_Stringshare *buf; \
-   Eina_Bool int_ret = EINA_FALSE; \
-   if (efl_isa(obj, klass)) \
-     { \
-        int r2 = 0, g2 = 0, b2 = 0, a2 = 0, r3 = 0, g3 = 0, b3 = 0, a3 = 0; \
-        buf = _elm_widget_edje_class_get(efl_class_get(obj), NULL, color_class); \
-        _elm_color_unpremul(a, &r, &g, &b)
+Eina_Bool
+_elm_widget_color_class_set_internal(Evas_Object *obj, Evas_Object *edje, const char *color_class,
+                                     int r, int g, int b, int a,
+                                     int r2, int g2, int b2, int a2,
+                                     int r3, int g3, int b3, int a3)
+{
+   Eina_Bool int_ret = EINA_TRUE;
+   Eina_Stringshare *buf;
+   int temp_color[3][4] = { { r,  g,  b,  a },
+                            { r2, g2, b2, a2 },
+                            { r3, g3, b3, a3 } };
 
-#define ELM_COLOR_CLASS_SET_LOWER() \
-        eina_stringshare_del(buf); \
-        return int_ret; \
-     } \
-   else \
-     { \
-        ERR("%s does not support %s() API.", elm_widget_type_get(obj), __func__); \
-        return EINA_FALSE; \
-     }
+   if (!color_class) return EINA_FALSE;
 
-EOLIAN static Eina_Bool
-_efl_ui_widget_color_class_color_set(Eo *obj, Elm_Widget_Smart_Data *sd, const char *color_class, int r, int g, int b, int a)
-{
-   ELM_COLOR_CLASS_SET_UPPER(EFL_UI_LAYOUT_CLASS);
-   edje_object_color_class_get(sd->resize_obj, buf, NULL, NULL, NULL, NULL, &r2, &g2, &b2, &a2, &r3, &g3, &b3, &a3);
-   int_ret = edje_object_color_class_set(sd->resize_obj, buf, r, g, b, a, r2, g2, b2, a2, r3, g3, b3, a3);
-   ELM_COLOR_CLASS_SET_LOWER();
-}
-
-#define ELM_COLOR_CLASS_GET_UPPER(klass) \
-   Eina_Stringshare *buf; \
-   Eina_Bool int_ret = EINA_FALSE; \
-   if (efl_isa(obj, klass)) \
-     { \
-        buf = _elm_widget_edje_class_get(efl_class_get(obj), NULL, color_class)
-
-#define ELM_COLOR_CLASS_GET_LOWER() \
-        _elm_color_premul(*a, r, g, b); \
-        eina_stringshare_del(buf); \
-        return int_ret; \
-     } \
-   else \
-     { \
-        ERR("%s does not support %s() API.", efl_class_name_get(efl_class_get(obj)), __func__); \
-        return EINA_FALSE; \
-      }
+   buf = _elm_widget_edje_class_get(efl_class_get(obj), NULL, color_class);
 
-EOLIAN static Eina_Bool
-_efl_ui_widget_color_class_color_get(Eo *obj, Elm_Widget_Smart_Data *sd, const char *color_class, int *r, int *g, int *b, int *a)
- {
-   ELM_COLOR_CLASS_GET_UPPER(EFL_UI_LAYOUT_CLASS);
-   int_ret = edje_object_color_class_get(sd->resize_obj, buf, r, g, b, a, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-   ELM_COLOR_CLASS_GET_LOWER();
+#define TEMP_COLOR(x, y) \
+   ((temp_color[x][y] == -1) ? &temp_color[x][y] : NULL)
+
+   edje_object_color_class_get(edje, buf,
+                               TEMP_COLOR(0, 0), TEMP_COLOR(0, 1), TEMP_COLOR(0, 2), TEMP_COLOR(0, 3),
+                               TEMP_COLOR(1, 0), TEMP_COLOR(1, 1), TEMP_COLOR(1, 2), TEMP_COLOR(1, 3),
+                               TEMP_COLOR(2, 0), TEMP_COLOR(2, 1), TEMP_COLOR(2, 2), TEMP_COLOR(2, 3));
+
+#undef TEMP_COLOR
+
+#define TEMP_COLOR(x, y) \
+   ((temp_color[x][y] == -1) ? 0 : temp_color[x][y])
+
+   int_ret &= edje_object_color_class_set(edje, buf,
+                                          TEMP_COLOR(0, 0), TEMP_COLOR(0, 1), TEMP_COLOR(0, 2), TEMP_COLOR(0, 3),
+                                          TEMP_COLOR(1, 0), TEMP_COLOR(1, 1), TEMP_COLOR(1, 2), TEMP_COLOR(1, 3),
+                                          TEMP_COLOR(2, 0), TEMP_COLOR(2, 1), TEMP_COLOR(2, 2), TEMP_COLOR(2, 3));
+
+#undef TEMP_COLOR
+
+   eina_stringshare_del(buf);
+
+   return int_ret;
 }
 
-EOLIAN static Eina_Bool
-_efl_ui_widget_color_class_color2_set(Eo *obj, Elm_Widget_Smart_Data *sd, const char *color_class, int r, int g, int b, int a)
+Eina_Bool
+_elm_widget_color_class_get_internal(Evas_Object *obj, Evas_Object *edje, const char *color_class,
+                                     int *r, int *g, int *b, int *a,
+                                     int *r2, int *g2, int *b2, int *a2,
+                                     int *r3, int *g3, int *b3, int *a3)
 {
-   ELM_COLOR_CLASS_SET_UPPER(EFL_UI_LAYOUT_CLASS);
-   edje_object_color_class_get(sd->resize_obj, buf, &r2, &g2, &b2, &a2, NULL, NULL, NULL, NULL, &r3, &g3, &b3, &a3);
-   int_ret = edje_object_color_class_set(sd->resize_obj, buf, r2, g2, b2, a2, r, g, b, a, r3, g3, b3, a3);
-   ELM_COLOR_CLASS_SET_LOWER();
+   Eina_Bool int_ret = EINA_TRUE;
+   Eina_Stringshare *buf;
+
+   if (!color_class) return EINA_FALSE;
+
+   buf = _elm_widget_edje_class_get(efl_class_get(obj), elm_widget_style_get(obj), color_class);
+
+   int_ret &= edje_object_color_class_get(edje, buf,
+                                          r,  g,  b,  a,
+                                          r2, g2, b2, a2,
+                                          r3, g3, b3, a3);
+
+   eina_stringshare_del(buf);
+
+   return int_ret;
 }
 
-EOLIAN static Eina_Bool
-_efl_ui_widget_color_class_color2_get(Eo *obj, Elm_Widget_Smart_Data *sd, const char *color_class, int *r, int *g, int *b, int *a)
+/* Internal EO API */
+static Eina_Bool
+_elm_widget_class_color_set(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSED, const char *color_class, int r, int g, int b, int a)
 {
-   ELM_COLOR_CLASS_GET_UPPER(EFL_UI_LAYOUT_CLASS);
-   int_ret = edje_object_color_class_get(sd->resize_obj, buf, NULL, NULL, NULL, NULL, r, g, b, a, NULL, NULL, NULL, NULL);
-   ELM_COLOR_CLASS_GET_LOWER();
+   Evas_Object *edje;
+   Eina_Bool int_ret = EINA_TRUE;
+
+   if (!efl_isa(obj, EFL_UI_LAYOUT_CLASS)) return EINA_FALSE;
+
+   edje = elm_layout_edje_get(obj);
+   int_ret &= _elm_widget_color_class_set_internal(obj, edje, color_class,
+                                                   r, g, b, a,
+                                                   -1, -1, -1, -1,
+                                                   -1, -1, -1, -1);
+
+   return int_ret;
 }
 
-EOLIAN static Eina_Bool
-_efl_ui_widget_color_class_color3_set(Eo *obj, Elm_Widget_Smart_Data *sd, const char *color_class, int r, int g, int b, int a)
+/* Internal EO API */
+static Eina_Bool
+_elm_widget_class_color_get(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSED, const char *color_class, int *r, int *g, int *b, int *a)
 {
-   ELM_COLOR_CLASS_SET_UPPER(EFL_UI_LAYOUT_CLASS);
-   edje_object_color_class_get(sd->resize_obj, buf, &r2, &g2, &b2, &a2, &r3, &g3, &b3, &a3, NULL, NULL, NULL, NULL);
-   int_ret = edje_object_color_class_set(sd->resize_obj, buf, r2, g2, b2, a2, r3, g3, b3, a3, r, g, b, a);
-   ELM_COLOR_CLASS_SET_LOWER();
+   Evas_Object *edje;
+   Eina_Bool int_ret = EINA_TRUE;
+
+   if (!efl_isa(obj, EFL_UI_LAYOUT_CLASS)) return EINA_FALSE;
+
+   edje = elm_layout_edje_get(obj);
+   int_ret &= _elm_widget_color_class_get_internal(obj, edje, color_class,
+                                                   r, g, b, a,
+                                                   NULL, NULL, NULL, NULL,
+                                                   NULL, NULL, NULL, NULL);
+
+   return int_ret;
 }
 
-EOLIAN static Eina_Bool
-_efl_ui_widget_color_class_color3_get(Eo *obj, Elm_Widget_Smart_Data *sd, const char *color_class, int *r, int *g, int *b, int *a)
+/* Internal EO API */
+static Eina_Bool
+_elm_widget_class_color2_set(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSED, const char *color_class, int r, int g, int b, int a)
 {
-   ELM_COLOR_CLASS_GET_UPPER(EFL_UI_LAYOUT_CLASS);
-   int_ret = edje_object_color_class_get(sd->resize_obj, buf, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, r, g, b, a);
-   ELM_COLOR_CLASS_GET_LOWER();
+   Evas_Object *edje;
+   Eina_Bool int_ret = EINA_TRUE;
+
+   if (!efl_isa(obj, EFL_UI_LAYOUT_CLASS)) return EINA_FALSE;
+
+   edje = elm_layout_edje_get(obj);
+   int_ret &= _elm_widget_color_class_set_internal(obj, edje, color_class,
+                                                   -1, -1, -1, -1,
+                                                   r, g, b, a,
+                                                   -1, -1, -1, -1);
+
+   return int_ret;
 }
-//
 
-void
-_elm_widget_color_class_parent_set(Evas_Object *obj, Evas_Object *parent)
+/* Internal EO API */
+static Eina_Bool
+_elm_widget_class_color2_get(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSED, const char *color_class, int *r, int *g, int *b, int *a)
 {
-   Evas_Object *edje = NULL, *parent_edje = NULL;
+   Evas_Object *edje;
+   Eina_Bool int_ret = EINA_TRUE;
 
-   if (!obj || !parent) return;
+   if (!efl_isa(obj, EFL_UI_LAYOUT_CLASS)) return EINA_FALSE;
 
-   if (efl_isa(obj, EFL_UI_LAYOUT_CLASS))
-     edje =  elm_layout_edje_get(obj);
-   else if (efl_isa(obj, EFL_CANVAS_LAYOUT_CLASS))
-     edje = obj;
+   edje = elm_layout_edje_get(obj);
+   int_ret &= _elm_widget_color_class_get_internal(obj, edje, color_class,
+                                                   NULL, NULL, NULL, NULL,
+                                                   r, g, b, a,
+                                                   NULL, NULL, NULL, NULL);
 
-   if (efl_isa(parent, EFL_UI_LAYOUT_CLASS))
-     parent_edje =  elm_layout_edje_get(parent);
-   else if (efl_isa(parent, EFL_CANVAS_LAYOUT_CLASS))
-     parent_edje = parent;
+   return int_ret;
+}
 
-   if (!edje || !parent_edje) return;
+/* Internal EO API */
+static Eina_Bool
+_elm_widget_class_color3_set(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSED, const char *color_class, int r, int g, int b, int a)
+{
+   Evas_Object *edje;
+   Eina_Bool int_ret = EINA_TRUE;
 
-   edje_object_color_class_parent_set(edje, parent_edje);
+   if (!efl_isa(obj, EFL_UI_LAYOUT_CLASS)) return EINA_FALSE;
+
+   edje = elm_layout_edje_get(obj);
+   int_ret &= _elm_widget_color_class_set_internal(obj, edje, color_class,
+                                                   -1, -1, -1, -1,
+                                                   -1, -1, -1, -1,
+                                                   r, g, b, a);
+
+   return int_ret;
 }
 
-void
-_elm_widget_color_class_parent_unset(Evas_Object *obj)
+/* Internal EO API */
+static Eina_Bool
+_elm_widget_class_color3_get(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSED, const char *color_class, int *r, int *g, int *b, int *a)
 {
-   Evas_Object *edje = NULL;
+   Evas_Object *edje;
+   Eina_Bool int_ret = EINA_TRUE;
 
-   if (!obj) return;
+   if (!efl_isa(obj, EFL_UI_LAYOUT_CLASS)) return EINA_FALSE;
 
-   if (efl_isa(obj, EFL_UI_LAYOUT_CLASS))
-     edje =  elm_layout_edje_get(obj);
-   else if (efl_isa(obj, EFL_CANVAS_LAYOUT_CLASS))
-     edje = obj;
+   edje = elm_layout_edje_get(obj);
+   int_ret &= _elm_widget_color_class_get_internal(obj, edje, color_class,
+                                                   NULL, NULL, NULL, NULL,
+                                                   NULL, NULL, NULL, NULL,
+                                                   r, g, b, a);
+
+   return int_ret;
+}
+
+/* Internal EO API */
+static void
+_elm_widget_class_color_del(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd, const char *color_class)
+{
+   Eina_Stringshare *buf;
+
+   if (!efl_isa(obj, EFL_UI_LAYOUT_CLASS)) return;
+
+   buf = _elm_widget_edje_class_get(efl_class_get(obj), NULL, color_class);
+   edje_object_color_class_del(sd->resize_obj, buf);
+   eina_stringshare_del(buf);
+}
+
+/* Internal EO API */
+static void
+_elm_widget_class_color_clear(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd)
+{
+   if (!efl_isa(obj, EFL_UI_LAYOUT_CLASS)) return;
+   edje_object_color_class_clear(sd->resize_obj);
+}
+
+#define ELM_COLOR_CLASS_UPDATE(obj, hash, cond)                                  \
+   Evas_Object *edje = NULL;                                                     \
+   Eina_Iterator *itr;                                                           \
+   Edje_Color_Class *cc;                                                         \
+   Eina_Bool int_ret = EINA_TRUE;                                                \
+   if (cond) return EINA_FALSE;                                                  \
+   if (efl_isa(obj, EFL_UI_LAYOUT_CLASS))                                            \
+     edje =  elm_layout_edje_get(obj);                                           \
+   else if (efl_isa(obj, EFL_CANVAS_LAYOUT_CLASS))                                      \
+     edje = obj;                                                                 \
+   if (!edje) return EINA_FALSE;                                                 \
+   itr = eina_hash_iterator_data_new(hash);                                      \
+   EINA_ITERATOR_FOREACH(itr, cc)                                                \
+     {                                                                           \
+        int_ret &= edje_object_color_class_set(edje, cc->name,                   \
+                                               cc->r, cc->g, cc->b, cc->a,       \
+                                               cc->r2, cc->g2, cc->b2, cc->a2,   \
+                                               cc->r3, cc->g3, cc->b3, cc->a3);  \
+     }                                                                           \
+   eina_iterator_free(itr);                                                      \
+   return int_ret
+
+
+#define CHECK_BOUND(x)                                                           \
+   if (x > 0xff) x = 0xff;                                                       \
+   else if (x < 0) x = 0
+
+#define ELM_COLOR_CLASS_SET_START(obj, cr, cg, cb, ca)                           \
+   Eina_Bool int_ret = EINA_FALSE;                                               \
+   Edje_Color_Class *cc = NULL;                                                  \
+   Eina_Stringshare *buf;                                                        \
+   buf = _elm_widget_edje_class_get(efl_class_get(obj), NULL, color_class);       \
+   CHECK_BOUND(r);                                                               \
+   CHECK_BOUND(g);                                                               \
+   CHECK_BOUND(b);                                                               \
+   CHECK_BOUND(a);                                                               \
+   _elm_color_unpremul(a, &r, &g, &b);                                           \
+   if (!sd->color_classes)                                                       \
+     sd->color_classes = eina_hash_string_small_new(_edje_color_class_free);     \
+   else                                                                          \
+     cc = eina_hash_find(sd->color_classes, buf);                                \
+   if (!cc)                                                                      \
+     {                                                                           \
+        cc = calloc(1, sizeof(Edje_Color_Class));                                \
+        cc->name = eina_stringshare_add(buf);                                    \
+        if (!cc->name)                                                           \
+          {                                                                      \
+             free(cc);                                                           \
+             eina_stringshare_del(buf);                                          \
+             return EINA_FALSE;                                                  \
+          }                                                                      \
+        eina_hash_direct_add(sd->color_classes, cc->name, cc);                   \
+     }                                                                           \
+   else if ((cc->cr == r) && (cc->cg == g) &&                                    \
+            (cc->cb == b) && (cc->ca == a))                                      \
+     {                                                                           \
+        eina_stringshare_del(buf);                                               \
+        return EINA_TRUE;                                                        \
+     }                                                                           \
+   cc->cr = r;                                                                   \
+   cc->cg = g;                                                                   \
+   cc->cb = b;                                                                   \
+   cc->ca = a;                                                                   \
+   int_ret = EINA_TRUE
+
+#define ELM_COLOR_CLASS_SET_END()                                                \
+   eina_stringshare_del(buf);                                                    \
+   return int_ret
+
+#define ELM_COLOR_CLASS_GET(obj, cr, cg, cb, ca)                                 \
+   Eina_Bool int_ret = EINA_FALSE;                                               \
+   Edje_Color_Class *cc;                                                         \
+   Eina_Stringshare *buf;                                                        \
+   int alpha = 0;                                                                \
+   buf = _elm_widget_edje_class_get(efl_class_get(obj), NULL, color_class);       \
+   if ((!sd->color_classes) || !(cc = eina_hash_find(sd->color_classes, buf)))   \
+     {                                                                           \
+        if (r) *r = 0;                                                           \
+        if (g) *g = 0;                                                           \
+        if (b) *b = 0;                                                           \
+        if (a) *a = 0;                                                           \
+        int_ret = EINA_FALSE;                                                    \
+     }                                                                           \
+   else                                                                          \
+     {                                                                           \
+        if (r) *r = cc->cr;                                                      \
+        if (g) *g = cc->cg;                                                      \
+        if (b) *b = cc->cb;                                                      \
+        if (a) *a = cc->ca;                                                      \
+        alpha = cc->ca;                                                          \
+        int_ret = EINA_TRUE;                                                     \
+     }                                                                           \
+   _elm_color_premul(alpha, r, g, b);                                            \
+   eina_stringshare_del(buf);                                                    \
+   return int_ret
+
+Eina_Bool
+_elm_widget_item_color_class_update(Elm_Widget_Item_Data *sd)
+{
+   ELM_COLOR_CLASS_UPDATE(sd->view, sd->color_classes, (!sd) || (!sd->color_classes) || (!sd->view));
+}
+
+/* Internal EO API */
+static Eina_Bool
+_elm_widget_item_class_color_set(Eo *obj, Elm_Widget_Item_Data *sd, const char *color_class, int r, int g, int b, int a)
+{
+   ELM_COLOR_CLASS_SET_START(obj, r, g, b, a);
+
+   int_ret &= _elm_widget_item_color_class_update(sd);
+
+   ELM_COLOR_CLASS_SET_END();
+}
+
+/* Internal EO API */
+static Eina_Bool
+_elm_widget_item_class_color_get(Eo *obj, Elm_Widget_Item_Data *sd, const char *color_class, int *r, int *g, int *b, int *a)
+{
+   ELM_COLOR_CLASS_GET(obj, r, g, b, a);
+}
+
+/* Internal EO API */
+static Eina_Bool
+_elm_widget_item_class_color2_set(Eo *obj, Elm_Widget_Item_Data *sd, const char *color_class, int r, int g, int b, int a)
+{
+   ELM_COLOR_CLASS_SET_START(obj, r2, g2, b2, a2);
+
+   int_ret &= _elm_widget_item_color_class_update(sd);
+
+   ELM_COLOR_CLASS_SET_END();
+}
+
+/* Internal EO API */
+static Eina_Bool
+_elm_widget_item_class_color2_get(Eo *obj, Elm_Widget_Item_Data *sd, const char *color_class, int *r, int *g, int *b, int *a)
+{
+   ELM_COLOR_CLASS_GET(obj, r2, g2, b2, a2);
+}
+
+/* Internal EO API */
+static Eina_Bool
+_elm_widget_item_class_color3_set(Eo *obj, Elm_Widget_Item_Data *sd, const char *color_class, int r, int g, int b, int a)
+{
+   ELM_COLOR_CLASS_SET_START(obj, r3, g3, b3, a3);
+
+   int_ret &= _elm_widget_item_color_class_update(sd);
+
+   ELM_COLOR_CLASS_SET_END();
+}
+
+/* Internal EO API */
+static Eina_Bool
+_elm_widget_item_class_color3_get(Eo *obj, Elm_Widget_Item_Data *sd, const char *color_class, int *r, int *g, int *b, int *a)
+{
+   ELM_COLOR_CLASS_GET(obj, r3, g3, b3, a3);
+}
+
+/* Internal EO API */
+static Evas_Object *
+_elm_widget_item_edje_get(Eo *obj, Elm_Widget_Item_Data *sd)
+{
+   if (!sd)
+     sd = efl_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS);
+
+   if (efl_isa(sd->view, EFL_UI_LAYOUT_CLASS))
+     return elm_layout_edje_get(sd->view);
+   else if (efl_isa(sd->view, EFL_CANVAS_LAYOUT_CLASS))
+     return sd->view;
 
+   return NULL;
+}
+
+/* Internal EO API */
+static void
+_elm_widget_item_class_color_del(Eo *obj EINA_UNUSED, Elm_Widget_Item_Data *sd, const char *color_class)
+{
+   Eina_Stringshare *buf;
+   Evas_Object *edje;
+   Edje_Color_Class *cc = NULL;
+
+   if (!color_class) return;
+
+   buf = _elm_widget_edje_class_get(efl_class_get(obj), NULL, color_class);
+   eina_hash_del(sd->color_classes, buf, cc);
+
+   edje = _elm_widget_item_edje_get(obj, sd);
+   if (edje)
+     edje_object_color_class_del(edje, buf);
+
+   eina_stringshare_del(buf);
+}
+
+/* Internal EO API */
+static void
+_elm_widget_item_class_color_clear(Eo *obj EINA_UNUSED, Elm_Widget_Item_Data *sd)
+{
+   Evas_Object *edje;
+   ELM_SAFE_FREE(sd->color_classes, eina_hash_free);
+
+   edje = _elm_widget_item_edje_get(obj, sd);
    if (!edje) return;
 
-   edje_object_color_class_parent_unset(edje);
+   edje_object_color_class_clear(edje);
 }
+
+/* Internal EO APIs and hidden overrides */
+EAPI EFL_FUNC_BODYV(elm_widget_class_color_set, Eina_Bool, EINA_FALSE,
+                    EFL_FUNC_CALL(color_class, r, g, b, a),
+                    const char *color_class, int r, int g, int b, int a)
+EAPI EFL_FUNC_BODYV(elm_widget_class_color_get, Eina_Bool, EINA_FALSE,
+                    EFL_FUNC_CALL(color_class, r, g, b, a),
+                    const char *color_class, int *r, int *g, int *b, int *a)
+EAPI EFL_FUNC_BODYV(elm_widget_class_color2_set, Eina_Bool, EINA_FALSE,
+                    EFL_FUNC_CALL(color_class, r, g, b, a),
+                    const char *color_class, int r, int g, int b, int a)
+EAPI EFL_FUNC_BODYV(elm_widget_class_color2_get, Eina_Bool, EINA_FALSE,
+                    EFL_FUNC_CALL(color_class, r, g, b, a),
+                    const char *color_class, int *r, int *g, int *b, int *a)
+EAPI EFL_FUNC_BODYV(elm_widget_class_color3_set, Eina_Bool, EINA_FALSE,
+                    EFL_FUNC_CALL(color_class, r, g, b, a),
+                    const char *color_class, int r, int g, int b, int a)
+EAPI EFL_FUNC_BODYV(elm_widget_class_color3_get, Eina_Bool, EINA_FALSE,
+                    EFL_FUNC_CALL(color_class, r, g, b, a),
+                    const char *color_class, int *r, int *g, int *b, int *a)
+EAPI EFL_VOID_FUNC_BODYV(elm_widget_class_color_del,
+                         EFL_FUNC_CALL(color_class),
+                         const char *color_class)
+EAPI EFL_VOID_FUNC_BODY(elm_widget_class_color_clear)
+
+#define EFL_UI_WIDGET_EXTRA_OPS \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color_set, _elm_widget_class_color_set), \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color_get, _elm_widget_class_color_get), \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color2_set, _elm_widget_class_color2_set), \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color2_get, _elm_widget_class_color2_get), \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color3_set, _elm_widget_class_color3_set), \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color3_get, _elm_widget_class_color3_get), \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color_del, _elm_widget_class_color_del), \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color_clear, _elm_widget_class_color_clear)
+
+/* Internal EO APIs and hidden overrides */
+EAPI EFL_FUNC_BODYV(elm_widget_item_class_color_set, Eina_Bool, EINA_FALSE,
+                    EFL_FUNC_CALL(color_class, r, g, b, a),
+                    const char *color_class, int r, int g, int b, int a)
+EAPI EFL_FUNC_BODYV(elm_widget_item_class_color_get, Eina_Bool, EINA_FALSE,
+                    EFL_FUNC_CALL(color_class, r, g, b, a),
+                    const char *color_class, int *r, int *g, int *b, int *a)
+EAPI EFL_FUNC_BODYV(elm_widget_item_class_color2_set, Eina_Bool, EINA_FALSE,
+                    EFL_FUNC_CALL(color_class, r, g, b, a),
+                    const char *color_class, int r, int g, int b, int a)
+EAPI EFL_FUNC_BODYV(elm_widget_item_class_color2_get, Eina_Bool, EINA_FALSE,
+                    EFL_FUNC_CALL(color_class, r, g, b, a),
+                    const char *color_class, int *r, int *g, int *b, int *a)
+EAPI EFL_FUNC_BODYV(elm_widget_item_class_color3_set, Eina_Bool, EINA_FALSE,
+                    EFL_FUNC_CALL(color_class, r, g, b, a),
+                    const char *color_class, int r, int g, int b, int a)
+EAPI EFL_FUNC_BODYV(elm_widget_item_class_color3_get, Eina_Bool, EINA_FALSE,
+                    EFL_FUNC_CALL(color_class, r, g, b, a),
+                    const char *color_class, int *r, int *g, int *b, int *a)
+EAPI EFL_VOID_FUNC_BODYV(elm_widget_item_class_color_del,
+                         EFL_FUNC_CALL(color_class),
+                         const char *color_class)
+EAPI EFL_VOID_FUNC_BODY(elm_widget_item_class_color_clear)
+
+#define ELM_WIDGET_ITEM_EXTRA_OPS \
+   EFL_OBJECT_OP_FUNC(elm_widget_item_class_color_set, _elm_widget_item_class_color_set), \
+   EFL_OBJECT_OP_FUNC(elm_widget_item_class_color_get, _elm_widget_item_class_color_get), \
+   EFL_OBJECT_OP_FUNC(elm_widget_item_class_color2_set, _elm_widget_item_class_color2_set), \
+   EFL_OBJECT_OP_FUNC(elm_widget_item_class_color2_get, _elm_widget_item_class_color2_get), \
+   EFL_OBJECT_OP_FUNC(elm_widget_item_class_color3_set, _elm_widget_item_class_color3_set), \
+   EFL_OBJECT_OP_FUNC(elm_widget_item_class_color3_get, _elm_widget_item_class_color3_get), \
+   EFL_OBJECT_OP_FUNC(elm_widget_item_class_color_del, _elm_widget_item_class_color_del), \
+   EFL_OBJECT_OP_FUNC(elm_widget_item_class_color_clear, _elm_widget_item_class_color_clear)
+
 /*******
  * END *
  *******/
index 90e591a..2e66331 100644 (file)
@@ -599,59 +599,6 @@ abstract Efl.Ui.Widget (Efl.Canvas.Group, Efl.Access,
          }
          return: Efl.Ui.Focus.Manager; [[The focus manager.]]
       }
-      //TIZEN_ONLY(20160926): add customization interface
-      @property color_class_color {
-         set {
-            return: bool;
-         }
-         get {
-            return: bool;
-         }
-         keys {
-            color_class: string;
-         }
-         values {
-            r: int;
-            g: int;
-            b: int;
-            a: int;
-         }
-      }
-      @property color_class_color2 {
-         set {
-            return: bool;
-         }
-         get {
-            return: bool;
-         }
-         keys {
-            color_class: string;
-         }
-         values {
-            r: int;
-            g: int;
-            b: int;
-            a: int;
-         }
-      }
-      @property color_class_color3 {
-         set {
-            return: bool;
-         }
-         get {
-            return: bool;
-         }
-         keys {
-            color_class: string;
-         }
-         values {
-            r: int;
-            g: int;
-            b: int;
-            a: int;
-         }
-      }
-      //
    }
    parts {
       shadow: Efl.Ui.Widget.Part_Shadow;
index ce53311..43a0662 100644 (file)
@@ -6602,6 +6602,119 @@ _elm_entry_efl_access_component_accessible_at_point_get(Eo *obj,  Elm_Entry_Data
 }
 /////////////////////////////////////////////////////////////////
 
+/***********************************************************************************
+ * TIZEN_ONLY_FEATURE: apply Tizen's color_class features.                         *
+ ***********************************************************************************/
+/**
+ * The resize object of elm_entry could be switch entry_edje into scr_edje
+ * when only elm_entry is scrollable.
+ * So, we need to update color_class only for entry_edje.
+ **/
+/* Internal EO API override */
+static Eina_Bool
+_elm_entry_elm_widget_class_color_set(Eo *obj, Elm_Entry_Data *sd, const char *color_class, int r, int g, int b, int a)
+{
+   Eina_Bool int_ret = EINA_TRUE;
+
+   int_ret &= _elm_widget_color_class_set_internal(obj, sd->entry_edje, color_class,
+                                                   r, g, b, a,
+                                                   -1, -1, -1, -1,
+                                                   -1, -1, -1, -1);
+
+   return int_ret;
+}
+
+/* Internal EO API override */
+static Eina_Bool
+_elm_entry_elm_widget_class_color_get(Eo *obj, Elm_Entry_Data *sd, const char *color_class, int *r, int *g, int *b, int *a)
+{
+   Eina_Bool int_ret = EINA_TRUE;
+
+   int_ret &= _elm_widget_color_class_get_internal(obj, sd->entry_edje, color_class,
+                                                   r, g, b, a,
+                                                   NULL, NULL, NULL, NULL,
+                                                   NULL, NULL, NULL, NULL);
+
+   return int_ret;
+}
+
+/* Internal EO API override */
+static Eina_Bool
+_elm_entry_elm_widget_class_color2_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char *color_class, int r, int g, int b, int a)
+{
+   Eina_Bool int_ret = EINA_TRUE;
+
+   int_ret &= _elm_widget_color_class_set_internal(obj, sd->entry_edje, color_class,
+                                                   -1, -1, -1, -1,
+                                                   r, g, b, a,
+                                                   -1, -1, -1, -1);
+
+   return int_ret;
+}
+
+/* Internal EO API override */
+static Eina_Bool
+_elm_entry_elm_widget_class_color2_get(Eo *obj, Elm_Entry_Data *sd, const char *color_class, int *r, int *g, int *b, int *a)
+{
+   Eina_Bool int_ret = EINA_TRUE;
+
+   int_ret &= _elm_widget_color_class_get_internal(obj, sd->entry_edje, color_class,
+                                                   NULL, NULL, NULL, NULL,
+                                                   r, g, b, a,
+                                                   NULL, NULL, NULL, NULL);
+
+   return int_ret;
+}
+
+/* Internal EO API override */
+static Eina_Bool
+_elm_entry_elm_widget_class_color3_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char *color_class, int r, int g, int b, int a)
+{
+   Eina_Bool int_ret = EINA_TRUE;
+
+   int_ret &= _elm_widget_color_class_set_internal(obj, sd->entry_edje, color_class,
+                                                   -1, -1, -1, -1,
+                                                   -1, -1, -1, -1,
+                                                   r, g, b, a);
+
+   return int_ret;
+}
+
+/* Internal EO API override */
+static Eina_Bool
+_elm_entry_elm_widget_class_color3_get(Eo *obj, Elm_Entry_Data *sd, const char *color_class, int *r, int *g, int *b, int *a)
+{
+   Eina_Bool int_ret = EINA_TRUE;
+
+   int_ret &= _elm_widget_color_class_get_internal(obj, sd->entry_edje, color_class,
+                                                   NULL, NULL, NULL, NULL,
+                                                   NULL, NULL, NULL, NULL,
+                                                   r, g, b, a);
+
+   return int_ret;
+}
+
+/* Internal EO API override */
+static void
+_elm_entry_elm_widget_class_color_del(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char *color_class)
+{
+   Eina_Stringshare *buf;
+
+   buf = _elm_widget_edje_class_get(efl_class_get(obj), NULL, color_class);
+   edje_object_color_class_del(sd->entry_edje, buf);
+   eina_stringshare_del(buf);
+}
+
+/* Internal EO API override */
+static void
+_elm_entry_elm_widget_class_color_clear(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
+{
+   edje_object_color_class_clear(sd->entry_edje);
+}
+/*******
+ * END *
+ *******/
+
 /* Efl.Part begin */
 
 ELM_PART_OVERRIDE(elm_entry, ELM_ENTRY, Elm_Entry_Data)
@@ -6624,6 +6737,20 @@ ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX)
    EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_entry), \
    ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \
    ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \
-   ELM_LAYOUT_SIZING_EVAL_OPS(elm_entry)
+   ELM_LAYOUT_SIZING_EVAL_OPS(elm_entry), \
+   /*********************************************************************************** \
+    * TIZEN_ONLY_FEATURE: apply Tizen's color_class features.                         * \
+    ***********************************************************************************/\
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color_set, _elm_entry_elm_widget_class_color_set), \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color_get, _elm_entry_elm_widget_class_color_get), \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color2_set, _elm_entry_elm_widget_class_color2_set), \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color2_get, _elm_entry_elm_widget_class_color2_get), \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color3_set, _elm_entry_elm_widget_class_color3_set), \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color3_get, _elm_entry_elm_widget_class_color3_get), \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color_del, _elm_entry_elm_widget_class_color_del), \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color_clear, _elm_entry_elm_widget_class_color_clear)
+   /*******
+    * END *
+    *******/
 
 #include "elm_entry.eo.c"
index cf21d78..a466756 100644 (file)
@@ -1535,6 +1535,15 @@ _item_unrealize_cb(Elm_Gen_Item *it)
         EINA_LIST_FREE(cache, c)
           evas_object_del(c);
      }
+
+   /***********************************************************************************
+    * TIZEN_ONLY_FEATURE: apply Tizen's color_class features.                         *
+    ***********************************************************************************/
+   if (it->base->color_classes)
+     edje_object_color_class_clear(VIEW(it));
+   /*******
+    * END *
+    *******/
 }
 
 static char *
@@ -1650,6 +1659,15 @@ _item_realize(Elm_Gen_Item *it)
           it->item->nocache_once = EINA_FALSE;
      }
 
+   /***********************************************************************************
+    * TIZEN_ONLY_FEATURE: apply Tizen's color_class features.                         *
+    ***********************************************************************************/
+   if (it->base->color_classes)
+     _elm_widget_item_color_class_update(it->base);
+   /*******
+    * END *
+    *******/
+
    if (it->spacer && edje_object_part_exists(VIEW(it), "elm.swallow.pad"))
      {
         it->spacer =
index 54d16ea..0e94513 100644 (file)
@@ -2239,7 +2239,10 @@ elm_object_accessibility_highlight_set(void *obj, Eina_Bool visible)
 }
 //
 
-//TIZEN_ONLY(20160926): add customization interface
+
+/***********************************************************************************
+ * TIZEN_ONLY_FEATURE: apply Tizen's color_class features.                         *
+ ***********************************************************************************/
 EAPI Eina_Bool
 elm_color_class_color_set(const char *color_class, int r, int g, int b, int a)
 {
@@ -2258,10 +2261,12 @@ EAPI Eina_Bool
 elm_color_class_color_get(const char *color_class, int *r, int *g, int *b, int *a)
 {
    Eina_Bool int_ret = EINA_FALSE;
+   int alpha = 0;
 
-   int_ret = edje_color_class_get(color_class, r, g, b, a, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+   int_ret = edje_color_class_get(color_class, r, g, b, &alpha, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+   if (a) *a = alpha;
 
-   _elm_color_premul(*a, r, g, b);
+   _elm_color_premul(alpha, r, g, b);
 
    return int_ret;
 }
@@ -2284,10 +2289,12 @@ EAPI Eina_Bool
 elm_color_class_color2_get(const char *color_class, int *r, int *g, int *b, int *a)
 {
    Eina_Bool int_ret = EINA_FALSE;
+   int alpha = 0;
 
-   int_ret = edje_color_class_get(color_class, NULL, NULL, NULL, NULL, r, g, b, a, NULL, NULL, NULL, NULL);
+   int_ret = edje_color_class_get(color_class, NULL, NULL, NULL, NULL, r, g, b, &alpha, NULL, NULL, NULL, NULL);
+   if (a) *a = alpha;
 
-   _elm_color_premul(*a, r, g, b);
+   _elm_color_premul(alpha, r, g, b);
 
    return int_ret;
 }
@@ -2310,48 +2317,69 @@ EAPI Eina_Bool
 elm_color_class_color3_get(const char *color_class, int *r, int *g, int *b, int *a)
 {
    Eina_Bool int_ret = EINA_FALSE;
+   int alpha = 0;
 
-   int_ret = edje_color_class_get(color_class, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, r, g, b, a);
+   int_ret = edje_color_class_get(color_class, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, r, g, b, &alpha);
+   if (a) *a = alpha;
 
-   _elm_color_premul(*a, r, g, b);
+   _elm_color_premul(alpha, r, g, b);
 
    return int_ret;
 }
 
+EAPI void
+elm_color_class_del(const char *color_class)
+{
+   edje_color_class_del(color_class);
+}
+
 EAPI Eina_Bool
 elm_object_color_class_color_set(Evas_Object *obj, const char *color_class, int r, int g, int b, int a)
 {
-   return elm_object_color_class_color_set(obj, color_class, r, g, b, a);
+   return elm_widget_class_color_set(obj, color_class, r, g, b, a);
 }
 
 EAPI Eina_Bool
 elm_object_color_class_color_get(Evas_Object *obj, const char *color_class, int *r, int *g, int *b, int *a)
 {
-   return elm_object_color_class_color_get(obj, color_class, r, g, b, a);
+   return elm_widget_class_color_get(obj, color_class, r, g, b, a);
 }
 
 EAPI Eina_Bool
 elm_object_color_class_color2_set(Evas_Object *obj, const char *color_class, int r, int g, int b, int a)
 {
-   return elm_object_color_class_color2_set(obj, color_class, r, g, b, a);
+   return elm_widget_class_color2_set(obj, color_class, r, g, b, a);
 }
 
 EAPI Eina_Bool
 elm_object_color_class_color2_get(Evas_Object *obj, const char *color_class, int *r, int *g, int *b, int *a)
 {
-   return elm_object_color_class_color2_get(obj, color_class, r, g, b, a);
+   return elm_widget_class_color2_get(obj, color_class, r, g, b, a);
 }
 
 EAPI Eina_Bool
 elm_object_color_class_color3_set(Evas_Object *obj, const char *color_class, int r, int g, int b, int a)
 {
-   return elm_object_color_class_color3_set(obj, color_class, r, g, b, a);
+   return elm_widget_class_color3_set(obj, color_class, r, g, b, a);
 }
 
 EAPI Eina_Bool
 elm_object_color_class_color3_get(Evas_Object *obj, const char *color_class, int *r, int *g, int *b, int *a)
 {
-   return elm_object_color_class_color3_get(obj, color_class, r, g, b, a);
+   return elm_widget_class_color3_get(obj, color_class, r, g, b, a);
 }
-//
 
+EAPI void
+elm_object_color_class_del(Evas_Object *obj, const char *color_class)
+{
+   return elm_widget_class_color_del(obj, color_class);
+}
+
+EAPI void
+elm_object_color_class_clear(Evas_Object *obj)
+{
+   return elm_widget_class_color_clear(obj);
+}
+/*******
+ * END *
+ *******/
index e90c87e..d91f7ec 100644 (file)
@@ -538,7 +538,95 @@ EAPI void        elm_object_orientation_mode_disabled_set(Evas_Object *obj, Eina
  */
 EAPI Eina_Bool   elm_object_orientation_mode_disabled_get(const Evas_Object *obj);
 
-//TIZEN_ONLY(20160926): add customization interface
+// TIZEN_ONLY(20150705): Genlist item align feature
+/**
+ * @brief Sets the scroll item align enable.
+ * @remarks Tizen only feature.
+ *
+ *
+ * @remarks If the object's scroll item align is enabled, the nearest
+ *          item to the end of the scroll will be located according to
+ *          its vertical align.
+ *
+ * @remarks Currently implemented only Genlist.
+ *
+ * @since_tizen 2.3.1
+ *
+ * @param[in] obj The object handle
+ * @param[in] enabled The scroll item align state
+ *
+ * @see elm_object_scroll_item_align_enabled_get()
+ */
+EAPI void elm_object_scroll_item_align_enabled_set(Evas_Object *obj, Eina_Bool scroll_item_align_enable);
+
+/**
+ * @brief Sets the scroll item align enable.
+ * @remarks Tizen only feature.
+ *
+ *
+ * @remarks If @c EINA_TRUE, the nearest item to the end of the scroll will be
+ *          aligned according to its vertical align. If @c EINA_FALSE, the scroll
+ *          item align is disabled.
+ *
+ * @remarks Currently implemented only Genlist.
+ *
+ * @since_tizen 2.3.1
+ *
+ * @param[in] obj The object handle
+ * @return The scroll item align state.
+ *
+ * @see elm_object_scroll_item_align_enabled_set()
+ */
+EAPI Eina_Bool elm_object_scroll_item_align_enabled_get(const Evas_Object *obj);
+
+/**
+ * @internal
+ * @brief Sets the scroll item vertical align.
+ * @remarks Tizen only feature.
+ *
+ *
+ * @remarks This API sets the scroll item vertical align. The scroll item
+ *          vertical align is referred when the object's scroll item align
+ *          is enabled. When the widget is scrolled, the nearest item to the
+ *          end of the scroll will be located according to the given alignment.
+ *
+ * @remarks Currently implemented only Genlist.
+ *
+ * @since_tizen 2.3.1
+ *
+ * @param[in] obj The object handle
+ * @param[in] vertical align The position name.
+ *
+ * @see elm_object_scroll_item_valign_get()
+ */
+EAPI void elm_object_scroll_item_valign_set(Evas_Object *obj, const char *scroll_item_valign);
+
+/**
+ * @internal
+ * @brief Sets the scroll item vertical align.
+ * @remarks Tizen only feature.
+ *
+ *
+ * @remarks This API gets the scroll item vertical align. The scroll item
+ *          vertical align is referred when the object's scroll item align
+ *          is enabled. When the widget is scrolled, the nearest item to the
+ *          end of the scroll will be located according to the given alignment.
+ *
+ * @remarks Currently implemented only Genlist.
+ *
+ * @since_tizen 2.3.1
+ *
+ * @param[in] obj The object handle
+ * @return The scroll item vertical align name.
+ *
+ * @see elm_object_scroll_item_valign_set()
+ */
+EAPI const char* elm_object_scroll_item_valign_get(const Evas_Object *obj);
+//
+
+/***********************************************************************************
+ * TIZEN_ONLY_FEATURE: apply Tizen's color_class features.                         *
+ ***********************************************************************************/
 /**
  * @internal
  *
@@ -790,90 +878,6 @@ EAPI Eina_Bool        elm_object_color_class_color3_set(Evas_Object *obj, const
  * @ingroup General
  */
 EAPI Eina_Bool        elm_object_color_class_color3_get(Evas_Object *obj, const char *color_class, int *r, int *g, int *b, int *a);
-//
-
-// TIZEN_ONLY(20150705): Genlist item align feature
-/**
- * @brief Sets the scroll item align enable.
- * @remarks Tizen only feature.
- *
- *
- * @remarks If the object's scroll item align is enabled, the nearest
- *          item to the end of the scroll will be located according to
- *          its vertical align.
- *
- * @remarks Currently implemented only Genlist.
- *
- * @since_tizen 2.3.1
- *
- * @param[in] obj The object handle
- * @param[in] enabled The scroll item align state
- *
- * @see elm_object_scroll_item_align_enabled_get()
- */
-EAPI void elm_object_scroll_item_align_enabled_set(Evas_Object *obj, Eina_Bool scroll_item_align_enable);
-
-/**
- * @brief Sets the scroll item align enable.
- * @remarks Tizen only feature.
- *
- *
- * @remarks If @c EINA_TRUE, the nearest item to the end of the scroll will be
- *          aligned according to its vertical align. If @c EINA_FALSE, the scroll
- *          item align is disabled.
- *
- * @remarks Currently implemented only Genlist.
- *
- * @since_tizen 2.3.1
- *
- * @param[in] obj The object handle
- * @return The scroll item align state.
- *
- * @see elm_object_scroll_item_align_enabled_set()
- */
-EAPI Eina_Bool elm_object_scroll_item_align_enabled_get(const Evas_Object *obj);
-
-/**
- * @internal
- * @brief Sets the scroll item vertical align.
- * @remarks Tizen only feature.
- *
- *
- * @remarks This API sets the scroll item vertical align. The scroll item
- *          vertical align is referred when the object's scroll item align
- *          is enabled. When the widget is scrolled, the nearest item to the
- *          end of the scroll will be located according to the given alignment.
- *
- * @remarks Currently implemented only Genlist.
- *
- * @since_tizen 2.3.1
- *
- * @param[in] obj The object handle
- * @param[in] vertical align The position name.
- *
- * @see elm_object_scroll_item_valign_get()
- */
-EAPI void elm_object_scroll_item_valign_set(Evas_Object *obj, const char *scroll_item_valign);
-
-/**
- * @internal
- * @brief Sets the scroll item vertical align.
- * @remarks Tizen only feature.
- *
- *
- * @remarks This API gets the scroll item vertical align. The scroll item
- *          vertical align is referred when the object's scroll item align
- *          is enabled. When the widget is scrolled, the nearest item to the
- *          end of the scroll will be located according to the given alignment.
- *
- * @remarks Currently implemented only Genlist.
- *
- * @since_tizen 2.3.1
- *
- * @param[in] obj The object handle
- * @return The scroll item vertical align name.
- *
- * @see elm_object_scroll_item_valign_set()
- */
-EAPI const char* elm_object_scroll_item_valign_get(const Evas_Object *obj);
-//
+/*******
+ * END *
+ *******/
index 8b90989..244d5d5 100644 (file)
@@ -807,44 +807,6 @@ void   _elm_entry_entry_paste(Evas_Object *obj, const char *entry);
 
 double _elm_atof(const char *s);
 
-//TIZEN_ONLY(20160926): add customization interface
-#define _DIV_0xFF(x) ((x+1+((x+1)>>8))>>8)
-static inline void _elm_color_premul(int a, int *r, int *g, int *b)
-{
-   if (a == 0xff)
-     {
-        return;
-     }
-   else if (a == 0)
-     {
-        if (r) *r = 0;
-        if (g) *g = 0;
-        if (b) *b = 0;
-     }
-   else
-     {
-        if (r) *r = _DIV_0xFF((*r) * a);
-        if (g) *g = _DIV_0xFF((*g) * a);
-        if (b) *b = _DIV_0xFF((*b) * a);
-     }
-}
-
-static inline void _elm_color_unpremul(int a, int *r, int *g, int *b)
-{
-   if ((a == 0xff) || (a == 0))
-     {
-        return;
-     }
-   else
-     {
-        if (r) *r = (*r) * 255 / a;
-        if (g) *g = (*g) * 255 / a;
-        if (b) *b = (*b) * 255 / a;
-     }
-}
-#undef _DIV_0xFF
-//
-
 // elm_layout and elm_entry LEGACY signal API (returned the user data pointer)
 void _elm_layout_signal_callback_add_legacy(Eo *obj, Eo *edje, Eina_List **p_edje_signals, const char *emission, const char *source, Edje_Signal_Cb func, void *data);
 void *_elm_layout_signal_callback_del_legacy(Eo *obj, Eo *edje, Eina_List **p_edje_signals, const char *emission, const char *source, Edje_Signal_Cb func);
@@ -923,8 +885,64 @@ char tizen_util_probe_profile_wearable();
 /***********************************************************************************
  * TIZEN_ONLY_FEATURE: apply Tizen's color_class features.                         *
  ***********************************************************************************/
+
+#define _DIV_0xFF(x) ((x+1+((x+1)>>8))>>8)
+static inline void _elm_color_premul(int a, int *r, int *g, int *b)
+{
+   if (a == 0xff)
+     {
+        return;
+     }
+   else if (a == 0)
+     {
+        if (r) *r = 0;
+        if (g) *g = 0;
+        if (b) *b = 0;
+     }
+   else
+     {
+        if (r) *r = _DIV_0xFF((*r) * a);
+        if (g) *g = _DIV_0xFF((*g) * a);
+        if (b) *b = _DIV_0xFF((*b) * a);
+     }
+}
+
+static inline void _elm_color_unpremul(int a, int *r, int *g, int *b)
+{
+   if ((a == 0xff) || (a == 0))
+     {
+        return;
+     }
+   else
+     {
+        if (r) *r = (*r) * 255 / a;
+        if (g) *g = (*g) * 255 / a;
+        if (b) *b = (*b) * 255 / a;
+     }
+}
+#undef _DIV_0xFF
+
+Eina_Stringshare *_elm_widget_edje_class_get(const Efl_Class *klass, const char *style, const char *part);
+Eina_Bool _elm_widget_item_color_class_update(Elm_Widget_Item_Data *sd);
+Eina_Bool _elm_widget_color_class_set_internal(Evas_Object *obj, Evas_Object *edje, const char *color_class,
+                                               int r, int g, int b, int a,
+                                               int r2, int g2, int b2, int a2,
+                                               int r3, int g3, int b3, int a3);
+Eina_Bool _elm_widget_color_class_get_internal(Evas_Object *obj, Evas_Object *edje, const char *color_class,
+                                               int *r, int *g, int *b, int *a,
+                                               int *r2, int *g2, int *b2, int *a2,
+                                               int *r3, int *g3, int *b3, int *a3);
 void _elm_widget_color_class_parent_set(Evas_Object *obj, Evas_Object *parent);
 void _elm_widget_color_class_parent_unset(Evas_Object *obj);
+
+EAPI Eina_Bool elm_widget_class_color_set(Evas_Object *obj, const char *color_class, int r, int g, int b, int a);
+EAPI Eina_Bool elm_widget_class_color_get(Evas_Object *obj, const char *color_class, int *r, int *g, int *b, int *a);
+EAPI Eina_Bool elm_widget_class_color2_set(Evas_Object *obj, const char *color_class, int r, int g, int b, int a);
+EAPI Eina_Bool elm_widget_class_color2_get(Evas_Object *obj, const char *color_class, int *r, int *g, int *b, int *a);
+EAPI Eina_Bool elm_widget_class_color3_set(Evas_Object *obj, const char *color_class, int r, int g, int b, int a);
+EAPI Eina_Bool elm_widget_class_color3_get(Evas_Object *obj, const char *color_class, int *r, int *g, int *b, int *a);
+EAPI void elm_widget_class_color_del(Evas_Object *obj, const char *color_class);
+EAPI void elm_widget_class_color_clear(Evas_Object *obj);
 /*******
  * END *
  *******/
index ba74197..1f15d4f 100644 (file)
@@ -4357,6 +4357,128 @@ _elm_toolbar_efl_ui_focus_composition_prepare(Eo *obj, Elm_Toolbar_Data *pd)
    efl_ui_focus_composition_elements_set(obj, order);
 }
 
+/***********************************************************************************
+ * TIZEN_ONLY_FEATURE: apply Tizen's color_class features.                         *
+ ***********************************************************************************/
+/** 
+ * elm_widget_class_color_set is applicable only to LAYOUT class.
+ * Since elm_toolbar does not inherit elm_layout,
+ * this needs to be implemented.
+ **/
+/* Internal EO API Override */
+static Eina_Bool
+_elm_toolbar_elm_widget_class_color_set(Eo *obj, Elm_Toolbar_Data *sd EINA_UNUSED, const char *color_class, int r, int g, int b, int a)
+{
+   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
+   Eina_Bool int_ret = EINA_TRUE;
+
+   int_ret &= _elm_widget_color_class_set_internal(obj, wd->resize_obj, color_class,
+                                                   r, g, b, a,
+                                                   -1, -1, -1, -1,
+                                                   -1, -1, -1, -1);
+
+   return int_ret;
+}
+
+/* Internal EO API Override */
+static Eina_Bool
+_elm_toolbar_elm_widget_class_color_get(Eo *obj, Elm_Toolbar_Data *sd EINA_UNUSED, const char *color_class, int *r, int *g, int *b, int *a)
+{
+   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
+   Eina_Bool int_ret = EINA_TRUE;
+
+   int_ret &= _elm_widget_color_class_get_internal(obj, wd->resize_obj, color_class,
+                                                   r, g, b, a,
+                                                   NULL, NULL, NULL, NULL,
+                                                   NULL, NULL, NULL, NULL);
+
+   return int_ret;
+}
+
+/* Internal EO API Override */
+static Eina_Bool
+_elm_toolbar_elm_widget_class_color2_set(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd EINA_UNUSED, const char *color_class, int r, int g, int b, int a)
+{
+   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
+   Eina_Bool int_ret = EINA_TRUE;
+
+   int_ret &= _elm_widget_color_class_set_internal(obj, wd->resize_obj, color_class,
+                                                   -1, -1, -1, -1,
+                                                   r, g, b, a,
+                                                   -1, -1, -1, -1);
+
+   return int_ret;
+}
+
+/* Internal EO API Override */
+static Eina_Bool
+_elm_toolbar_elm_widget_class_color2_get(Eo *obj, Elm_Toolbar_Data *sd EINA_UNUSED, const char *color_class, int *r, int *g, int *b, int *a)
+{
+   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
+   Eina_Bool int_ret = EINA_TRUE;
+
+   int_ret &= _elm_widget_color_class_get_internal(obj, wd->resize_obj, color_class,
+                                                   NULL, NULL, NULL, NULL,
+                                                   r, g, b, a,
+                                                   NULL, NULL, NULL, NULL);
+
+   return int_ret;
+}
+
+/* Internal EO API Override */
+static Eina_Bool
+_elm_toolbar_elm_widget_class_color3_set(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd EINA_UNUSED, const char *color_class, int r, int g, int b, int a)
+{
+   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
+   Eina_Bool int_ret = EINA_TRUE;
+
+   int_ret &= _elm_widget_color_class_set_internal(obj, wd->resize_obj, color_class,
+                                                   -1, -1, -1, -1,
+                                                   -1, -1, -1, -1,
+                                                   r, g, b, a);
+
+   return int_ret;
+}
+
+/* Internal EO API Override */
+static Eina_Bool
+_elm_toolbar_elm_widget_class_color3_get(Eo *obj, Elm_Toolbar_Data *sd EINA_UNUSED, const char *color_class, int *r, int *g, int *b, int *a)
+{
+   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
+   Eina_Bool int_ret = EINA_TRUE;
+
+   int_ret &= _elm_widget_color_class_get_internal(obj, wd->resize_obj, color_class,
+                                                   NULL, NULL, NULL, NULL,
+                                                   NULL, NULL, NULL, NULL,
+                                                   r, g, b, a);
+
+   return int_ret;
+}
+
+/* Internal EO API override */
+static void
+_elm_toolbar_elm_widget_class_color_del(Eo *obj, Elm_Toolbar_Data *sd EINA_UNUSED, const char *color_class)
+{
+   Eina_Stringshare *buf;
+
+   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
+
+   buf = _elm_widget_edje_class_get(efl_class_get(obj), NULL, color_class);
+   edje_object_color_class_del(wd->resize_obj, buf);
+   eina_stringshare_del(buf);
+}
+
+/* Internal EO API override */
+static void
+_elm_toolbar_elm_widget_class_color_clear(Eo *obj, Elm_Toolbar_Data *sd EINA_UNUSED)
+{
+   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
+
+   edje_object_color_class_clear(wd->resize_obj);
+}
+/*******
+ * END *
+ *******/
 
 /* Standard widget overrides */
 
@@ -4365,7 +4487,21 @@ ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(elm_toolbar, Elm_Toolbar_Data)
 /* Internal EO APIs and hidden overrides */
 
 #define ELM_TOOLBAR_EXTRA_OPS \
-   EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_toolbar)
+   EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_toolbar), \
+   /*********************************************************************************** \
+    * TIZEN_ONLY_FEATURE: apply Tizen's color_class features.                         * \
+    ***********************************************************************************/\
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color_set, _elm_toolbar_elm_widget_class_color_set), \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color_get, _elm_toolbar_elm_widget_class_color_get), \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color2_set, _elm_toolbar_elm_widget_class_color2_set), \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color2_get, _elm_toolbar_elm_widget_class_color2_get), \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color3_set, _elm_toolbar_elm_widget_class_color3_set), \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color3_get, _elm_toolbar_elm_widget_class_color3_get), \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color_del, _elm_toolbar_elm_widget_class_color_del), \
+   EFL_OBJECT_OP_FUNC(elm_widget_class_color_clear, _elm_toolbar_elm_widget_class_color_clear)
+   /*******
+    * END *
+    *******/
 
 #include "elm_toolbar.eo.c"
 #include "elm_toolbar_item.eo.c"
index 4e2c222..b18b1ec 100644 (file)
@@ -681,6 +681,13 @@ struct _Elm_Widget_Item_Data
    //TIZEN_ONLY(20150709) add relations atpi
    Elm_Atspi_Relation_Set        atspi_custom_relations; /**< Developer-defined accessiblity relations */
    ///////////////////////////////////
+   /***********************************************************************************
+    * TIZEN_ONLY_FEATURE: apply Tizen's color_class features.                         *
+    ***********************************************************************************/
+   Eina_Hash                     *color_classes;
+   /*******
+    * END *
+    *******/
 
    Eina_Bool                      disabled : 1;
    Eina_Bool                      on_deletion : 1;
@@ -905,6 +912,14 @@ _elm_widget_sub_object_redirect_to_top(Evas_Object *obj, Evas_Object *sobj)
    return ret;
 }
 
+/***********************************************************************************
+ * TIZEN_ONLY_FEATURE: apply Tizen's color_class features.                         *
+ ***********************************************************************************/
+Eina_Bool _elm_widget_item_color_class_update(Elm_Widget_Item_Data *sd);
+/*******
+ * END *
+ *******/
+
 /* Internal hack to mark legacy objects as such before construction.
  * No need for TLS: Only UI objects created in the main loop matter. */
 EAPI extern Eina_Bool _elm_legacy_add;
@@ -944,7 +959,6 @@ EAPI Eina_Bool _elm_layout_part_aliasing_eval(const Evas_Object *obj,
 const char *efl_ui_widget_default_content_part_get(const Eo *obj);
 const char *efl_ui_widget_default_text_part_get(const Eo *obj);
 
-
 #define ELM_WIDGET_ITEM_PROTECTED
 #include "elm_widget_item.eo.h"