color_class: add del/clear APIs 46/102446/2
authorJee-Yong Um <jc9.um@samsung.com>
Tue, 6 Dec 2016 01:20:22 +0000 (10:20 +0900)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Mon, 12 Dec 2016 01:14:07 +0000 (17:14 -0800)
Signed-Off-By: Jee-Yong Um <jc9.um@samsung.com>
Change-Id: I525d176502ccde898541f7f4b811b5e715efc704

src/lib/elm_main.c
src/lib/elm_object.h
src/lib/elm_widget.c
src/lib/elm_widget.eo
src/lib/elm_widget_item.eo

index 74cc5e8..d1a9cb6 100644 (file)
@@ -2000,6 +2000,12 @@ elm_color_class_color3_get(const char *color_class, int *r, int *g, int *b, int
    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)
 {
@@ -2047,4 +2053,16 @@ elm_object_color_class_color3_get(Evas_Object *obj, const char *color_class, int
 
    return eo_do_ret(obj, int_ret, elm_obj_widget_class_color3_get(color_class, r, g, b, a));
 }
+
+EAPI void
+elm_object_color_class_del(Evas_Object *obj, const char *color_class)
+{
+   eo_do(obj, elm_obj_widget_class_color_del(color_class));
+}
+
+EAPI void
+elm_object_color_class_clear(Evas_Object *obj)
+{
+   eo_do(obj, elm_obj_widget_class_color_clear());
+}
 //
index 1c83080..02a5627 100644 (file)
@@ -850,6 +850,24 @@ EAPI Eina_Bool        elm_color_class_color3_set(const char *color_class, int r,
 EAPI Eina_Bool        elm_color_class_color3_get(const char *color_class, int *r, int *g, int *b, int *a);
 
 /**
+ * @brief Delete elementary color class.
+ *
+ * This function deletes any values at the process level for the
+ * specified color class.
+ * @note Deleting the color class will revert it to the
+ *       values defined in the theme file.
+ *
+ * @param[in] color_class The name of color class.
+ *
+ * @ingroup General
+ *
+ * @if MOBILE @since_tizen 3.0
+ * @elseif WEARABLE @since_tizen 3.0
+ * @endif
+ */
+EAPI void             elm_color_class_del(const char *color_class);
+
+/**
  * @brief Set the color of color class for a given widget.
  *
  * @note These color values are expected to be premultiplied by @p a.
@@ -988,4 +1006,35 @@ EAPI Eina_Bool        elm_object_color_class_color3_set(Evas_Object *obj, const
  * @endif
  */
 EAPI Eina_Bool        elm_object_color_class_color3_get(Evas_Object *obj, const char *color_class, int *r, int *g, int *b, int *a);
+
+/**
+ * @brief Delete the color class for the Elementary widget.
+ *
+ * Deleting the color class will revert it to the values defined by
+ * elm_color_class_set() or the theme file.
+ *
+ * @param[in] color_class The name of color class.
+ *
+ * @ingroup General
+ *
+ * @if MOBILE @since_tizen 3.0
+ * @elseif WEARABLE @since_tizen 3.0
+ * @endif
+ */
+EAPI void             elm_object_color_class_del(Evas_Object *obj, const char *color_class);
+
+/**
+ * @brief Delete all color classes for the Elementary widget item.
+ *
+ * This function deletes any color classes defined for the Elementary widget item.
+ * Clearing color classes will revert the color of all parts to the values
+ * defined by elm_color_class_set() or the theme file.]]
+ *
+ * @ingroup General
+ *
+ * @if MOBILE @since_tizen 3.0
+ * @elseif WEARABLE @since_tizen 3.0
+ * @endif
+ */
+EAPI void             elm_object_color_class_del(Evas_Object *obj, const char *color_class);
 //
index ef4c408..cfa1578 100644 (file)
@@ -7371,6 +7371,18 @@ _elm_widget_class_color3_get(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSED, con
    return int_ret;
 }
 
+EOLIAN void
+_elm_widget_class_color_del(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd, const char *color_class)
+{
+   edje_object_color_class_del(sd->resize_obj, color_class);
+}
+
+EOLIAN void
+_elm_widget_class_color_clear(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd)
+{
+   edje_object_color_class_clear(sd->resize_obj);
+}
+
 #define ELM_COLOR_CLASS_UPDATE(obj, hash, cond)                                  \
    Evas_Object *edje = NULL;                                                     \
    Eina_Iterator *itr;                                                           \
@@ -7520,6 +7532,48 @@ _elm_widget_item_class_color3_get(Eo *obj, Elm_Widget_Item_Data *sd, const char
 {
    ELM_COLOR_CLASS_GET(obj, r3, g3, b3, a3);
 }
+
+static Evas_Object *
+_elm_widget_item_edje_get(Eo *obj, Elm_Widget_Item_Data *sd)
+{
+   if (!sd)
+     sd = eo_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS);
+
+   if (eo_isa(sd->view, ELM_LAYOUT_CLASS))
+     return elm_layout_edje_get(sd->view);
+   else if (eo_isa(sd->view, EDJE_OBJECT_CLASS))
+     return sd->view;
+
+   return NULL;
+}
+
+EOLIAN void
+_elm_widget_item_class_color_del(Eo *obj EINA_UNUSED, Elm_Widget_Item_Data *sd, const char *color_class)
+{
+   Evas_Object *edje;
+   Edje_Color_Class *cc = NULL;
+
+   if (!color_class) return;
+
+   eina_hash_del(sd->color_classes, color_class, cc);
+
+   edje = _elm_widget_item_edje_get(obj, sd);
+   if (!edje) return;
+
+   edje_object_color_class_del(edje, color_class);
+}
+
+EOLIAN 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_clear(edje);
+}
 //
 
 /* TIZEN_ONLY(20161025): Apply color_class parent-child relationship */
index e3674aa..a8ca746 100644 (file)
@@ -843,6 +843,13 @@ abstract Elm.Widget (Evas.Object_Smart, Elm_Interface_Atspi_Accessible,
             a: int;
          }
       }
+      class_color_del {
+         params {
+            @in color_class: const(char)*;
+         }
+      }
+      class_color_clear {
+      }
       //
    }
    implements {
index 81bea7f..ea4f83f 100644 (file)
@@ -646,6 +646,24 @@ class Elm.Widget_Item (Eo.Base, Elm_Interface_Atspi_Accessible,
                  a: int; [[The alpha value.]]
               }
            }
+           class_color_del {
+              [[Delete the color class for the Elementary widget item.
+
+                Deleting the color class will revert it to the values defined by
+                elm_color_class_set() or the theme file.]]
+              legacy: elm_object_item_color_class_del;
+              params {
+                 @in color_class: const(char)*;
+              }
+           }
+           class_color_clear {
+              [[Delete all color classes for the Elementary widget item.
+
+                This function deletes any color classes defined for the Elementary widget item.
+                Clearing color classes will revert the color of all parts to the values
+                defined by elm_color_class_set() or the theme file.]]
+              legacy: elm_object_item_color_class_clear;
+           }
            //
       }
       implements {