From b3833978c82c7b8445f51af576d7e8869560d426 Mon Sep 17 00:00:00 2001 From: Dave Andreoli Date: Thu, 16 Apr 2015 22:36:22 +0200 Subject: [PATCH] New 1.14 API: edje.text_class_get() and edje.Edje.text_class_get() --- efl/edje/efl.edje.pyx | 23 +++++++++++++++++++++++ efl/edje/efl.edje_object.pxi | 25 +++++++++++++++++++++++++ include/efl.edje.pxd | 2 ++ 3 files changed, 50 insertions(+) diff --git a/efl/edje/efl.edje.pyx b/efl/edje/efl.edje.pyx index 310acdb..b9201c6 100644 --- a/efl/edje/efl.edje.pyx +++ b/efl/edje/efl.edje.pyx @@ -206,6 +206,29 @@ def text_class_set(text_class, font, int size): size) +def text_class_get(text_class): + """ Get the font and the font size from Edje text class. + + This function gets the font and the font name from the specified Edje + text class. + + :param string text_class: The text class name to query + + :return: The font name and the font size + :rtype: (font_name, font_size) + + .. versionadded:: 1.14 + + """ + cdef: + const char *font + int size + if isinstance(text_class, unicode): text_class = PyUnicode_AsUTF8String(text_class) + edje_text_class_get( + text_class if text_class is not None else NULL, + &font, &size) + return (_ctouni(font), size) + def text_class_del(text_class): if isinstance(text_class, unicode): text_class = PyUnicode_AsUTF8String(text_class) edje_text_class_del( diff --git a/efl/edje/efl.edje_object.pxi b/efl/edje/efl.edje_object.pxi index 41bc3be..0c54f1d 100644 --- a/efl/edje/efl.edje_object.pxi +++ b/efl/edje/efl.edje_object.pxi @@ -347,6 +347,31 @@ cdef class Edje(Object): font if font is not None else NULL, size) + def text_class_get(self, text_class): + """ Gets font and font size from edje text class. + + This function gets the font and the font size from the object + text class. + + :param string text_class: The text class name to query + + :return: The font name and the font size + :rtype: (font_name, font_size) + + .. versionadded:: 1.14 + + """ + cdef: + const char *font + int size + if isinstance(text_class, unicode): + text_class = PyUnicode_AsUTF8String(text_class) + edje_object_text_class_get(self.obj, + text_class if text_class is not None else NULL, + &font, &size) + return (_ctouni(font), size) + + property scale: """The scaling factor for a given Edje object. diff --git a/include/efl.edje.pxd b/include/efl.edje.pxd index ba1309f..4de9e08 100644 --- a/include/efl.edje.pxd +++ b/include/efl.edje.pxd @@ -321,6 +321,7 @@ cdef extern from "Edje.h": Eina_List * edje_color_class_list() void edje_text_class_set(char *text_class, char *font, Evas_Font_Size size) + Eina_Bool edje_text_class_get(const char *text_class, const char **font, Evas_Font_Size *size) void edje_text_class_del(char *text_class) Eina_List * edje_text_class_list() @@ -369,6 +370,7 @@ cdef extern from "Edje.h": void edje_object_color_class_get(Evas_Object *obj, char *color_class, int *r, int *g, int *b, int *a, int *r2, int *g2, int *b2, int *a2, int *r3, int *g3, int *b3, int *a3) void edje_object_color_class_del(Evas_Object *obj, char *color_class) void edje_object_text_class_set(Evas_Object *obj, char *text_class, char *font, Evas_Font_Size size) + Eina_Bool edje_object_text_class_get(Evas_Object *obj, const char *text_class, const char **font, Evas_Font_Size *size) void edje_object_size_min_get(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh) void edje_object_size_max_get(Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh)