EAPI const Evas_Textblock_Style *evas_object_textblock_style_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
/**
+ * Set the objects user style to ts.
+ *
+ * The user style overrides the corresponding elements of the regular style.
+ * This is the proper way to do theme overrides in code.
+ * @param obj the Evas object to set the style to.
+ * @param ts the style to set.
+ * @return Returns no value.
+ * @see evas_object_textblock_style_set
+ * @since 1.2.0
+ */
+EAPI void evas_object_textblock_style_user_set(Evas_Object *obj, Evas_Textblock_Style *ts) EINA_ARG_NONNULL(1);
+
+/**
+ * Return the user style of an object.
+ * @param obj the object to get the style from.
+ * @return the style of the object.
+ * @see evas_object_textblock_style_get
+ * @since 1.2.0
+ */
+EAPI const Evas_Textblock_Style *evas_object_textblock_style_user_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
+
+/**
* @brief Set the "replacement character" to use for the given textblock object.
*
* @param obj The given textblock object.
{
DATA32 magic;
Evas_Textblock_Style *style;
+ Evas_Textblock_Style *style_user;
Evas_Textblock_Cursor *cursor;
Eina_List *cursors;
Evas_Object_Textblock_Node_Text *text_nodes;
/* Start of logical layout creation */
/* setup default base style */
- if ((c->o->style) && (c->o->style->default_tag))
{
- c->fmt = _layout_format_push(c, NULL, NULL);
- _format_fill(c->obj, c->fmt, c->o->style->default_tag);
- _format_finalize(c->obj, c->fmt);
+ Eina_Bool finalize = EINA_FALSE;
+ if ((c->o->style) && (c->o->style->default_tag))
+ {
+ c->fmt = _layout_format_push(c, NULL, NULL);
+ _format_fill(c->obj, c->fmt, c->o->style->default_tag);
+ finalize = EINA_TRUE;
+ }
+
+ if ((c->o->style_user) && (c->o->style_user->default_tag))
+ {
+ if (!c->fmt)
+ {
+ c->fmt = _layout_format_push(c, NULL, NULL);
+ }
+ _format_fill(c->obj, c->fmt, c->o->style_user->default_tag);
+ finalize = EINA_TRUE;
+ }
+
+ if (finalize)
+ _format_finalize(c->obj, c->fmt);
}
if (!c->fmt)
{
}
/* textblock styles */
-EAPI void
-evas_object_textblock_style_set(Evas_Object *obj, Evas_Textblock_Style *ts)
+
+static void
+_textblock_style_generic_set(Evas_Object *obj, Evas_Textblock_Style *ts,
+ Evas_Textblock_Style **obj_ts)
{
TB_HEAD();
- if (ts == o->style) return;
+ if (ts == *obj_ts) return;
if ((ts) && (ts->delete_me)) return;
- if (o->style)
+ if (*obj_ts)
{
Evas_Textblock_Style *old_ts;
if (o->markup_text)
o->markup_text = NULL;
}
- old_ts = o->style;
+ old_ts = *obj_ts;
old_ts->objects = eina_list_remove(old_ts->objects, obj);
if ((old_ts->delete_me) && (!old_ts->objects))
evas_textblock_style_free(old_ts);
{
ts->objects = eina_list_append(ts->objects, obj);
}
- o->style = ts;
+ *obj_ts = ts;
_evas_textblock_invalidate_all(o);
_evas_textblock_changed(o, obj);
}
+EAPI void
+evas_object_textblock_style_set(Evas_Object *obj, Evas_Textblock_Style *ts)
+{
+ TB_HEAD();
+ _textblock_style_generic_set(obj, ts, &(o->style));
+}
+
EAPI const Evas_Textblock_Style *
evas_object_textblock_style_get(const Evas_Object *obj)
{
}
EAPI void
+evas_object_textblock_style_user_set(Evas_Object *obj, Evas_Textblock_Style *ts)
+{
+ TB_HEAD();
+ _textblock_style_generic_set(obj, ts, &(o->style_user));
+}
+
+EAPI const Evas_Textblock_Style *
+evas_object_textblock_style_user_get(const Evas_Object *obj)
+{
+ TB_HEAD_RETURN(NULL);
+ return o->style_user;
+}
+
+EAPI void
evas_object_textblock_replace_char_set(Evas_Object *obj, const char *ch)
{
TB_HEAD();
o->markup_text = NULL;
}
_nodes_clear(obj);
- if (!o->style)
+ if (!o->style && !o->style_user)
{
if (text != o->markup_text)
{
}
}
- match = _style_match_tag(o->style, format, format_len, &replace_len);
+ if (!o->style_user || !(match = _style_match_tag(o->style_user, format,
+ format_len, &replace_len)))
+ {
+ match = _style_match_tag(o->style, format, format_len,
+ &replace_len);
+ }
+
if (match)
{
if (match[0] != '-')