From: Youngbok Shin Date: Mon, 8 Jan 2018 11:02:32 +0000 (+0900) Subject: edje/elementary: apply Tizen's color_class features X-Git-Tag: submit/sandbox/upgrade/efl120/20180319.053334~612 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b25190696dc29c0fc4d731f386722b3282004c5b;p=platform%2Fupstream%2Fefl.git edje/elementary: apply Tizen's color_class features It includes the following features. - Apply a color class to a Textblock's style. - Add/Apply color class parent which propagates its color class to the children. @tizen_feature Change-Id: I7f29f0bb58ee6607e81b938677d4518c8ff19234 --- diff --git a/src/lib/edje/edje_cache.c b/src/lib/edje/edje_cache.c index 22414df..4c2d8d8 100644 --- a/src/lib/edje/edje_cache.c +++ b/src/lib/edje/edje_cache.c @@ -737,3 +737,124 @@ edje_collection_cache_flush(void) _edje_collection_cache_size = ps; } +/*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ +static Eina_Bool +_textblock_styles_color_class_cache_free(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata) +{ + Edje_File *edf = data; + char *class_name = fdata; + Eina_List *l, *ll; + Edje_Style *stl; + Edje_Color_Class *cc = NULL, *tag_cc; + + if (!class_name) return EINA_FALSE; + + cc = _edje_color_class_recursive_find(NULL, edf, class_name); + + if (!cc) + { + ERR("There is no Edje_Color_Class for file color_class: %s", class_name); + return EINA_FALSE; + } + + EINA_LIST_FOREACH(edf->styles, l, stl) + { + Edje_Style_Tag *tag; + Eina_Bool found = EINA_FALSE; + + if (!stl->cache) continue; + + EINA_LIST_FOREACH(stl->tags, ll, tag) + { + if (!tag->color_class) continue; + + tag_cc = _edje_color_class_recursive_find(NULL, edf, tag->color_class); + if (tag_cc == cc) + { + found = EINA_TRUE; + break; + } + if (tag_cc && cc && !strcmp(tag_cc->name, cc->name)) + { + found = EINA_TRUE; + break; + } + } + if (found) + stl->cache = EINA_FALSE; + } + + return EINA_TRUE; +} + +void +_edje_file_textblock_styles_color_class_cache_free(const char *class_name) +{ + if (!class_name) return; + if (!_edje_file_hash) return; + + eina_hash_foreach(_edje_file_hash, _textblock_styles_color_class_cache_free, class_name); +} + +static Eina_Bool +_textblock_styles_text_class_cache_free(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata) +{ + Edje_File *edf = data; + char *class_name = fdata; + Eina_List *l, *ll; + Edje_Style *stl; + + EINA_LIST_FOREACH(edf->styles, l, stl) + { + Edje_Style_Tag *tag; + Eina_Bool found = EINA_FALSE; + + if (!stl->cache) continue; + + EINA_LIST_FOREACH(stl->tags, ll, tag) + { + if (!tag->text_class) continue; + + if (!strcmp(tag->text_class, class_name)) + { + found = EINA_TRUE; + break; + } + } + if (found) + stl->cache = EINA_FALSE; + } + + return EINA_TRUE; +} + +void +_edje_file_textblock_styles_text_class_cache_free(const char *class_name) +{ + if (!class_name) return; + if (!_edje_file_hash) return; + + eina_hash_foreach(_edje_file_hash, _textblock_styles_text_class_cache_free, class_name); +} + +static Eina_Bool +_textblock_styles_cache_update(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata EINA_UNUSED) +{ + Edje_File *edf = data; + _edje_file_textblock_style_all_update(edf); + + return EINA_TRUE; +} + +void +_edje_file_textblock_styles_cache_update(void) +{ + if (!_edje_file_hash) return; + + eina_hash_foreach(_edje_file_hash, _textblock_styles_cache_update, NULL); +} +/******* + * END * + *******/ diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c index 70d74b0..ba0d6fc 100644 --- a/src/lib/edje/edje_calc.c +++ b/src/lib/edje/edje_calc.c @@ -2655,8 +2655,17 @@ _edje_part_recalc_single(Edje *ed, /* colors */ if (ep->part->type != EDJE_PART_TYPE_SPACER) { + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + *********************************************************************************** if ((desc->color_class) && (*desc->color_class)) cc = _edje_color_class_recursive_find(ed, desc->color_class); + */ + if ((desc->color_class) && (*desc->color_class)) + cc = _edje_color_class_recursive_find(ed, ed->file, desc->color_class); + /******* + * END * + *******/ if (cc) { diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c index 7c3a0c5..27af159 100644 --- a/src/lib/edje/edje_entry.c +++ b/src/lib/edje/edje_entry.c @@ -746,6 +746,13 @@ _sel_update(Edje *ed, Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o, Entr evas_object_show(ob); sel->obj_bg = ob; _edje_subobj_register(ed, sel->obj_bg); + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + edje_object_color_class_parent_set(sel->obj_bg, ed->obj); + /******* + * END * + *******/ } if (en->rp->part->source2) @@ -759,6 +766,13 @@ _sel_update(Edje *ed, Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o, Entr evas_object_show(ob); sel->obj_fg = ob; _edje_subobj_register(ed, sel->obj_fg); + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + edje_object_color_class_parent_set(sel->obj_fg, ed->obj); + /******* + * END * + *******/ } } else @@ -1264,6 +1278,13 @@ _anchors_update(Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o, Entry *en) evas_object_pass_events_set(ob, EINA_TRUE); sel->obj_bg = ob; _edje_subobj_register(ed, sel->obj_bg); + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + edje_object_color_class_parent_set(sel->obj_bg, ed->obj); + /******* + * END * + *******/ } if (en->rp->part->source6) @@ -1276,6 +1297,13 @@ _anchors_update(Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o, Entry *en) evas_object_pass_events_set(ob, EINA_TRUE); sel->obj_fg = ob; _edje_subobj_register(ed, sel->obj_fg); + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + edje_object_color_class_parent_set(sel->obj_fg, ed->obj); + /******* + * END * + *******/ } ob = evas_object_rectangle_add(ed->base.evas); @@ -3147,6 +3175,13 @@ _edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp, Ecore_IMF_Context *ic) evas_object_clip_set(en->cursor_bg, evas_object_clip_get(rp->object)); evas_object_pass_events_set(en->cursor_bg, EINA_TRUE); _edje_subobj_register(ed, en->cursor_bg); + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + edje_object_color_class_parent_set(en->cursor_bg, ed->obj); + /******* + * END * + *******/ } if (rp->part->source4) { @@ -3157,6 +3192,13 @@ _edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp, Ecore_IMF_Context *ic) evas_object_clip_set(en->cursor_fg, evas_object_clip_get(rp->object)); evas_object_pass_events_set(en->cursor_fg, EINA_TRUE); _edje_subobj_register(ed, en->cursor_fg); + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + edje_object_color_class_parent_set(en->cursor_fg, ed->obj); + /******* + * END * + *******/ /* A proxy to the main cursor. */ if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE) @@ -3168,6 +3210,13 @@ _edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp, Ecore_IMF_Context *ic) evas_object_clip_set(en->cursor_fg2, evas_object_clip_get(rp->object)); evas_object_pass_events_set(en->cursor_fg2, EINA_TRUE); _edje_subobj_register(ed, en->cursor_fg2); + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + edje_object_color_class_parent_set(en->cursor_fg2, ed->obj); + /******* + * END * + *******/ } } diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index d51c31d..66ea7ba 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -819,7 +819,15 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch edje_module_load(ed->file->external_dir->entries[i].entry); } + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + *********************************************************************************** _edje_textblock_style_all_update(ed); + */ + _edje_file_textblock_style_all_update(ed->file); + /******* + * END * + *******/ ed->has_entries = EINA_FALSE; if (ed->file && ed->file->mo_dir) diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo index f629c37..278babb 100644 --- a/src/lib/edje/edje_object.eo +++ b/src/lib/edje/edje_object.eo @@ -530,6 +530,33 @@ class Edje.Object (Efl.Canvas.Group, Efl.File, Efl.Container, Efl.Part, /******* * END * *******/ + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + color_class_parent_set { + [[Sets the parent object for color class. + + \@if MOBILE \@since_tizen 3.0 + \@elseif WEARABLE \@since_tizen 3.0 + \@endif + \@internal + ]] + params { + @in parent: Efl.Object @nonull; [[The parent object for color class]] + } + } + color_class_parent_unset { + [[Unsets the parent object for color class. + + \@if MOBILE \@since_tizen 3.0 + \@elseif WEARABLE \@since_tizen 3.0 + \@endif + \@internal + ]] + } + /******* + * END * + *******/ } implements { Efl.Gfx.visible { set; } diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 199d80e..39c97ed 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -633,6 +633,17 @@ struct _Edje_Style_Tag const char *font; const char *text_class; double font_size; + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + const char *color_class; + const char *color; + const char *outline_color; + const char *shadow_color; + /******* + * END * + *******/ }; /*----------*/ @@ -1750,6 +1761,16 @@ struct _Edje Eina_List *groups; + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + Eina_List *styles; + Evas_Object *cc_parent; + Eina_List *cc_children; + /******* + * END * + *******/ + Edje_Perspective *persp; Ecore_Animator *animator; @@ -2673,7 +2694,15 @@ Edje_Real_Part *_edje_real_part_get(const Edje *ed, const char *part); Edje_Real_Part *_edje_real_part_recursive_get(Edje **ed, const char *part); Edje_Color_Class *_edje_color_class_find(const Edje *ed, const char *color_class); // The color_class has to be a pointer to an Eet owned string. +/*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + *********************************************************************************** Edje_Color_Class *_edje_color_class_recursive_find(const Edje *ed, const char *color_class); + */ +Edje_Color_Class *_edje_color_class_recursive_find(const Edje *ed, const Edje_File *edf, const char *color_class); +/******* + * END * + *******/ void _edje_color_class_on_del(Edje *ed, Edje_Part *ep); void _edje_color_class_hash_free(void); @@ -2793,8 +2822,22 @@ void _edje_message_del (Edje *ed); void _edje_textblock_styles_add(Edje *ed, Edje_Real_Part *ep); void _edje_textblock_styles_del(Edje *ed, Edje_Part *pt); +/*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + *********************************************************************************** void _edje_textblock_styles_cache_free(Edje *ed, const char *text_class); void _edje_textblock_style_all_update(Edje *ed); + */ +void _edje_file_textblock_styles_color_class_cache_free(const char *class_name); +void _edje_file_textblock_styles_text_class_cache_free(const char *class_name); +void _edje_file_textblock_styles_cache_update(void); +void _edje_file_textblock_style_all_update(Edje_File *edf); +void _edje_textblock_styles_color_class_cache_free(Edje *ed, const char *class_name); +void _edje_textblock_styles_text_class_cache_free(Edje *ed, const char *class_name); +void _edje_textblock_style_all_update(Edje *ed, Eina_Bool force); +/******* + * END * + *******/ void _edje_textblock_style_parse_and_fix(Edje_File *edf); void _edje_textblock_style_cleanup(Edje_File *edf); Edje_File *_edje_cache_file_coll_open(const Eina_File *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret, Edje *ed); diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c index e5a7e34..03c5fd1 100644 --- a/src/lib/edje/edje_smart.c +++ b/src/lib/edje/edje_smart.c @@ -495,6 +495,9 @@ _efl_canvas_layout_efl_observer_update(Eo *obj EINA_UNUSED, Edje *ed, Efl_Object ed->dirty = EINA_TRUE; ed->recalc_call = EINA_TRUE; + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + *********************************************************************************** if ((obs == _edje_color_class_member) || (obs == _edje_size_class_member)) { #ifdef EDJE_CALC_CACHE @@ -509,6 +512,33 @@ _efl_canvas_layout_efl_observer_update(Eo *obj EINA_UNUSED, Edje *ed, Efl_Object ed->text_part_change = EINA_TRUE; #endif } + */ + if (obs == _edje_size_class_member) + { +#ifdef EDJE_CALC_CACHE + ed->all_part_change = EINA_TRUE; +#endif + } + else if (obs == _edje_text_class_member) + { + _edje_textblock_styles_text_class_cache_free(ed, key); + _edje_textblock_style_all_update(ed, EINA_FALSE); +#ifdef EDJE_CALC_CACHE + ed->text_part_change = EINA_TRUE; +#endif + } + else if (obs == _edje_color_class_member) + { + _edje_textblock_styles_color_class_cache_free(ed, key); + _edje_textblock_style_all_update(ed, EINA_FALSE); +#ifdef EDJE_CALC_CACHE + ed->text_part_change = EINA_TRUE; + ed->all_part_change = EINA_TRUE; +#endif + } + /******* + * END * + *******/ _edje_recalc(ed); diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index 24cf2e1..b6a4073 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -1,5 +1,192 @@ #include "edje_private.h" +/*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ +void _edje_textblock_style_update(Edje *ed, Edje_Style *stl, Eina_Bool force); + +static int +_hex_string_get(char ch) +{ + if ((ch >= '0') && (ch <= '9')) return (ch - '0'); + else if ((ch >= 'A') && (ch <= 'F')) return (ch - 'A' + 10); + else if ((ch >= 'a') && (ch <= 'f')) return (ch - 'a' + 10); + return 0; +} + +/** + * @internal + * Calculate the color string according to the given RGBA color. + * @detail It returns a multiplied color string. + * Return string should be free'd manually. + * + * @param color The existing color string from Textblock style. + * @param r Red color + * @param g Green color + * @param b Blue color + * @param a Alpha value + * @return multiplied color string. It should be free'd manually. + */ +char * +_edje_textblock_color_calc(const char *color, unsigned char r, unsigned char g, unsigned char b, unsigned char a) +{ + int cr, cg, cb, ca; + int nr, ng, nb, na; + int len; + char *ret; + + cr = cg = cb = ca = 0; + len = strlen(color); + + if (len == 7) /* #RRGGBB */ + { + cr = (_hex_string_get(color[1]) << 4) | (_hex_string_get(color[2])); + cg = (_hex_string_get(color[3]) << 4) | (_hex_string_get(color[4])); + cb = (_hex_string_get(color[5]) << 4) | (_hex_string_get(color[6])); + ca = 0xff; + } + else if (len == 9) /* #RRGGBBAA */ + { + cr = (_hex_string_get(color[1]) << 4) | (_hex_string_get(color[2])); + cg = (_hex_string_get(color[3]) << 4) | (_hex_string_get(color[4])); + cb = (_hex_string_get(color[5]) << 4) | (_hex_string_get(color[6])); + ca = (_hex_string_get(color[7]) << 4) | (_hex_string_get(color[8])); + } + else if (len == 4) /* #RGB */ + { + cr = _hex_string_get(color[1]); + cr = (cr << 4) | cr; + cg = _hex_string_get(color[2]); + cg = (cg << 4) | cg; + cb = _hex_string_get(color[3]); + cb = (cb << 4) | cb; + ca = 0xff; + } + else if (len == 5) /* #RGBA */ + { + cr = _hex_string_get(color[1]); + cr = (cr << 4) | cr; + cg = _hex_string_get(color[2]); + cg = (cg << 4) | cg; + cb = _hex_string_get(color[3]); + cb = (cb << 4) | cb; + ca = _hex_string_get(color[4]); + ca = (ca << 4) | ca; + } + + nr = (((int)r + 1) * cr) >> 8; + ng = (((int)g + 1) * cg) >> 8; + nb = (((int)b + 1) * cb) >> 8; + na = (((int)a + 1) * ca) >> 8; + + ret = malloc(10); + snprintf(ret, 10, "#%02x%02x%02x%02x", nr, ng, nb, na); + + return ret; +} + +static Edje_Style * +_edje_textblock_style_copy(Edje_Style *stl) +{ + Edje_Style *new_stl; + Eina_List *l; + Edje_Style_Tag *tag; + Edje_Style_Tag *new_tag; + + new_stl = calloc(1, sizeof(Edje_Style)); + if (!new_stl) return NULL; + + new_stl->name = (char *)eina_stringshare_add(stl->name); + new_stl->style = evas_textblock_style_new(); + evas_textblock_style_set(new_stl->style, NULL); + + EINA_LIST_FOREACH(stl->tags, l, tag) + { + new_tag = calloc(1, sizeof(Edje_Style_Tag)); + if (!new_tag) continue; + + new_tag->key = eina_stringshare_add(tag->key); + new_tag->value = eina_stringshare_add(tag->value); + new_tag->font = eina_stringshare_add(tag->font); + new_tag->font_size = tag->font_size; + new_tag->text_class = eina_stringshare_add(tag->text_class); + new_tag->color_class = eina_stringshare_add(tag->color_class); + new_tag->color = eina_stringshare_add(tag->color); + new_tag->outline_color = eina_stringshare_add(tag->outline_color); + new_tag->shadow_color = eina_stringshare_add(tag->shadow_color); + + new_stl->tags = eina_list_append(new_stl->tags, new_tag); + } + + return new_stl; +} + +static void +_edje_textblock_styles_cache_add(Edje *ed, Edje_Style *stl) +{ + Eina_List *l; + Edje_Style *new_stl; + + if (!stl) return; + + EINA_LIST_FOREACH(ed->styles, l, new_stl) + { + if (!strcmp(stl->name, new_stl->name)) + return; + } + + new_stl = _edje_textblock_style_copy(stl); + if (new_stl) + { + ed->styles = eina_list_append(ed->styles, new_stl); + _edje_textblock_style_update(ed, new_stl, EINA_TRUE); + } +} + +static void +_edje_textblock_styles_cache_del(Edje *ed, Edje_Style *stl) +{ + Eina_List *l; + Edje_Style *new_stl; + Eina_Bool found = EINA_FALSE; + + if (!stl) return; + + EINA_LIST_FOREACH(ed->styles, l, new_stl) + { + if (!strcmp(stl->name, new_stl->name)) + { + found = EINA_TRUE; + break; + } + } + if (found) + { + Edje_Style_Tag *tag; + + EINA_LIST_FREE(new_stl->tags, tag) + { + if (tag->value) eina_stringshare_del(tag->value); + if (tag->key) eina_stringshare_del(tag->key); + if (tag->text_class) eina_stringshare_del(tag->text_class); + if (tag->font) eina_stringshare_del(tag->font); + if (tag->color_class) eina_stringshare_del(tag->color_class); + if (tag->color) eina_stringshare_del(tag->color); + if (tag->outline_color) eina_stringshare_del(tag->outline_color); + if (tag->shadow_color) eina_stringshare_del(tag->shadow_color); + free(tag); + } + if (new_stl->name) eina_stringshare_del(new_stl->name); + if (new_stl->style) evas_textblock_style_free(new_stl->style); + free(new_stl); + + ed->styles = eina_list_remove_list(ed->styles, l); + } +} +/******* + * END * + *******/ + static int _edje_font_is_embedded(Edje_File *edf, char *font) { @@ -125,6 +312,32 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag **tag_ret) } } } + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + else if (!strcmp(key, "color_class")) + { + if (tag_ret) + (*tag_ret)->color_class = eina_stringshare_add(val); + } + else if (!strcmp(key, "color")) + { + if (tag_ret) + (*tag_ret)->color = eina_stringshare_add(val); + } + else if (!strcmp(key, "outline_color")) + { + if (tag_ret) + (*tag_ret)->outline_color = eina_stringshare_add(val); + } + else if (!strcmp(key, "shadow_color")) + { + if (tag_ret) + (*tag_ret)->shadow_color = eina_stringshare_add(val); + } + /******* + * END * + *******/ s2 = eina_str_escape(item); if (s2) { @@ -149,7 +362,6 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag **tag_ret) return ret; } - /* Update the given evas_style * * @param ed The edje containing the given style which need to be updated @@ -182,6 +394,18 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl, Eina_Bool force) found = 1; break; } + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + if (tag->color_class) + { + found = 1; + break; + } + /******* + * END * + *******/ } /* No text classes , goto next style */ @@ -205,6 +429,17 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl, Eina_Bool force) /* Configure fonts from text class if it exists */ tc = _edje_text_class_find(ed, tag->text_class); + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + Edje_Color_Class *cc; + + /* Configure color from color class if it exists */ + cc = _edje_color_class_recursive_find(ed, ed->file, tag->color_class); + /******* + * END * + *******/ + /* Add and Handle tag parsed data */ eina_strbuf_append(txt, tag->value); @@ -251,6 +486,69 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl, Eina_Bool force) if (sfont) free(sfont); } + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + if (tag->color) + { + eina_strbuf_append(txt, " "); + eina_strbuf_append(txt, "color="); + + if (cc) + { + char *color; + + color = _edje_textblock_color_calc(tag->color, + cc->r, cc->g, cc->b, cc->a); + eina_strbuf_append_escaped(txt, (const char *)color); + if (color) free(color); + } + else + { + eina_strbuf_append_escaped(txt, tag->color); + } + } + if (tag->outline_color) + { + eina_strbuf_append(txt, " "); + eina_strbuf_append(txt, "outline_color="); + + if (cc) + { + char *color; + + color = _edje_textblock_color_calc(tag->outline_color, + cc->r2, cc->g2, cc->b2, cc->a2); + eina_strbuf_append_escaped(txt, (const char *)color); + if (color) free(color); + } + else + { + eina_strbuf_append_escaped(txt, tag->outline_color); + } + } + if (tag->shadow_color) + { + eina_strbuf_append(txt, " "); + eina_strbuf_append(txt, "shadow_color="); + + if (cc) + { + char *color; + + color = _edje_textblock_color_calc(tag->shadow_color, + cc->r3, cc->g3, cc->b3, cc->a3); + eina_strbuf_append_escaped(txt, (const char *)color); + if (color) free(color); + } + else + { + eina_strbuf_append_escaped(txt, tag->shadow_color); + } + } + /******* + * END * + *******/ eina_strbuf_append(txt, "'"); } @@ -268,6 +566,9 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl, Eina_Bool force) * * @param ed The edje containing styles which need to be updated */ +/*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + *********************************************************************************** void _edje_textblock_style_all_update(Edje *ed) { @@ -279,6 +580,19 @@ _edje_textblock_style_all_update(Edje *ed) EINA_LIST_FOREACH(ed->file->styles, l, stl) _edje_textblock_style_update(ed, stl, EINA_FALSE); } + */ +void +_edje_textblock_style_all_update(Edje *ed, Eina_Bool force) +{ + Eina_List *l; + Edje_Style *stl; + + EINA_LIST_FOREACH(ed->styles, l, stl) + _edje_textblock_style_update(ed, stl, force); +} +/******* + * END * + *******/ static inline Edje_Style * _edje_textblock_style_search(Edje *ed, const char *style) @@ -308,14 +622,41 @@ _edje_textblock_style_member_add(Edje *ed, Edje_Style *stl) EINA_LIST_FOREACH(stl->tags, l, tag) { + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + *********************************************************************************** if (tag->text_class) { efl_observable_observer_add(_edje_text_class_member, tag->text_class, ed->obj); - /* Newly added text_class member should be updated - according to the latest text_class's status. */ + // Newly added text_class member should be updated + according to the latest text_class's status. // _edje_textblock_style_update(ed, stl, EINA_TRUE); } + */ + Eina_Bool force_update = EINA_FALSE; + + if (tag->text_class) + { + efl_observable_observer_add(_edje_text_class_member, tag->text_class, ed->obj); + + force_update = EINA_TRUE; + } + + if (tag->color_class) + { + efl_observable_observer_add(_edje_color_class_member, tag->color_class, ed->obj); + + force_update = EINA_TRUE; + } + + /* Newly added text_class member should be updated + according to the latest text_class's status. */ + if (force_update) + _edje_textblock_styles_cache_add(ed, stl); + /******* + * END * + *******/ } } @@ -378,6 +719,18 @@ _edje_textblock_styles_del(Edje *ed, Edje_Part *pt) { if (tag->text_class) efl_observable_observer_del(_edje_text_class_member, tag->text_class, ed->obj); + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + if (tag->color_class) + efl_observable_observer_del(_edje_color_class_member, tag->color_class, ed->obj); + + if (tag->text_class || tag->color_class) + _edje_textblock_styles_cache_del(ed, stl); + /******* + * END * + *******/ } } @@ -404,11 +757,26 @@ _edje_textblock_styles_del(Edje *ed, Edje_Part *pt) { if (tag->text_class) efl_observable_observer_del(_edje_text_class_member, tag->text_class, ed->obj); + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + if (tag->color_class) + efl_observable_observer_del(_edje_color_class_member, tag->color_class, ed->obj); + + if (tag->text_class || tag->color_class) + _edje_textblock_styles_cache_del(ed, stl); + /******* + * END * + *******/ } } } } +/*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + *********************************************************************************** void _edje_textblock_styles_cache_free(Edje *ed, const char *text_class) { @@ -437,6 +805,89 @@ _edje_textblock_styles_cache_free(Edje *ed, const char *text_class) stl->cache = EINA_FALSE; } } + */ + +void +_edje_textblock_styles_color_class_cache_free(Edje *ed, const char *class_name) +{ + Eina_List *l, *ll; + Edje_Style *stl; + Edje_Color_Class *cc = NULL, *tag_cc; + + if (!class_name) return; + + cc = _edje_color_class_recursive_find(ed, ed->file, class_name); + + if (!cc) + { + ERR("There is no Edje_Color_Class for color_class: %s", class_name); + return; + } + + EINA_LIST_FOREACH(ed->styles, l, stl) + { + Edje_Style_Tag *tag; + Eina_Bool found = EINA_FALSE; + + if (!stl->cache) continue; + + EINA_LIST_FOREACH(stl->tags, ll, tag) + { + if (!tag->color_class) continue; + + if (tag->color_class) + { + tag_cc = _edje_color_class_recursive_find(ed, ed->file, tag->color_class); + if (tag_cc == cc) + { + found = EINA_TRUE; + break; + } + if (tag_cc && cc && !strcmp(tag_cc->name, cc->name)) + { + found = EINA_TRUE; + break; + } + } + } + if (found) + stl->cache = EINA_FALSE; + } +} + +void +_edje_textblock_styles_text_class_cache_free(Edje *ed, const char *class_name) +{ + Eina_List *l, *ll; + Edje_Style *stl; + + if (!class_name) return; + + EINA_LIST_FOREACH(ed->styles, l, stl) + { + Edje_Style_Tag *tag; + Eina_Bool found = EINA_FALSE; + + if (!stl->cache) continue; + + EINA_LIST_FOREACH(stl->tags, ll, tag) + { + if (!tag->text_class) continue; + + if (tag->text_class && class_name && + !strcmp(tag->text_class, class_name)) + { + found = EINA_TRUE; + break; + } + } + if (found) + stl->cache = EINA_FALSE; + } +} +/******* + * END * + *******/ /* When we get to here the edje file had been read into memory * the name of the style is established as well as the name and @@ -511,6 +962,30 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf) eina_strbuf_append(txt, "font_size="); eina_strbuf_append(txt, font_size); } + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + if (tag->color) + { + eina_strbuf_append(txt, " "); + eina_strbuf_append(txt, "color="); + eina_strbuf_append_escaped(txt, tag->color); + } + if (tag->outline_color) + { + eina_strbuf_append(txt, " "); + eina_strbuf_append(txt, "outline_color="); + eina_strbuf_append_escaped(txt, tag->outline_color); + } + if (tag->shadow_color) + { + eina_strbuf_append(txt, " "); + eina_strbuf_append(txt, "shadow_color="); + eina_strbuf_append_escaped(txt, tag->shadow_color); + } + /******* + * END * + *******/ /* Add font name last to save evas from multiple loads */ if (tag->font) { @@ -552,6 +1027,16 @@ _edje_textblock_style_cleanup(Edje_File *edf) /* FIXME: Find a proper way to handle it. */ if (tag->text_class) eina_stringshare_del(tag->text_class); if (tag->font) eina_stringshare_del(tag->font); + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + if (tag->color_class) eina_stringshare_del(tag->color_class); + if (tag->color) eina_stringshare_del(tag->color); + if (tag->outline_color) eina_stringshare_del(tag->outline_color); + if (tag->shadow_color) eina_stringshare_del(tag->shadow_color); + /******* + * END * + *******/ } free(tag); } @@ -561,3 +1046,188 @@ _edje_textblock_style_cleanup(Edje_File *edf) } } +/*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ +void +_edje_file_textblock_style_all_update(Edje_File *edf) +{ + Eina_List *l, *ll; + Edje_Style *stl; + Eina_Strbuf *txt = NULL; + + if (!edf) return; + + EINA_LIST_FOREACH(edf->styles, l, stl) + { + Edje_Style_Tag *tag; + Edje_Text_Class *tc; + Edje_Color_Class *cc; + int found = 0; + char *fontset = NULL, *fontsource = NULL; + + /* Make sure the style is already defined */ + if (!stl->style) break; + + /* No need to compute it again and again and again */ + if (stl->cache) continue; + + /* Make sure the style contains a text_class */ + EINA_LIST_FOREACH(stl->tags, ll, tag) + { + if (tag->text_class) + { + found = 1; + break; + } + if (tag->color_class) + { + found = 1; + break; + } + } + + /* No text classes or color classes, goto next style */ + if (!found) continue; + if (!txt) + txt = eina_strbuf_new(); + + if (_edje_fontset_append) + fontset = eina_str_escape(_edje_fontset_append); + fontsource = eina_str_escape(edf->path); + + /* Build the style from each tag */ + EINA_LIST_FOREACH(stl->tags, ll, tag) + { + if (!tag->key) continue; + + /* Add Tag Key */ + eina_strbuf_append(txt, tag->key); + eina_strbuf_append(txt, "='"); + + /* Configure fonts from text class if it exists */ + tc = _edje_text_class_find(NULL, tag->text_class); + + /* Configure color from color class if it exists */ + cc = _edje_color_class_recursive_find(NULL, edf, tag->color_class); + + /* Add and Handle tag parsed data */ + eina_strbuf_append(txt, tag->value); + + if (!strcmp(tag->key, "DEFAULT")) + { + if (fontset) + { + eina_strbuf_append(txt, " "); + eina_strbuf_append(txt, "font_fallbacks="); + eina_strbuf_append(txt, fontset); + } + eina_strbuf_append(txt, " "); + eina_strbuf_append(txt, "font_source="); + eina_strbuf_append(txt, fontsource); + } + if (tag->font_size != 0) + { + char font_size[32]; + + if (tc && tc->size) + snprintf(font_size, sizeof(font_size), "%f", + (double)_edje_text_size_calc(tag->font_size, tc)); + else + snprintf(font_size, sizeof(font_size), "%f", + tag->font_size); + + eina_strbuf_append(txt, " "); + eina_strbuf_append(txt, "font_size="); + eina_strbuf_append(txt, font_size); + } + /* Add font name last to save evas from multiple loads */ + if (tag->font) + { + const char *f; + char *sfont = NULL; + + eina_strbuf_append(txt, " "); + eina_strbuf_append(txt, "font="); + + if (tc) f = _edje_text_font_get(tag->font, tc->font, &sfont); + else f = tag->font; + + eina_strbuf_append_escaped(txt, f); + + if (sfont) free(sfont); + } + if (tag->color) + { + eina_strbuf_append(txt, " "); + eina_strbuf_append(txt, "color="); + + if (cc) + { + char *color; + + color = _edje_textblock_color_calc(tag->color, + cc->r, cc->g, cc->b, cc->a); + eina_strbuf_append_escaped(txt, (const char *)color); + if (color) free(color); + } + else + { + eina_strbuf_append_escaped(txt, tag->color); + } + } + if (tag->outline_color) + { + eina_strbuf_append(txt, " "); + eina_strbuf_append(txt, "outline_color="); + + if (cc) + { + char *color; + + color = _edje_textblock_color_calc(tag->outline_color, + cc->r2, cc->g2, cc->b2, cc->a2); + eina_strbuf_append_escaped(txt, (const char *)color); + if (color) free(color); + } + else + { + eina_strbuf_append_escaped(txt, tag->outline_color); + } + } + if (tag->shadow_color) + { + eina_strbuf_append(txt, " "); + eina_strbuf_append(txt, "shadow_color="); + + if (cc) + { + char *color; + + color = _edje_textblock_color_calc(tag->shadow_color, + cc->r3, cc->g3, cc->b3, cc->a3); + eina_strbuf_append_escaped(txt, (const char *)color); + if (color) free(color); + } + else + { + eina_strbuf_append_escaped(txt, tag->shadow_color); + } + } + + eina_strbuf_append(txt, "'"); + } + if (fontset) free(fontset); + if (fontsource) free(fontsource); + + /* Configure the style */ + stl->cache = EINA_TRUE; + evas_textblock_style_set(stl->style, eina_strbuf_string_get(txt)); + eina_strbuf_reset(txt); + } + if (txt) + eina_strbuf_free(txt); +} +/******* + * END * + *******/ diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index 320e5f4..9fafcf4 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c @@ -61,6 +61,45 @@ static void _edje_child_remove(Edje *ed, Edje_Real_Part *rp, Evas_Object *c Edje_Real_Part *_edje_real_part_recursive_get_helper(Edje **ed, char **path); +/*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ +static void +_edje_color_class_children_update(Edje *ed, const char *color_class) +{ + Evas_Object *child; + Eina_List *l; + + if (!ed) return; + + EINA_LIST_FOREACH(ed->cc_children, l, child) + { + Edje *cc_child_ed = _edje_fetch(child); + + if (!cc_child_ed) continue; + + cc_child_ed->dirty = EINA_TRUE; + cc_child_ed->recalc_call = EINA_TRUE; +#ifdef EDJE_CALC_CACHE + cc_child_ed->all_part_change = EINA_TRUE; +#endif + if (color_class) + { + _edje_textblock_styles_color_class_cache_free(cc_child_ed, color_class); + _edje_textblock_style_all_update(cc_child_ed, EINA_FALSE); + } + else + { + _edje_textblock_style_all_update(cc_child_ed, EINA_TRUE); + } + + _edje_recalc(cc_child_ed); + } +} +/******* + * END * + *******/ + static Edje_User_Defined * _edje_user_definition_new(Edje_User_Defined_Type type, const char *part, Edje *ed) { @@ -662,8 +701,22 @@ _edje_global_efl_gfx_color_class_color_class_set(Eo *obj EINA_UNUSED, void *pd E int_ret = _edje_color_class_set_internal(_edje_color_class_hash, color_class, layer, r, g, b, a, &need_update); + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + *********************************************************************************** if ((int_ret) && (need_update)) efl_observable_observers_update(_edje_color_class_member, color_class, "color_class,set"); + */ + if ((int_ret) && (need_update)) + { + _edje_file_textblock_styles_color_class_cache_free(color_class); + _edje_file_textblock_styles_cache_update(); + + efl_observable_observers_update(_edje_color_class_member, color_class, "color_class,set"); + } + /******* + * END * + *******/ return int_ret; } @@ -714,6 +767,15 @@ _edje_global_efl_gfx_color_class_color_class_del(Eo *obj EINA_UNUSED, void *pd E eina_stringshare_del(cc->name); free(cc); + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _edje_file_textblock_styles_color_class_cache_free(color_class); + _edje_file_textblock_styles_cache_update(); + /******* + * END * + *******/ + efl_observable_observers_update(_edje_color_class_member, color_class, "color_class,del"); } @@ -867,8 +929,25 @@ _efl_canvas_layout_efl_gfx_color_class_color_class_set(Eo *obj EINA_UNUSED, Edje color_class, layer, r, g, b, a); } + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _edje_textblock_styles_color_class_cache_free(ed, color_class); + _edje_textblock_style_all_update(ed, EINA_FALSE); + /******* + * END * + *******/ + _edje_recalc(ed); _edje_emit(ed, "color_class,set", color_class); + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _edje_color_class_children_update(ed, color_class); + /******* + * END * + *******/ } return int_ret; @@ -926,6 +1005,16 @@ _efl_canvas_layout_efl_gfx_color_class_color_class_del(Eo *obj EINA_UNUSED, Edje if (!color_class) return; + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + /* _edje_textblock_styles_color_class_cache_free() should be called before + * deleting color_class from the hash. */ + _edje_textblock_styles_color_class_cache_free(ed, color_class); + /******* + * END * + *******/ + eina_hash_del(ed->color_classes, color_class, cc); for (i = 0; i < ed->table_parts_size; i++) @@ -945,8 +1034,25 @@ _efl_canvas_layout_efl_gfx_color_class_color_class_del(Eo *obj EINA_UNUSED, Edje #ifdef EDJE_CALC_CACHE ed->all_part_change = EINA_TRUE; #endif + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _edje_textblock_style_all_update(ed, EINA_FALSE); + /******* + * END * + *******/ + _edje_recalc(ed); _edje_emit(ed, "color_class,del", color_class); + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _edje_color_class_children_update(ed, color_class); + /******* + * END * + *******/ } EAPI Eina_Bool @@ -989,6 +1095,15 @@ _efl_canvas_layout_efl_gfx_color_class_color_class_clear(Eo *obj EINA_UNUSED, Ed #ifdef EDJE_CALC_CACHE ed->all_part_change = EINA_TRUE; #endif + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _edje_textblock_style_all_update(ed, EINA_TRUE); + /******* + * END * + *******/ + _edje_recalc(ed); EINA_LIST_FREE(fdata.list, color_class) @@ -996,6 +1111,14 @@ _efl_canvas_layout_efl_gfx_color_class_color_class_clear(Eo *obj EINA_UNUSED, Ed _edje_emit(ed, "color_class,del", color_class); free(color_class); } + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _edje_color_class_children_update(ed, NULL); + /******* + * END * + *******/ } typedef struct _Edje_File_Color_Class_Iterator Edje_File_Color_Class_Iterator; @@ -1117,6 +1240,15 @@ _edje_global_efl_gfx_text_class_text_class_set(Eo *obj EINA_UNUSED, void *pd EIN tc->size = size; } + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _edje_file_textblock_styles_text_class_cache_free(text_class); + _edje_file_textblock_styles_cache_update(); + /******* + * END * + *******/ + /* Tell all members of the text class to recalc */ efl_observable_observers_update(_edje_text_class_member, text_class, NULL); @@ -1175,6 +1307,15 @@ _edje_global_efl_gfx_text_class_text_class_del(Eo *obj EINA_UNUSED, void *pd EIN eina_stringshare_del(tc->font); free(tc); + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _edje_file_textblock_styles_text_class_cache_free(text_class); + _edje_file_textblock_styles_cache_update(); + /******* + * END * + *******/ + efl_observable_observers_update(_edje_text_class_member, text_class, NULL); } @@ -5425,6 +5566,9 @@ _edje_hash_find_helper(const Eina_Hash *hash, const char *key) return data; } +/*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + *********************************************************************************** Edje_Color_Class * _edje_color_class_find(const Edje *ed, const char *color_class) { @@ -5432,21 +5576,74 @@ _edje_color_class_find(const Edje *ed, const char *color_class) if ((!ed) || (!color_class)) return NULL; - /* first look through the object scope */ + // first look through the object scope // cc = eina_hash_find(ed->color_classes, color_class); if (cc) return cc; + // next look through the global scope // + cc = eina_hash_find(_edje_color_class_hash, color_class); + if (cc) return cc; + + // finally, look through the file scope // + if (ed->file) + cc = eina_hash_find(ed->file->color_hash, color_class); + if (cc) return cc; + + return NULL; +} + */ +/* Get Edje_Color_Class from the most near ancestor */ +static Edje_Color_Class * +_edje_color_class_parent_find(const Edje *ed, const char *color_class, + void *(*hash_find_func)(const Eina_Hash *hash, const void *key)) +{ + Edje *cc_parent_ed; + Edje_Color_Class *cc = NULL; + + if (!ed || !color_class || !hash_find_func) return NULL; + + cc_parent_ed = _edje_fetch(ed->cc_parent); + + while(cc_parent_ed) + { + cc = hash_find_func(cc_parent_ed->color_classes, color_class); + if (cc) return cc; + + cc_parent_ed = _edje_fetch(cc_parent_ed->cc_parent); + } + + return NULL; +} + +Edje_Color_Class * +_edje_color_class_find(const Edje *ed, const char *color_class) +{ + Edje_Color_Class *cc = NULL; + + if (!color_class) return NULL; + + /* first look through the object scope */ + if (ed) cc = eina_hash_find(ed->color_classes, color_class); + if (cc) return cc; + + /* next look through the color class parent scope */ + if (ed) cc = _edje_color_class_parent_find(ed, color_class, eina_hash_find); + if (cc) return cc; + /* next look through the global scope */ cc = eina_hash_find(_edje_color_class_hash, color_class); if (cc) return cc; /* finally, look through the file scope */ - if (ed->file) + if (ed && ed->file) cc = eina_hash_find(ed->file->color_hash, color_class); if (cc) return cc; return NULL; } +/******* + * END * + *******/ Edje_Color_Class * _edje_color_class_recursive_find_helper(const Edje *ed, Eina_Hash *hash, const char *color_class) @@ -5457,7 +5654,15 @@ _edje_color_class_recursive_find_helper(const Edje *ed, Eina_Hash *hash, const c cc = _edje_hash_find_helper(hash, color_class); if (cc) return cc; + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + *********************************************************************************** else if (ed->file) + */ + else if (ed && ed->file) + /******* + * END * + *******/ { parent = color_class; while ((ctn = eina_hash_find(ed->file->color_tree_hash, parent))) @@ -5470,6 +5675,9 @@ _edje_color_class_recursive_find_helper(const Edje *ed, Eina_Hash *hash, const c return NULL; } +/*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + *********************************************************************************** Edje_Color_Class * _edje_color_class_recursive_find(const Edje *ed, const char *color_class) { @@ -5477,21 +5685,73 @@ _edje_color_class_recursive_find(const Edje *ed, const char *color_class) if ((!ed) || (!color_class)) return NULL; - /* first look through the object scope */ + // first look through the object scope // cc = _edje_color_class_recursive_find_helper(ed, ed->color_classes, color_class); if (cc) return cc; - /* next look through the global scope */ + // next look through the global scope // cc = _edje_color_class_recursive_find_helper(ed, _edje_color_class_hash, color_class); if (cc) return cc; - /* finally, look through the file scope */ + // finally, look through the file scope // if (ed->file) cc = _edje_color_class_recursive_find_helper(ed, ed->file->color_hash, color_class); if (cc) return cc; return NULL; } + */ +/* Get Edje_Color_Class from the most near ancestor */ +static Edje_Color_Class * +_edje_color_class_parent_recursive_find(const Edje *ed, const char *color_class) +{ + Edje *cc_parent_ed; + Edje_Color_Class *cc = NULL; + + if (!ed) return NULL; + + cc_parent_ed = _edje_fetch(ed->cc_parent); + + while(cc_parent_ed) + { + cc = _edje_color_class_recursive_find_helper(cc_parent_ed, cc_parent_ed->color_classes, color_class); + if (cc) return cc; + + cc_parent_ed = _edje_fetch(cc_parent_ed->cc_parent); + } + + return NULL; +} + +Edje_Color_Class * +_edje_color_class_recursive_find(const Edje *ed, const Edje_File *edf, const char *color_class) +{ + Edje_Color_Class *cc = NULL; + + if (!color_class) return NULL; + + /* first look through the object scope */ + if (ed) cc = _edje_color_class_recursive_find_helper(ed, ed->color_classes, color_class); + if (cc) return cc; + + /* TIZEN_ONLY(20161025): Add color class parent-child relationship with APIs */ + if (ed) cc = _edje_color_class_parent_recursive_find(ed, color_class); + if (cc) return cc; + /* END */ + + /* next look through the global scope */ + cc = _edje_color_class_recursive_find_helper(ed, _edje_color_class_hash, color_class); + if (cc) return cc; + + /* finally, look through the file scope */ + if (edf) cc = _edje_color_class_recursive_find_helper(ed, edf->color_hash, color_class); + if (cc) return cc; + + return NULL; +} +/******* + * END * + *******/ static Eina_Bool color_class_hash_list_free(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata EINA_UNUSED) @@ -5526,6 +5786,9 @@ _edje_color_class_on_del(Edje *ed, Edje_Part *ep) efl_observable_observer_del(_edje_color_class_member, ep->other.desc[i]->color_class, ed->obj); } +/*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + *********************************************************************************** Edje_Text_Class * _edje_text_class_find(Edje *ed, const char *text_class) { @@ -5533,21 +5796,47 @@ _edje_text_class_find(Edje *ed, const char *text_class) if ((!ed) || (!text_class)) return NULL; - /* first look through the object scope */ + // first look through the object scope // tc = eina_hash_find(ed->text_classes, text_class); if (tc) return tc; + // next look through the global scope // + tc = eina_hash_find(_edje_text_class_hash, text_class); + if (tc) return tc; + + // finally, look through the file scope // + if (ed->file) + tc = eina_hash_find(ed->file->text_hash, text_class); + if (tc) return tc; + + return NULL; +} + */ +Edje_Text_Class * +_edje_text_class_find(Edje *ed, const char *text_class) +{ + Edje_Text_Class *tc = NULL; + + if (!text_class) return NULL; + + /* first look through the object scope */ + if (ed) tc = eina_hash_find(ed->text_classes, text_class); + if (tc) return tc; + /* next look through the global scope */ tc = eina_hash_find(_edje_text_class_hash, text_class); if (tc) return tc; /* finally, look through the file scope */ - if (ed->file) + if (ed && ed->file) tc = eina_hash_find(ed->file->text_hash, text_class); if (tc) return tc; return NULL; } +/******* + * END * + *******/ static Eina_Bool text_class_hash_list_free(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata EINA_UNUSED) @@ -6569,4 +6858,97 @@ _efl_canvas_layout_part_text_marquee_always_get(Eo *eo_obj EINA_UNUSED, Edje *ed * END * *******/ +/*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ +static void +_edje_object_color_class_parent_del_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + Evas_Object *child; + Eina_List *l, *ll; + Edje *ed = _edje_fetch(obj); + + if (!ed) return; + + EINA_LIST_FOREACH_SAFE(ed->cc_children, l, ll, child) + edje_object_color_class_parent_unset(child); +} + +static void +_edje_object_color_class_child_del_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + Edje *ed = _edje_fetch(obj); + + if (!ed) return; + + edje_object_color_class_parent_unset(obj); +} + +static void +_edje_object_color_class_child_add(Evas_Object *obj, Evas_Object *child) +{ + Edje *ed = _edje_fetch(obj); + + if (!ed) return; + + if (!ed->cc_children) + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _edje_object_color_class_parent_del_cb, NULL); + + ed->cc_children = eina_list_append(ed->cc_children, child); +} + +static void +_edje_object_color_class_child_remove(Evas_Object *obj, Evas_Object *child) +{ + Edje *ed = _edje_fetch(obj); + + if (!ed) return; + + ed->cc_children = eina_list_remove(ed->cc_children, child); + + if (!ed->cc_children) + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL, _edje_object_color_class_parent_del_cb, NULL); +} + +EOLIAN void +_efl_canvas_layout_color_class_parent_set(Eo *obj, Edje *ed, Efl_Object *parent) +{ + if (!parent) return; + + if (ed->cc_parent) _edje_object_color_class_child_remove(ed->cc_parent, obj); + + if (!ed->cc_parent) + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _edje_object_color_class_child_del_cb, NULL); + + ed->cc_parent = parent; + _edje_object_color_class_child_add(parent, obj); + + ed->dirty = EINA_TRUE; + ed->recalc_call = EINA_TRUE; +#ifdef EDJE_CALC_CACHE + ed->all_part_change = EINA_TRUE; +#endif + _edje_textblock_style_all_update(ed, EINA_TRUE); + _edje_recalc(ed); +} + +EOLIAN void +_efl_canvas_layout_color_class_parent_unset(Eo *obj, Edje *ed) +{ + if (ed->cc_parent) _edje_object_color_class_child_remove(ed->cc_parent, obj); + ed->cc_parent = NULL; + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL, _edje_object_color_class_child_del_cb, NULL); + + ed->dirty = EINA_TRUE; + ed->recalc_call = EINA_TRUE; +#ifdef EDJE_CALC_CACHE + ed->all_part_change = EINA_TRUE; +#endif + _edje_textblock_style_all_update(ed, EINA_TRUE); + _edje_recalc(ed); +} +/******* + * END * + *******/ + /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/ diff --git a/src/lib/edje/efl_canvas_layout.eo b/src/lib/edje/efl_canvas_layout.eo index 680ea65..d981818 100644 --- a/src/lib/edje/efl_canvas_layout.eo +++ b/src/lib/edje/efl_canvas_layout.eo @@ -237,6 +237,33 @@ class Efl.Canvas.Layout (Efl.Canvas.Group, Efl.File, Efl.Container, Efl.Part, /******* * END * *******/ + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + color_class_parent_set { + [[Sets the parent object for color class. + + \@if MOBILE \@since_tizen 3.0 + \@elseif WEARABLE \@since_tizen 3.0 + \@endif + \@internal + ]] + params { + @in parent: Efl.Object @nonull; [[The parent object for color class]] + } + } + color_class_parent_unset { + [[Unsets the parent object for color class. + + \@if MOBILE \@since_tizen 3.0 + \@elseif WEARABLE \@since_tizen 3.0 + \@endif + \@internal + ]] + } + /******* + * END * + *******/ } implements { Efl.Gfx.visible { set; } diff --git a/src/lib/elementary/efl_ui_clock.c b/src/lib/elementary/efl_ui_clock.c index ac10a61..10c1d35 100644 --- a/src/lib/elementary/efl_ui_clock.c +++ b/src/lib/elementary/efl_ui_clock.c @@ -861,6 +861,14 @@ _efl_ui_clock_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Clock_Data *priv) { field = priv->field_list + idx; field->item_obj = dt_mod->field_create(priv->mod_data, idx); + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(field->item_obj, obj); + /******* + * END * + *******/ } } } diff --git a/src/lib/elementary/efl_ui_multibuttonentry.c b/src/lib/elementary/efl_ui_multibuttonentry.c index 6520a1c..9fdda61 100644 --- a/src/lib/elementary/efl_ui_multibuttonentry.c +++ b/src/lib/elementary/efl_ui_multibuttonentry.c @@ -1299,6 +1299,14 @@ _guide_text_set(Evas_Object *obj, (sd->guide_text, EVAS_HINT_FILL, EVAS_HINT_FILL); edje_object_part_text_escaped_set(sd->guide_text, "elm.text", str); _view_update(sd); + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(sd->guide_text, obj); + /******* + * END * + *******/ } } @@ -1494,6 +1502,14 @@ _view_init(Evas_Object *obj, Efl_Ui_Multibuttonentry_Data *sd) if (!sd->label) return; elm_widget_element_update(obj, sd->label, PART_NAME_LABEL); + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(sd->label, obj); + /******* + * END * + *******/ + // ACCESS if (_elm_config->access_mode == ELM_ACCESS_MODE_ON) _access_multibuttonentry_label_register(obj, EINA_TRUE); @@ -1511,6 +1527,14 @@ _view_init(Evas_Object *obj, Efl_Ui_Multibuttonentry_Data *sd) efl_ui_text_interactive_editable_set(efl_added, EINA_TRUE), efl_composite_attach(obj, efl_added)); + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(sd->entry, obj); + /******* + * END * + *******/ + evas_object_size_hint_min_set(sd->entry, MIN_W_ENTRY, 0); evas_object_size_hint_weight_set (sd->entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -1527,6 +1551,14 @@ _view_init(Evas_Object *obj, Efl_Ui_Multibuttonentry_Data *sd) if (!sd->end) return; elm_widget_element_update(obj, sd->end, PART_NAME_CLOSED_BUTTON); + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(sd->end, obj); + /******* + * END * + *******/ + edje_object_size_min_calc(sd->end, &button_min_width, &button_min_height); elm_coords_finger_size_adjust(1, &button_min_width, 1, &button_min_height); evas_object_size_hint_min_set(sd->end, button_min_width, button_min_height); diff --git a/src/lib/elementary/efl_ui_slider.c b/src/lib/elementary/efl_ui_slider.c index d316278..14c1662 100644 --- a/src/lib/elementary/efl_ui_slider.c +++ b/src/lib/elementary/efl_ui_slider.c @@ -695,6 +695,14 @@ _popup_add(Efl_Ui_Slider_Data *sd, Eo *obj, Evas_Object **popup, edje_object_signal_callback_add(*popup, "elm,popup,hide,done", "elm", _popup_hide_done, obj); + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(*popup, obj); + /******* + * END * + *******/ + _popup_update(obj, sd, *popup); /* create a rectangle to track position+size of the dragable */ diff --git a/src/lib/elementary/elc_ctxpopup.c b/src/lib/elementary/elc_ctxpopup.c index 0e362a0..f83fce1 100644 --- a/src/lib/elementary/elc_ctxpopup.c +++ b/src/lib/elementary/elc_ctxpopup.c @@ -1080,6 +1080,15 @@ _elm_ctxpopup_efl_canvas_group_group_add(Eo *obj, Elm_Ctxpopup_Data *priv) (obj, priv->arrow, "ctxpopup", "arrow", "default"); evas_object_smart_member_add(priv->arrow, obj); + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(priv->bg, obj); + _elm_widget_color_class_parent_set(priv->arrow, obj); + /******* + * END * + *******/ + priv->dir_priority[0] = ELM_CTXPOPUP_DIRECTION_UP; priv->dir_priority[1] = ELM_CTXPOPUP_DIRECTION_LEFT; priv->dir_priority[2] = ELM_CTXPOPUP_DIRECTION_RIGHT; @@ -1561,6 +1570,14 @@ _elm_ctxpopup_item_init(Eo *eo_item, evas_object_event_callback_add (sd->list, EVAS_CALLBACK_RESIZE, _list_resize_cb, obj); elm_layout_content_set(obj, "default", sd->list); + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(sd->list, obj); + /******* + * END * + *******/ } item->wcb.org_func_cb = func; diff --git a/src/lib/elementary/elc_naviframe.c b/src/lib/elementary/elc_naviframe.c index 9aae2f5..1d65d68 100644 --- a/src/lib/elementary/elc_naviframe.c +++ b/src/lib/elementary/elc_naviframe.c @@ -1373,6 +1373,14 @@ _item_new(Evas_Object *obj, const char *prev_title = prev_it->title_label; prev_btn = _back_btn_new(obj, prev_title); it->auto_pushed_btn = prev_btn; + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(it->auto_pushed_btn, VIEW(it)); + /******* + * END * + *******/ } if (prev_btn) diff --git a/src/lib/elementary/elc_popup.c b/src/lib/elementary/elc_popup.c index a132da5..ba1cbf0 100644 --- a/src/lib/elementary/elc_popup.c +++ b/src/lib/elementary/elc_popup.c @@ -1007,6 +1007,15 @@ _create_scroller(Evas_Object *obj) //Scroller sd->scr = elm_scroller_add(sd->tbl); + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(sd->scr, obj); + /******* + * END * + *******/ + /* TIZEN_ONLY(20160318): Support legacy group and swallow part names if (!sd->scroll) { @@ -1410,6 +1419,13 @@ _content_text_set(Evas_Object *obj, if (elm_widget_style_set(sd->text_content_obj, style) != EFL_UI_THEME_APPLY_SUCCESS) elm_widget_style_set(sd->text_content_obj, "popup/default"); /* END */ + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(sd->text_content_obj, obj); + /******* + * END * + *******/ evas_object_event_callback_add (sd->text_content_obj, EVAS_CALLBACK_DEL, _on_text_content_del, obj); @@ -1646,6 +1662,14 @@ _action_button_set(Evas_Object *obj, efl_content_set(efl_part(sd->main_layout, "elm.swallow.action_area"), sd->action_area); _visuals_set(obj); + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(sd->action_area, obj); + /******* + * END * + *******/ } /* TIZEN_ONLY(20161109): check theme compatibility more precise @@ -1935,6 +1959,14 @@ _elm_popup_efl_canvas_group_group_add(Eo *obj, Elm_Popup_Data *priv) priv->notify = elm_notify_add(obj); + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(priv->notify, obj); + /******* + * END * + *******/ + /* TIZEN_ONLY(20161109): check theme compatibility more precise */ elm_notify_align_set(priv->notify, _elm_config->popup_horizontal_align, @@ -1989,6 +2021,14 @@ _elm_popup_efl_canvas_group_group_add(Eo *obj, Elm_Popup_Data *priv) elm_widget_style_get(obj))) CRI("Failed to set layout!"); + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(priv->main_layout, obj); + /******* + * END * + *******/ + elm_object_content_set(priv->notify, priv->main_layout); evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _on_show, NULL); @@ -2005,6 +2045,15 @@ _elm_popup_efl_canvas_group_group_add(Eo *obj, Elm_Popup_Data *priv) (priv->main_layout, "elm,state,action_area,hidden", "elm", _layout_change_cb, NULL); priv->content_area = elm_layout_add(priv->main_layout); + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(priv->content_area, obj); + /******* + * END * + *******/ + /* TIZEN_ONLY(20161109): check theme compatibility more precise if (!elm_layout_theme_set(priv->content_area, "popup", "content", style)) CRI("Failed to set layout!"); diff --git a/src/lib/elementary/elm_calendar.c b/src/lib/elementary/elm_calendar.c index 8cedb66..868df74 100644 --- a/src/lib/elementary/elm_calendar.c +++ b/src/lib/elementary/elm_calendar.c @@ -864,6 +864,14 @@ _spinner_buttons_add(Evas_Object *obj, Elm_Calendar_Data *sd) elm_button_autorepeat_gap_timeout_set(sd->dec_btn_month, 0.2); evas_object_smart_callback_add(sd->dec_btn_month, "clicked", _button_widget_month_dec_start_click, obj); evas_object_smart_callback_add(sd->dec_btn_month, "repeated", _button_widget_month_dec_start, obj); + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(sd->dec_btn_month, obj); + /******* + * END * + *******/ } elm_object_style_set(sd->dec_btn_month, left_buf); @@ -892,6 +900,14 @@ _spinner_buttons_add(Evas_Object *obj, Elm_Calendar_Data *sd) elm_button_autorepeat_gap_timeout_set(sd->inc_btn_month, 0.2); evas_object_smart_callback_add(sd->inc_btn_month, "clicked", _button_widget_month_inc_start_click, obj); evas_object_smart_callback_add(sd->inc_btn_month, "repeated", _button_widget_month_inc_start, obj); + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(sd->inc_btn_month, obj); + /******* + * END * + *******/ } elm_object_style_set(sd->inc_btn_month, right_buf); @@ -920,6 +936,14 @@ _spinner_buttons_add(Evas_Object *obj, Elm_Calendar_Data *sd) elm_button_autorepeat_gap_timeout_set(sd->dec_btn_year, 0.2); evas_object_smart_callback_add(sd->dec_btn_year, "clicked", _button_widget_year_dec_start_click, obj); evas_object_smart_callback_add(sd->dec_btn_year, "repeated", _button_widget_year_dec_start, obj); + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(sd->dec_btn_year, obj); + /******* + * END * + *******/ } elm_object_style_set(sd->dec_btn_year, left_buf); @@ -948,6 +972,14 @@ _spinner_buttons_add(Evas_Object *obj, Elm_Calendar_Data *sd) elm_button_autorepeat_gap_timeout_set(sd->inc_btn_year, 0.2); evas_object_smart_callback_add(sd->inc_btn_year, "clicked", _button_widget_year_inc_start_click, obj); evas_object_smart_callback_add(sd->inc_btn_year, "repeated", _button_widget_year_inc_start, obj); + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(sd->inc_btn_year, obj); + /******* + * END * + *******/ } elm_object_style_set(sd->inc_btn_year, right_buf); diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c index d31d640..8eeea38 100644 --- a/src/lib/elementary/elm_entry.c +++ b/src/lib/elementary/elm_entry.c @@ -1799,6 +1799,14 @@ _magnifier_create(void *data) _elm_theme_object_set(data, sd->mgf_bg, "entry", "magnifier", "default"); evas_object_show(sd->mgf_bg); + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(sd->mgf_bg, sd->entry_edje); + /******* + * END * + *******/ + //Proxy sd->mgf_proxy = evas_object_image_add(e); evas_object_event_callback_add(sd->mgf_proxy, EVAS_CALLBACK_RESIZE, @@ -3884,6 +3892,15 @@ _create_selection_handlers(Evas_Object *obj, Elm_Entry_Data *sd) evas_object_event_callback_add(handle, EVAS_CALLBACK_MOUSE_UP, _end_handler_mouse_up_cb, obj); evas_object_show(handle); + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(sd->start_handler, sd->entry_edje); + _elm_widget_color_class_parent_set(sd->end_handler, sd->entry_edje); + /******* + * END * + *******/ } // TIZEN_ONLY(20170512): Support accessibility for entry anchors. @@ -5070,6 +5087,14 @@ _elm_entry_scrollable_set(Eo *obj, Elm_Entry_Data *sd, Eina_Bool scroll) (sd->scr_edje, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_propagate_events_set(sd->scr_edje, EINA_TRUE); + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(sd->scr_edje, sd->entry_edje); + /******* + * END * + *******/ } elm_widget_resize_object_set(obj, sd->scr_edje); diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h index fdfba90..aed9832 100644 --- a/src/lib/elementary/elm_priv.h +++ b/src/lib/elementary/elm_priv.h @@ -862,4 +862,13 @@ char tizen_util_probe_profile_wearable(); #define TIZEN_PROFILE_WEARABLE tizen_util_probe_profile_wearable() // +/*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ +void _elm_widget_color_class_parent_set(Evas_Object *obj, Evas_Object *parent); +void _elm_widget_color_class_parent_unset(Evas_Object *obj); +/******* + * END * + *******/ + #endif diff --git a/src/lib/elementary/elm_spinner.c b/src/lib/elementary/elm_spinner.c index 029efa0..37b2c8f 100644 --- a/src/lib/elementary/elm_spinner.c +++ b/src/lib/elementary/elm_spinner.c @@ -648,6 +648,14 @@ _toggle_entry(Evas_Object *obj) elm_entry_markup_filter_append(sd->ent, _min_max_validity_filter, obj); efl_event_callback_add (sd->ent, ELM_ENTRY_EVENT_ACTIVATED, _entry_activated_cb, obj); + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(sd->ent, obj); + /******* + * END * + *******/ } if (!sd->button_layout) { @@ -1249,6 +1257,16 @@ _elm_spinner_efl_canvas_group_group_add(Eo *obj, Elm_Spinner_Data *priv) efl_ui_focus_composition_elements_set(obj, items); } + + /*********************************************************************************** + * TIZEN_ONLY_FEATURE: apply Tizen's color_class features. * + ***********************************************************************************/ + _elm_widget_color_class_parent_set(priv->inc_button, obj); + _elm_widget_color_class_parent_set(priv->text_button, obj); + _elm_widget_color_class_parent_set(priv->dec_button, obj); + /******* + * END * + *******/ } else { diff --git a/src/lib/elementary/elm_widget.c b/src/lib/elementary/elm_widget.c index 9c045f4..3130556 100644 --- a/src/lib/elementary/elm_widget.c +++ b/src/lib/elementary/elm_widget.c @@ -7191,6 +7191,51 @@ _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); +} +/******* + * END * + *******/ + #include "elm_widget_item.eo.c" #include "elm_widget.eo.c"