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
This commit is contained in:
Sohyun Kim 2015-03-26 02:45:59 +09:00 committed by Carsten Haitzler (Rasterman)
parent ea5375f4a2
commit 10670094c1
4 changed files with 79 additions and 0 deletions

View File

@ -1631,6 +1631,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.
*

View 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.

View 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);

View 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)
{
@ -1000,6 +1024,26 @@ _edje_object_text_class_set(Eo *obj EINA_UNUSED, Edje *ed, const char *text_clas
return EINA_TRUE;
}
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)
{