summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVorobiov Vitalii <vi.vorobiov@samsung.com>2013-10-31 11:05:42 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-10-31 11:05:45 +0900
commit3038d41ba1070b3b5c4e682429fbfad4ea4fbea9 (patch)
tree4709320e8730906b43e1123160f511373863c697 /src
parent2ae3f6902bfa8bf6acb99d455736fb7830498b44 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/lib/edje/Edje_Common.h12
-rw-r--r--src/lib/edje/Edje_Edit.h22
-rw-r--r--src/lib/edje/edje_edit.c19
3 files changed, 29 insertions, 24 deletions
diff --git a/src/lib/edje/Edje_Common.h b/src/lib/edje/Edje_Common.h
index 8ae1e5744e..8e72b753f5 100644
--- a/src/lib/edje/Edje_Common.h
+++ b/src/lib/edje/Edje_Common.h
@@ -1211,11 +1211,16 @@ typedef enum _Edje_Part_Type
1211 * @{ 1211 * @{
1212 */ 1212 */
1213 1213
1214typedef enum _Edje_Text_Effect
1215{
1216#define EDJE_TEXT_EFFECT_MASK_BASIC 0xf 1214#define EDJE_TEXT_EFFECT_MASK_BASIC 0xf
1217#define EDJE_TEXT_EFFECT_BASIC_SET(x, s) \ 1215#define EDJE_TEXT_EFFECT_BASIC_SET(x, s) \
1218 do { x = ((x) & ~EDJE_TEXT_EFFECT_MASK_BASIC) | (s); } while (0) 1216 do { x = ((x) & ~EDJE_TEXT_EFFECT_MASK_BASIC) | (s); } while (0)
1217
1218#define EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION (0x7 << 4)
1219#define EDJE_TEXT_EFFECT_SHADOW_DIRECTION_SET(x, s) \
1220 do { x = ((x) & ~EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION) | (s); } while (0)
1221
1222typedef enum _Edje_Text_Effect
1223{
1219 EDJE_TEXT_EFFECT_NONE = 0, 1224 EDJE_TEXT_EFFECT_NONE = 0,
1220 EDJE_TEXT_EFFECT_PLAIN = 1, 1225 EDJE_TEXT_EFFECT_PLAIN = 1,
1221 EDJE_TEXT_EFFECT_OUTLINE = 2, 1226 EDJE_TEXT_EFFECT_OUTLINE = 2,
@@ -1230,9 +1235,6 @@ typedef enum _Edje_Text_Effect
1230 1235
1231 EDJE_TEXT_EFFECT_LAST = 11, 1236 EDJE_TEXT_EFFECT_LAST = 11,
1232 1237
1233#define EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION (0x7 << 4)
1234#define EDJE_TEXT_EFFECT_SHADOW_DIRECTION_SET(x, s) \
1235 do { x = ((x) & ~EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION) | (s); } while (0)
1236 EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_RIGHT = (0x0 << 4), 1238 EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_RIGHT = (0x0 << 4),
1237 EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM = (0x1 << 4), 1239 EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM = (0x1 << 4),
1238 EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_LEFT = (0x2 << 4), 1240 EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_LEFT = (0x2 << 4),
diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h
index efd7055e20..77dfff9d79 100644
--- a/src/lib/edje/Edje_Edit.h
+++ b/src/lib/edje/Edje_Edit.h
@@ -908,12 +908,17 @@ EAPI Eina_Bool edje_edit_part_source_set(Evas_Object *obj, const char *part, con
908EAPI Edje_Text_Effect edje_edit_part_effect_get(Evas_Object *obj, const char *part); 908EAPI Edje_Text_Effect edje_edit_part_effect_get(Evas_Object *obj, const char *part);
909 909
910/** Set the effect for a given part. 910/** Set the effect for a given part.
911 * Effects and shadow directions can be combined.
912 *
913 * For effect and shadow direction list please look at Edje Part Text ref page.
911 * 914 *
912 * @param obj Object being edited. 915 * @param obj Object being edited.
913 * @param part Part to set the effect to. Only makes sense on type TEXT. 916 * @param part Part to set the effect to. Only makes sense on type TEXT.
914 * @param effect Effect to set for the part. 917 * @param effect Effect to set for the part.
918 *
919 * @see Edje_Part_Text
915 */ 920 */
916EAPI void edje_edit_part_effect_set(Evas_Object *obj, const char *part, Edje_Text_Effect effect); 921EAPI Eina_Bool edje_edit_part_effect_set(Evas_Object *obj, const char *part, Edje_Text_Effect effect);
917 922
918/** Get the current selected state in part. 923/** Get the current selected state in part.
919 * 924 *
@@ -2254,8 +2259,10 @@ EAPI const char * edje_edit_state_font_get(Evas_Object *obj, const char *part, c
2254 * @param state State in which the font is set. 2259 * @param state State in which the font is set.
2255 * @param value Value of the state. 2260 * @param value Value of the state.
2256 * @param font The font name to use. 2261 * @param font The font name to use.
2262 *
2263 * @return EINA_TRUE if successful, EINA_FALSE - otherwise.
2257 */ 2264 */
2258EAPI void edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, double value, const char *font); 2265EAPI Eina_Bool edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, double value, const char *font);
2259 2266
2260/** Get the text size of a part state 2267/** Get the text size of a part state
2261 * 2268 *
@@ -2561,17 +2568,6 @@ EAPI const char *edje_edit_font_path_get(Evas_Object *obj, const char *alias);
2561 */ 2568 */
2562EAPI const char * edje_edit_state_font_get(Evas_Object *obj, const char *part, const char *state, double value); 2569EAPI const char * edje_edit_state_font_get(Evas_Object *obj, const char *part, const char *state, double value);
2563 2570
2564/** Set font name for a given part state.
2565 *
2566 * @param obj Object being edited.
2567 * @param part Part that contain state.
2568 * @param state The name of the state to set the name of the font that will be used (not including the state value).
2569 * @param value The state value.
2570 * @param font The name of the font to use in the given part state.
2571 */
2572EAPI void edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, double value, const char *font);
2573
2574
2575//@} 2571//@}
2576/******************************************************************************/ 2572/******************************************************************************/
2577/************************** IMAGES API ************************************/ 2573/************************** IMAGES API ************************************/
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 6cc37b22c4..34dfb45cc2 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -4262,16 +4262,18 @@ edje_edit_state_font_get(Evas_Object *obj, const char *part, const char *state,
4262 return eina_stringshare_add(edje_string_get(&txt->text.font)); 4262 return eina_stringshare_add(edje_string_get(&txt->text.font));
4263} 4263}
4264 4264
4265EAPI void 4265EAPI Eina_Bool
4266edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, double value, const char *font) 4266edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, double value, const char *font)
4267{ 4267{
4268 Edje_Part_Description_Text *txt; 4268 Edje_Part_Description_Text *txt;
4269 4269
4270 GET_PD_OR_RETURN(); 4270 if ((!obj) || (!part) || (!state))
4271 return EINA_FALSE;
4272 GET_PD_OR_RETURN(EINA_FALSE);
4271 4273
4272 if ((rp->part->type != EDJE_PART_TYPE_TEXT) && 4274 if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
4273 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) 4275 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
4274 return; 4276 return EINA_FALSE;
4275 4277
4276 txt = (Edje_Part_Description_Text*) pd; 4278 txt = (Edje_Part_Description_Text*) pd;
4277 4279
@@ -4280,6 +4282,7 @@ edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state,
4280 txt->text.font.id = 0; 4282 txt->text.font.id = 0;
4281 4283
4282 edje_object_calc_force(obj); 4284 edje_object_calc_force(obj);
4285 return EINA_TRUE;
4283} 4286}
4284 4287
4285EAPI Edje_Text_Effect 4288EAPI Edje_Text_Effect
@@ -4291,15 +4294,19 @@ edje_edit_part_effect_get(Evas_Object *obj, const char *part)
4291 return rp->part->effect; 4294 return rp->part->effect;
4292} 4295}
4293 4296
4294EAPI void 4297EAPI Eina_Bool
4295edje_edit_part_effect_set(Evas_Object *obj, const char *part, Edje_Text_Effect effect) 4298edje_edit_part_effect_set(Evas_Object *obj, const char *part, Edje_Text_Effect effect)
4296{ 4299{
4297 GET_RP_OR_RETURN(); 4300 if ((!obj) || (!part)) return EINA_FALSE;
4301 GET_RP_OR_RETURN(EINA_FALSE);
4298 4302
4299 //printf("SET EFFECT of part: %s [%d]\n", part, effect); 4303 if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
4304 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
4305 return EINA_FALSE;
4300 rp->part->effect = effect; 4306 rp->part->effect = effect;
4301 4307
4302 edje_object_calc_force(obj); 4308 edje_object_calc_force(obj);
4309 return EINA_TRUE;
4303} 4310}
4304 4311
4305/****************/ 4312/****************/