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
_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 *
+ *******/
/* 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)
{
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)
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
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)
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);
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)
{
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)
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 *
+ *******/
}
}
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)
/*******
* 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; }
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 *
+ *******/
};
/*----------*/
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;
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);
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);
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
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);
#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)
{
}
}
}
+ /***********************************************************************************
+ * 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)
{
return ret;
}
-
/* Update the given evas_style
*
* @param ed The edje containing the given style which need to be updated
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 */
/* 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);
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, "'");
}
*
* @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)
{
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)
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 *
+ *******/
}
}
{
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 *
+ *******/
}
}
{
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)
{
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
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)
{
/* 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);
}
}
}
+/***********************************************************************************
+ * 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 *
+ *******/
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)
{
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;
}
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");
}
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;
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++)
#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
#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)
_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;
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);
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);
}
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)
{
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)
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)))
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)
{
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)
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)
{
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)
* 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 :*/
/*******
* 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; }
{
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 *
+ *******/
}
}
}
(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 *
+ *******/
}
}
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);
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);
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);
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 */
(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;
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;
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)
//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)
{
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);
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
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,
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);
(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!");
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);
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);
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);
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);
_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,
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.
(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);
#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
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)
{
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
{
}
//
+/***********************************************************************************
+ * 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"