raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=10670094c159b4779e259df0346c3951e67c3bdb

commit 10670094c159b4779e259df0346c3951e67c3bdb
Author: Sohyun Kim <anna1014....@samsung.com>
Date:   Thu Mar 26 02:45:59 2015 +0900

    edje: add text_class_get() APIs
    
    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  | 18 ++++++++++++++++++
 src/lib/edje/edje_object.eo | 16 ++++++++++++++++
 src/lib/edje/edje_private.h |  1 +
 src/lib/edje/edje_util.c    | 44 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 79 insertions(+)

diff --git a/src/lib/edje/Edje_Common.h b/src/lib/edje/Edje_Common.h
index 2613c58..a95df33 100644
--- a/src/lib/edje/Edje_Common.h
+++ b/src/lib/edje/Edje_Common.h
@@ -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
diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo
index 7e633be..ba8d976 100644
--- a/src/lib/edje/edje_object.eo
+++ b/src/lib/edje/edje_object.eo
@@ -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.
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index f76b655..cfb5f5a 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -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);
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c
index 7646d64..8da4e97 100644
--- a/src/lib/edje/edje_util.c
+++ b/src/lib/edje/edje_util.c
@@ -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;

-- 


Reply via email to