edje: make functions return Eina_Bool and fix documentation.

Make the following functions return Eina_Bool so the caller can detect errors:
edje_edit_state_font_set
edje_edit_part_effect_set

Also deleted duplicate of the "edje_edit_state_font_set" function in Edje_Edit.h
Moved some defines (EDJE_TEXT_EFFECT_MASK_BASIC, EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION etc),
so doxygen generation was fixed.
Also added link (see also) in "edje_edit_part_effect_set" to the Edje_Text_Effect enum.

Reviewers: cedric, seoz

CC: reutskiy.v.v

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

Signed-off-by: Cedric Bail <cedric.bail@samsung.com>
This commit is contained in:
Vorobiov Vitalii 2013-10-31 11:05:42 +09:00 committed by Cedric Bail
parent 2ae3f6902b
commit 3038d41ba1
3 changed files with 29 additions and 24 deletions

View File

@ -1211,11 +1211,16 @@ typedef enum _Edje_Part_Type
* @{ * @{
*/ */
typedef enum _Edje_Text_Effect
{
#define EDJE_TEXT_EFFECT_MASK_BASIC 0xf #define EDJE_TEXT_EFFECT_MASK_BASIC 0xf
#define EDJE_TEXT_EFFECT_BASIC_SET(x, s) \ #define EDJE_TEXT_EFFECT_BASIC_SET(x, s) \
do { x = ((x) & ~EDJE_TEXT_EFFECT_MASK_BASIC) | (s); } while (0) do { x = ((x) & ~EDJE_TEXT_EFFECT_MASK_BASIC) | (s); } while (0)
#define EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION (0x7 << 4)
#define EDJE_TEXT_EFFECT_SHADOW_DIRECTION_SET(x, s) \
do { x = ((x) & ~EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION) | (s); } while (0)
typedef enum _Edje_Text_Effect
{
EDJE_TEXT_EFFECT_NONE = 0, EDJE_TEXT_EFFECT_NONE = 0,
EDJE_TEXT_EFFECT_PLAIN = 1, EDJE_TEXT_EFFECT_PLAIN = 1,
EDJE_TEXT_EFFECT_OUTLINE = 2, EDJE_TEXT_EFFECT_OUTLINE = 2,
@ -1230,9 +1235,6 @@ typedef enum _Edje_Text_Effect
EDJE_TEXT_EFFECT_LAST = 11, EDJE_TEXT_EFFECT_LAST = 11,
#define EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION (0x7 << 4)
#define EDJE_TEXT_EFFECT_SHADOW_DIRECTION_SET(x, s) \
do { x = ((x) & ~EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION) | (s); } while (0)
EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_RIGHT = (0x0 << 4), EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_RIGHT = (0x0 << 4),
EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM = (0x1 << 4), EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM = (0x1 << 4),
EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_LEFT = (0x2 << 4), EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_LEFT = (0x2 << 4),

View File

@ -908,12 +908,17 @@ EAPI Eina_Bool edje_edit_part_source_set(Evas_Object *obj, const char *part, con
EAPI Edje_Text_Effect edje_edit_part_effect_get(Evas_Object *obj, const char *part); EAPI Edje_Text_Effect edje_edit_part_effect_get(Evas_Object *obj, const char *part);
/** Set the effect for a given part. /** Set the effect for a given part.
* Effects and shadow directions can be combined.
*
* For effect and shadow direction list please look at Edje Part Text ref page.
* *
* @param obj Object being edited. * @param obj Object being edited.
* @param part Part to set the effect to. Only makes sense on type TEXT. * @param part Part to set the effect to. Only makes sense on type TEXT.
* @param effect Effect to set for the part. * @param effect Effect to set for the part.
*
* @see Edje_Part_Text
*/ */
EAPI void edje_edit_part_effect_set(Evas_Object *obj, const char *part, Edje_Text_Effect effect); EAPI Eina_Bool edje_edit_part_effect_set(Evas_Object *obj, const char *part, Edje_Text_Effect effect);
/** Get the current selected state in part. /** Get the current selected state in part.
* *
@ -2254,8 +2259,10 @@ EAPI const char * edje_edit_state_font_get(Evas_Object *obj, const char *part, c
* @param state State in which the font is set. * @param state State in which the font is set.
* @param value Value of the state. * @param value Value of the state.
* @param font The font name to use. * @param font The font name to use.
*
* @return EINA_TRUE if successful, EINA_FALSE - otherwise.
*/ */
EAPI void edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, double value, const char *font); EAPI Eina_Bool edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, double value, const char *font);
/** Get the text size of a part state /** Get the text size of a part state
* *
@ -2561,17 +2568,6 @@ EAPI const char *edje_edit_font_path_get(Evas_Object *obj, const char *alias);
*/ */
EAPI const char * edje_edit_state_font_get(Evas_Object *obj, const char *part, const char *state, double value); EAPI const char * edje_edit_state_font_get(Evas_Object *obj, const char *part, const char *state, double value);
/** Set font name for a given part state.
*
* @param obj Object being edited.
* @param part Part that contain state.
* @param state The name of the state to set the name of the font that will be used (not including the state value).
* @param value The state value.
* @param font The name of the font to use in the given part state.
*/
EAPI void edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, double value, const char *font);
//@} //@}
/******************************************************************************/ /******************************************************************************/
/************************** IMAGES API ************************************/ /************************** IMAGES API ************************************/

View File

@ -4262,16 +4262,18 @@ edje_edit_state_font_get(Evas_Object *obj, const char *part, const char *state,
return eina_stringshare_add(edje_string_get(&txt->text.font)); return eina_stringshare_add(edje_string_get(&txt->text.font));
} }
EAPI void EAPI Eina_Bool
edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, double value, const char *font) edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, double value, const char *font)
{ {
Edje_Part_Description_Text *txt; Edje_Part_Description_Text *txt;
GET_PD_OR_RETURN(); if ((!obj) || (!part) || (!state))
return EINA_FALSE;
GET_PD_OR_RETURN(EINA_FALSE);
if ((rp->part->type != EDJE_PART_TYPE_TEXT) && if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
return; return EINA_FALSE;
txt = (Edje_Part_Description_Text*) pd; txt = (Edje_Part_Description_Text*) pd;
@ -4280,6 +4282,7 @@ edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state,
txt->text.font.id = 0; txt->text.font.id = 0;
edje_object_calc_force(obj); edje_object_calc_force(obj);
return EINA_TRUE;
} }
EAPI Edje_Text_Effect EAPI Edje_Text_Effect
@ -4291,15 +4294,19 @@ edje_edit_part_effect_get(Evas_Object *obj, const char *part)
return rp->part->effect; return rp->part->effect;
} }
EAPI void EAPI Eina_Bool
edje_edit_part_effect_set(Evas_Object *obj, const char *part, Edje_Text_Effect effect) edje_edit_part_effect_set(Evas_Object *obj, const char *part, Edje_Text_Effect effect)
{ {
GET_RP_OR_RETURN(); if ((!obj) || (!part)) return EINA_FALSE;
GET_RP_OR_RETURN(EINA_FALSE);
//printf("SET EFFECT of part: %s [%d]\n", part, effect); if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
return EINA_FALSE;
rp->part->effect = effect; rp->part->effect = effect;
edje_object_calc_force(obj); edje_object_calc_force(obj);
return EINA_TRUE;
} }
/****************/ /****************/