forked from enlightenment/efl
sucky - but have to add this api to fix bug in elm.
SVN revision: 70360
This commit is contained in:
parent
d80dae3035
commit
644855da4f
|
@ -406,3 +406,9 @@
|
|||
* Add EDJE_VERSION_12 define so edc files can #ifdef compile
|
||||
right.
|
||||
|
||||
2012-04-20 Carsten Haitzler (The Rasterman)
|
||||
|
||||
* To work through a bug in Elementary, add
|
||||
edje_object_part_text_escaped_set() that converts escapes to
|
||||
plain UTF8 if the part is TEXT.
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ Additions:
|
|||
* edje_object_part_text_user_insert()
|
||||
* double click in entry selects word, triple selects line.
|
||||
* EDJE_VERSION_12 define in edc for #ifdefs handling edje 1.2 (or older)
|
||||
* edje_object_part_text_escaped_set()
|
||||
|
||||
Improvements:
|
||||
* speedup load time of Edje file.
|
||||
|
|
|
@ -2298,6 +2298,19 @@ EAPI void edje_object_text_change_cb_set (Evas_Object *obj, Edje_Te
|
|||
*/
|
||||
EAPI Eina_Bool edje_object_part_text_set (Evas_Object *obj, const char *part, const char *text);
|
||||
|
||||
/**
|
||||
* @brief Sets the text for an object part, but converts HTML escapes to UTF8
|
||||
*
|
||||
* This converts the given string @p text to UTF8 assuming it contains HTML
|
||||
* style escapes like "&" and "©" etc. IF the part is of type TEXT,
|
||||
* as opposed to TEXTBLOCK.
|
||||
*
|
||||
* @param obj A valid Evas Object handle
|
||||
* @param part The part name
|
||||
* @param text The text string
|
||||
*/
|
||||
EAPI Eina_Bool edje_object_part_text_escaped_set (Evas_Object *obj, const char *part, const char *text);
|
||||
|
||||
/**
|
||||
* @brief Return the text of the object part.
|
||||
*
|
||||
|
|
|
@ -1157,6 +1157,75 @@ edje_object_part_text_get(const Evas_Object *obj, const char *part)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
edje_object_part_text_escaped_set(Evas_Object *obj, const char *part, const char *text)
|
||||
{
|
||||
Edje *ed;
|
||||
Edje_Real_Part *rp;
|
||||
|
||||
ed = _edje_fetch(obj);
|
||||
if ((!ed) || (!part)) return EINA_FALSE;
|
||||
rp = _edje_real_part_recursive_get(ed, part);
|
||||
if (!rp) return EINA_FALSE;
|
||||
if ((rp->part->type == EDJE_PART_TYPE_TEXT) && (text))
|
||||
{
|
||||
Eina_Strbuf *sbuf;
|
||||
char *esc_start = NULL, *esc_end = NULL;
|
||||
char *s, *p;
|
||||
Eina_Bool ret;
|
||||
|
||||
sbuf = eina_strbuf_new();
|
||||
p = (char *)text;
|
||||
s = p;
|
||||
for (;;)
|
||||
{
|
||||
if ((*p == 0) || (esc_end) || (esc_start))
|
||||
{
|
||||
if (esc_end)
|
||||
{
|
||||
const char *escape;
|
||||
|
||||
escape = evas_textblock_escape_string_range_get
|
||||
(esc_start, esc_end + 1);
|
||||
if (escape) eina_strbuf_append(sbuf, escape);
|
||||
esc_start = esc_end = NULL;
|
||||
}
|
||||
else if (*p == 0)
|
||||
{
|
||||
eina_strbuf_append_length(sbuf, s, p - s);
|
||||
s = NULL;
|
||||
}
|
||||
if (*p == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (*p == '&')
|
||||
{
|
||||
esc_start = p;
|
||||
esc_end = NULL;
|
||||
eina_strbuf_append_length(sbuf, s, p - s);
|
||||
s = NULL;
|
||||
}
|
||||
else if (*p == ';')
|
||||
{
|
||||
if (esc_start)
|
||||
{
|
||||
esc_end = p;
|
||||
s = p + 1;
|
||||
}
|
||||
}
|
||||
p++;
|
||||
}
|
||||
ret = _edje_object_part_text_raw_set
|
||||
(obj, rp, part, eina_strbuf_string_get(sbuf));
|
||||
eina_strbuf_free(sbuf);
|
||||
return ret;
|
||||
}
|
||||
if (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) return EINA_FALSE;
|
||||
return _edje_object_part_text_raw_set(obj, rp, part, text);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
_edje_text_escape(const char *text)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue