edje: Edje_Edit - edje_edit_state_text_class_xet()
authorIgor Gala <i.gala@samsung.com>
Tue, 10 Jun 2014 15:12:57 +0000 (17:12 +0200)
committerCedric BAIL <c.bail@partner.samsung.com>
Tue, 10 Jun 2014 15:39:44 +0000 (17:39 +0200)
Summary:
There are new 'get and set' API for block 'text_class'. Those function
return or set the name of text class which would be used similar to color_class,
this is the name used by the application to alter the font family and size at runtime.
@feature

Reviewers: seoz, Hermet, cedric, raster

CC: reutskiy.v.v, cedric
Differential Revision: https://phab.enlightenment.org/D989

Signed-off-by: Cedric BAIL <c.bail@partner.samsung.com>
src/lib/edje/Edje_Edit.h
src/lib/edje/edje_edit.c

index 4398fbe..3b59ec6 100644 (file)
@@ -3069,6 +3069,31 @@ edje_edit_state_text_source_get(Evas_Object *obj, const char *part, const char *
 EAPI Eina_Bool
 edje_edit_state_text_source_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source);
 
+/** Get the text class of the given part state.
+ *
+ * @param obj Object being edited.
+ * @param part Part that contain state.
+ * @param state The name of the state to get text class (not including the state value).
+ * @param value The state value.
+ *
+ * @return The current text class.
+ */
+EAPI const char *
+edje_edit_state_text_class_get(Evas_Object *obj, const char *part, const char *state, double value);
+
+/** Set the text class of the given part state.
+ *
+ * @param obj Object being edited.
+ * @param part Part that contain state.
+ * @param state The name of the state to set text class (not including the state value).
+ * @param value The state value.
+ * @param color_class The text class to assign.
+ *
+ * @return EINA_TRUE if successful, EINA_FALSE otherwise.
+ */
+EAPI Eina_Bool
+edje_edit_state_text_class_set(Evas_Object *obj, const char *part, const char *state, double value, const char *text_class);
+
 /** Get the list of all the fonts in the given edje.
  *
  * Use edje_edit_string_list_free() when you don't need the list anymore.
index 38f1c60..a2ebcf8 100644 (file)
@@ -4753,7 +4753,6 @@ EAPI Eina_Bool
 edje_edit_state_text_set(Evas_Object *obj, const char *part, const char *state, double value, const char *text)
 {
    Edje_Part_Description_Text *txt;
-
    if ((!obj) || (!part) || (!state) || (!text))
      return EINA_FALSE;
    GET_PD_OR_RETURN(EINA_FALSE);
@@ -5210,6 +5209,36 @@ edje_edit_state_text_source_set(Evas_Object *obj, const char *part, const char *
    return EINA_TRUE;
 }
 
+EAPI const char*
+edje_edit_state_text_class_get(Evas_Object *obj, const char *part, const char *state, double value)
+{
+   Edje_Part_Description_Text *txt;
+   GET_PD_OR_RETURN(NULL);
+
+   if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
+       (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
+     return NULL;
+   txt = (Edje_Part_Description_Text *) pd;
+
+   return eina_stringshare_add(txt->text.text_class);
+}
+
+EAPI Eina_Bool
+edje_edit_state_text_class_set(Evas_Object *obj, const char *part, const char *state, double value, const char *text_class)
+{
+   Edje_Part_Description_Text *txt;
+   if (!text_class) return EINA_FALSE;
+   GET_PD_OR_RETURN(EINA_FALSE);
+
+   if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
+       (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
+     return EINA_FALSE;
+   txt = (Edje_Part_Description_Text *) pd;
+
+   txt->text.text_class = (char *) eina_stringshare_add(text_class);
+   return EINA_TRUE;
+}
+
 /****************/
 /*  IMAGES API  */
 /****************/