}
//
+ if (item->color_classes)
+ ELM_SAFE_FREE(item->color_classes, eina_hash_free);
+
EINA_MAGIC_SET(item, EINA_MAGIC_NONE);
eo_do_super(eo_item, ELM_WIDGET_ITEM_CLASS, eo_destructor());
Eina_Bool int_ret = EINA_FALSE; \
if (eo_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(eo_class_get(obj), NULL, color_class); \
_elm_color_unpremul(a, &r, &g, &b)
_elm_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(ELM_LAYOUT_CLASS);
+
+ int r2 = 0, g2 = 0, b2 = 0, a2 = 0, r3 = 0, g3 = 0, b3 = 0, a3 = 0;
+
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();
}
_elm_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(ELM_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();
}
_elm_widget_color_class_color2_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(ELM_LAYOUT_CLASS);
+
+ int r2 = 0, g2 = 0, b2 = 0, a2 = 0, r3 = 0, g3 = 0, b3 = 0, a3 = 0;
+
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();
}
_elm_widget_color_class_color2_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(ELM_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();
}
_elm_widget_color_class_color3_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(ELM_LAYOUT_CLASS);
+
+ int r2 = 0, g2 = 0, b2 = 0, a2 = 0, r3 = 0, g3 = 0, b3 = 0, a3 = 0;
+
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();
}
_elm_widget_color_class_color3_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(ELM_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();
+}
+
+Eina_Bool
+_elm_widget_item_color_class_update(Elm_Widget_Item_Data *sd)
+{
+ Evas_Object *edje;
+ Eina_Iterator *itr;
+ Edje_Color_Class *cc;
+ Eina_Bool int_ret = EINA_TRUE;
+
+ if (!sd->color_classes || !sd->view) return EINA_FALSE;
+
+ if (eo_isa(sd->view, ELM_LAYOUT_CLASS))
+ edje = elm_layout_edje_get(sd->view);
+ else
+ edje = sd->view;
+
+ itr = eina_hash_iterator_data_new(sd->color_classes);
+ 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_ITEM_COLOR_CLASS_SET(cr, cg, cb, ca) \
+ Edje_Color_Class *cc = NULL; \
+ CHECK_BOUND(r); \
+ CHECK_BOUND(g); \
+ CHECK_BOUND(b); \
+ CHECK_BOUND(a); \
+ if (!sd->color_classes) \
+ sd->color_classes = eina_hash_string_small_new(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; \
+ if (sd->view) \
+ int_ret &= _elm_widget_item_color_class_update(sd)
+
+EOLIAN Eina_Bool
+_elm_widget_item_color_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_UPPER(ELM_WIDGET_ITEM_CLASS);
+ ELM_ITEM_COLOR_CLASS_SET(r, g, b, a);
+ ELM_COLOR_CLASS_SET_LOWER();
+}
+
+#define ELM_ITEM_COLOR_CLASS_GET(cr, cg, cb, ca) \
+ Edje_Color_Class *cc; \
+ 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; \
+ int_ret = EINA_TRUE; \
+ }
+
+EOLIAN Eina_Bool
+_elm_widget_item_color_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_UPPER(ELM_WIDGET_ITEM_CLASS);
+ ELM_ITEM_COLOR_CLASS_GET(r, g, b, a);
+ ELM_COLOR_CLASS_GET_LOWER();
+}
+
+EOLIAN Eina_Bool
+_elm_widget_item_color_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_UPPER(ELM_WIDGET_ITEM_CLASS);
+ ELM_ITEM_COLOR_CLASS_SET(r2, g2, b2, a2);
+ ELM_COLOR_CLASS_SET_LOWER();
+}
+
+EOLIAN Eina_Bool
+_elm_widget_item_color_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_UPPER(ELM_WIDGET_ITEM_CLASS);
+ ELM_ITEM_COLOR_CLASS_GET(r2, g2, b2, a2);
+ ELM_COLOR_CLASS_GET_LOWER();
+}
+
+EOLIAN Eina_Bool
+_elm_widget_item_color_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_UPPER(ELM_WIDGET_ITEM_CLASS);
+ ELM_ITEM_COLOR_CLASS_SET(r3, g3, b3, a3);
+ ELM_COLOR_CLASS_SET_LOWER();
+}
+
+EOLIAN Eina_Bool
+_elm_widget_item_color_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_UPPER(ELM_WIDGET_ITEM_CLASS);
+ ELM_ITEM_COLOR_CLASS_GET(r3, g3, b3, a3);
ELM_COLOR_CLASS_GET_LOWER();
}
//