From bfc61c2477dc0d864cd98e198e860e6799915a6d Mon Sep 17 00:00:00 2001 From: Jeonghyun Yun Date: Tue, 23 Jun 2020 14:59:12 +0900 Subject: [PATCH] efl_ui_widget: add color class update when the style is updated Change-Id: Iad6fe717a927f78238538b6c554edc4cf356c253 Signed-off-by: Jeonghyun Yun --- src/lib/elementary/efl_ui_widget.c | 51 ++++++++++++++++++++++++++++++++++++++ src/lib/elementary/elm_widget.h | 4 +++ 2 files changed, 55 insertions(+) diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c index 1764828..18902d5 100644 --- a/src/lib/elementary/efl_ui_widget.c +++ b/src/lib/elementary/efl_ui_widget.c @@ -96,6 +96,10 @@ static int _sort_horizontally(const void *data1, const void *data2); Eo * plug_type_proxy_get(const Eo *obj, Evas_Object *widget); +// TIZEN_ONLY(20200623) : apply Tizen's color_class features +static Eina_Bool _elm_widget_color_class_update(Eo *obj, Elm_Widget_Smart_Data *sd); +// + static Eina_Bool _elm_widget_can_highlight_get_by_class(Eo *obj); static Eina_Bool _accessible_object_on_scroll_is(Eo* obj); // TIZEN_ONLY @@ -1392,6 +1396,11 @@ elm_widget_theme(Evas_Object *obj) _elm_widget_theme_helper(efl_ui_widget_theme_apply(obj), &err_default, &err_generic); if (err_generic) return EFL_UI_THEME_APPLY_ERROR_GENERIC; if (err_default) return EFL_UI_THEME_APPLY_ERROR_DEFAULT; + + // TIZEN_ONLY(20200623) : apply Tizen's color_class features + if (sd->color_classes) + _elm_widget_color_class_update(obj, sd); + // return EFL_UI_THEME_APPLY_ERROR_NONE; } @@ -5832,6 +5841,11 @@ _efl_ui_widget_efl_object_destructor(Eo *obj, Elm_Widget_Smart_Data *sd) eina_stringshare_del(sd->atspi_translation_domain); /// + // TIZEN_ONLY(20200623) : apply Tizen's color_class features + if (sd->color_classes) + ELM_SAFE_FREE(sd->color_classes, eina_hash_free); + // + if (sd->children) { eina_array_free(sd->children); @@ -8967,6 +8981,10 @@ _elm_widget_color_class_set_internal(Evas_Object *obj, Evas_Object *edje, const { Eina_Bool int_ret = EINA_TRUE; Eina_Stringshare *buf; + // TIZEN_ONLY(20200623) : apply Tizen's color_class features + Edje_Color_Class *cc = NULL; + API_ENTRY return EINA_FALSE; + // int temp_color[3][4] = { { r, g, b, a }, { r2, g2, b2, a2 }, { r3, g3, b3, a3 } }; @@ -8995,6 +9013,25 @@ _elm_widget_color_class_set_internal(Evas_Object *obj, Evas_Object *edje, const #undef TEMP_COLOR + // TIZEN_ONLY(20200623) : apply Tizen's color_class features + if (int_ret) + { + 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); + eina_hash_direct_add(sd->color_classes, cc->name, cc); + } + cc->r = r; cc->g = g; cc->b = b; cc->a = a; + cc->r2 = r2; cc->g2 = g2; cc->b2 = b2; cc->a2 = a2; + cc->r3 = r3; cc->g3 = g3; cc->b3 = b3; cc->a3 = a3; + } + // + eina_stringshare_del(buf); return int_ret; @@ -9136,10 +9173,16 @@ static void _elm_widget_class_color_del(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd, const char *color_class) { Eina_Stringshare *buf; + // TIZEN_ONLY(20200623) : apply Tizen's color_class features + Edje_Color_Class *cc = NULL; + // if (!efl_isa(obj, EFL_UI_LAYOUT_BASE_CLASS)) return; buf = _elm_widget_edje_class_get(obj, NULL, color_class); + // TIZEN_ONLY(20200623) : apply Tizen's color_class features + eina_hash_del(sd->color_classes, buf, cc); + // edje_object_color_class_del(sd->resize_obj, buf); eina_stringshare_del(buf); } @@ -9149,6 +9192,9 @@ static void _elm_widget_class_color_clear(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd) { if (!efl_isa(obj, EFL_UI_LAYOUT_BASE_CLASS)) return; + // TIZEN_ONLY(20200623) : apply Tizen's color_class features + ELM_SAFE_FREE(sd->color_classes, eina_hash_free); + // edje_object_color_class_clear(sd->resize_obj); } @@ -9174,6 +9220,11 @@ _elm_widget_class_color_clear(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd) eina_iterator_free(itr); \ return int_ret +static Eina_Bool +_elm_widget_color_class_update(Eo *obj, Elm_Widget_Smart_Data *sd) +{ + ELM_COLOR_CLASS_UPDATE(obj, sd->color_classes, (!sd) || (!sd->color_classes) || (!obj)); +} #define CHECK_BOUND(x) \ if (x > 0xff) x = 0xff; \ diff --git a/src/lib/elementary/elm_widget.h b/src/lib/elementary/elm_widget.h index 7447597..968ee93 100644 --- a/src/lib/elementary/elm_widget.h +++ b/src/lib/elementary/elm_widget.h @@ -405,6 +405,10 @@ typedef struct _Elm_Widget_Smart_Data const char *name; // + // TIZEN_ONLY(20200623) : apply Tizen's color_class features + Eina_Hash *color_classes; + // + /* this is a hook to be set on-the-fly on widgets. this is code * handling the request of showing a specific region from an inner * widget (mainly issued by entries, on cursor moving) */ -- 2.7.4