edje: add text_class_get() APIs
authorSohyun Kim <anna1014.kim@samsung.com>
Wed, 25 Mar 2015 17:45:59 +0000 (02:45 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Wed, 25 Mar 2015 17:53:22 +0000 (02:53 +0900)
Summary: No APIs to get text_class for global hash and object hash

Reviewers: woohyun, cedric, raster

Reviewed By: cedric, raster

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2213

src/lib/edje/Edje_Common.h
src/lib/edje/edje_object.eo
src/lib/edje/edje_private.h
src/lib/edje/edje_util.c

index 2613c58..a95df33 100644 (file)
@@ -1632,6 +1632,24 @@ typedef enum _Edje_Object_Table_Homogeneous_Mode
 EAPI Eina_Bool    edje_text_class_set             (const char *text_class, const char *font, Evas_Font_Size size);
 
 /**
+ * @brief Get the font and the font size from Edje text class.
+ *
+ * @param text_class The text class name
+ * @param font The font name
+ * @param size The font size
+ *
+ * @return @c EINA_TRUE, on success or @c EINA_FALSE, on error
+ *
+ * This function gets the font and the font name from the specified Edje
+ * text class. The font string will only be valid until the text class is
+ * changed or edje is shut down.
+ * @see edje_text_class_set().
+ *
+ * @since 1.14
+ */
+EAPI Eina_Bool    edje_text_class_get             (const char *text_class, const char **font, Evas_Font_Size *size);
+
+/**
  * @brief Delete the text class.
  *
  * @param text_class The text class name string
index 7e633be..ba8d976 100644 (file)
@@ -2076,6 +2076,22 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File)
             @in Edje_Cursor cur; /*@ The cursor to adjust. */
          }
       }
+      text_class_get @const {
+         /*@
+         @brief Gets font and font size from edje text class.
+
+         @return @c EINA_TRUE, on success or @c EINA_FALSE, on error
+
+         This function gets the font and the font size from the object
+         text class. The font string will only be valid until the text
+         class is changed or the edje object is deleted. */
+         return: bool;
+         params {
+            @in const(char)* text_class; /*@ The text class name */
+            @out const(char)* font; /*@ Font name */
+            @out Evas_Font_Size size; /*@ Font Size */
+         }
+      }
       color_class_set {
          /*@
          @brief Sets the object color class.
index f76b655..cfb5f5a 100644 (file)
@@ -2648,6 +2648,7 @@ void _thaw(Eo *obj, void *_pd, va_list *list);
 void _color_class_set(Eo *obj, void *_pd, va_list *list);
 void _color_class_get(Eo *obj, void *_pd, va_list *list);
 void _text_class_set(Eo *obj, void *_pd, va_list *list);
+void _text_class_get(Eo *obj, void *_pd, va_list *list);
 void _part_exists(Eo *obj, void *_pd, va_list *list);
 void _part_object_get(Eo *obj, void *_pd, va_list *list);
 void _part_geometry_get(Eo *obj, void *_pd, va_list *list);
index 7646d64..8da4e97 100644 (file)
@@ -874,6 +874,30 @@ edje_text_class_set(const char *text_class, const char *font, Evas_Font_Size siz
    return EINA_TRUE;
 }
 
+EAPI Eina_Bool
+edje_text_class_get(const char *text_class, const char **font, Evas_Font_Size *size)
+{
+   Edje_Text_Class *tc;
+
+   if (!text_class) return EINA_FALSE;
+
+   tc = eina_hash_find(_edje_text_class_hash, text_class);
+
+   if (tc)
+     {
+        if (font) *font = tc->font;
+        if (size) *size = tc->size;
+     }
+   else
+     {
+        if (font) *font = NULL;
+        if (size) *size = 0;
+
+        return EINA_FALSE;
+     }
+   return EINA_TRUE;
+}
+
 void
 edje_text_class_del(const char *text_class)
 {
@@ -1001,6 +1025,26 @@ _edje_object_text_class_set(Eo *obj EINA_UNUSED, Edje *ed, const char *text_clas
 }
 
 EOLIAN Eina_Bool
+_edje_object_text_class_get(Eo *obj EINA_UNUSED, Edje *ed, const char *text_class, const char **font, Evas_Font_Size *size)
+{
+   Edje_Text_Class *tc = _edje_text_class_find(ed, text_class);
+
+   if (tc)
+     {
+        if (font) *font = tc->font;
+        if (size) *size = tc->size;
+     }
+   else
+     {
+        if (font) *font = NULL;
+        if (size) *size = 0;
+
+        return EINA_FALSE;
+     }
+   return EINA_TRUE;
+}
+
+EOLIAN Eina_Bool
 _edje_object_part_exists(Eo *obj EINA_UNUSED, Edje *ed, const char *part)
 {
    Edje_Real_Part *rp;