summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVorobiov Vitalii <vi.vorobiov@samsung.com>2013-10-30 21:49:32 +0900
committerCedric Bail <cedric.bail@free.fr>2013-10-30 22:30:15 +0900
commit503cbbe80b432bb368bd16f2af4c63c873d1a610 (patch)
treed1ee627855f6faaccc6f932f015584dfcd9e476f /src
parent26cd65cfcb7605330133effc841baa8fac9e0131 (diff)
edje: make setters for "edje_edit_state_color..." return Eina_Bool.
This patch start returning Eina_Bool for the following color setters to be able to detect errors when calling them. edje_edit_state_color_set edje_edit_state_color2_set edje_edit_state_color3_set Reviewers: cedric, seoz Reviewed By: cedric CC: reutskiy.v.v Differential Revision: https://phab.enlightenment.org/D297 Signed-off-by: Cedric Bail <cedric.bail@free.fr>
Diffstat (limited to 'src')
-rw-r--r--src/lib/edje/Edje_Edit.h12
-rw-r--r--src/lib/edje/edje_edit.c32
2 files changed, 32 insertions, 12 deletions
diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h
index 1c3f24f5ec..18c31b8ae6 100644
--- a/src/lib/edje/Edje_Edit.h
+++ b/src/lib/edje/Edje_Edit.h
@@ -1518,8 +1518,10 @@ EAPI void edje_edit_state_color3_get(Evas_Object *obj, const char *part, const c
1518 * @param g The green value of the color. 1518 * @param g The green value of the color.
1519 * @param b The blue value of the color. 1519 * @param b The blue value of the color.
1520 * @param a The alpha value of the color. 1520 * @param a The alpha value of the color.
1521 *
1522 * @return EINA_TRUE If successfull, EINA_FALSE otherwise.
1521 */ 1523 */
1522EAPI void edje_edit_state_color_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a); 1524EAPI Eina_Bool edje_edit_state_color_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a);
1523 1525
1524/** Set the color2 of a part state. 1526/** Set the color2 of a part state.
1525 * 1527 *
@@ -1531,8 +1533,10 @@ EAPI void edje_edit_state_color_set(Evas_Object *obj, const char *part, const ch
1531 * @param g The green value of the color. 1533 * @param g The green value of the color.
1532 * @param b The blue value of the color. 1534 * @param b The blue value of the color.
1533 * @param a The alpha value of the color. 1535 * @param a The alpha value of the color.
1536 *
1537 * @return EINA_TRUE If successfull, EINA_FALSE otherwise.
1534 */ 1538 */
1535EAPI void edje_edit_state_color2_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a); 1539EAPI Eina_Bool edje_edit_state_color2_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a);
1536 1540
1537/** Set the color3 of a part state. 1541/** Set the color3 of a part state.
1538 * 1542 *
@@ -1544,8 +1548,10 @@ EAPI void edje_edit_state_color2_set(Evas_Object *obj, const char *part, const c
1544 * @param g The green value of the color. 1548 * @param g The green value of the color.
1545 * @param b The blue value of the color. 1549 * @param b The blue value of the color.
1546 * @param a The alpha value of the color. 1550 * @param a The alpha value of the color.
1551 *
1552 * @return EINA_TRUE If successfull, EINA_FALSE otherwise.
1547 */ 1553 */
1548EAPI void edje_edit_state_color3_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a); 1554EAPI Eina_Bool edje_edit_state_color3_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a);
1549 1555
1550/** Get the horizontal align value of a part state. 1556/** Get the horizontal align value of a part state.
1551 * 1557 *
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index e72cf8ebd8..a4fa0dc7d6 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -3269,17 +3269,24 @@ FUNC_STATE_REL(rel2, y);
3269 if (b) *b = pd->Code.b; \ 3269 if (b) *b = pd->Code.b; \
3270 if (a) *a = pd->Code.a; \ 3270 if (a) *a = pd->Code.a; \
3271 } \ 3271 } \
3272 EAPI void \ 3272 EAPI Eina_Bool \
3273 edje_edit_state_##Code##_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a) \ 3273 edje_edit_state_##Code##_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a) \
3274 { \ 3274 { \
3275 GET_PD_OR_RETURN(); \ 3275 if ((!obj) || (!part) || (!state)) \
3276 return EINA_FALSE; \
3277 GET_PD_OR_RETURN(EINA_FALSE); \
3276 \ 3278 \
3277 if (r > -1 && r < 256) pd->Code.r = r; \ 3279 if (r > -1 && r < 256) pd->Code.r = r; \
3278 if (g > -1 && g < 256) pd->Code.g = g; \ 3280 else return EINA_FALSE; \
3279 if (b > -1 && b < 256) pd->Code.b = b; \ 3281 if (g > -1 && g < 256) pd->Code.g = g; \
3280 if (a > -1 && a < 256) pd->Code.a = a; \ 3282 else return EINA_FALSE; \
3283 if (b > -1 && b < 256) pd->Code.b = b; \
3284 else return EINA_FALSE; \
3285 if (a > -1 && a < 256) pd->Code.a = a; \
3286 else return EINA_FALSE; \
3281 \ 3287 \
3282 edje_object_calc_force(obj); \ 3288 edje_object_calc_force(obj); \
3289 return EINA_TRUE; \
3283 } 3290 }
3284 3291
3285FUNC_COLOR(color); 3292FUNC_COLOR(color);
@@ -3310,25 +3317,32 @@ edje_edit_state_color3_get(Evas_Object *obj, const char *part, const char *state
3310 if (a) *a = txt->text.color3.a; 3317 if (a) *a = txt->text.color3.a;
3311} 3318}
3312 3319
3313EAPI void 3320EAPI Eina_Bool
3314edje_edit_state_color3_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a) 3321edje_edit_state_color3_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a)
3315{ 3322{
3316 Edje_Part_Description_Text *txt; 3323 Edje_Part_Description_Text *txt;
3317 3324
3318 GET_PD_OR_RETURN(); 3325 if ((!obj) || (!part) || (!state))
3326 return EINA_FALSE;
3327 GET_PD_OR_RETURN(EINA_FALSE);
3319 3328
3320 if ((rp->part->type != EDJE_PART_TYPE_TEXT) && 3329 if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
3321 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) 3330 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
3322 return; 3331 return EINA_FALSE;
3323 3332
3324 txt = (Edje_Part_Description_Text*) pd; 3333 txt = (Edje_Part_Description_Text*) pd;
3325 3334
3326 if (r > -1 && r < 256) txt->text.color3.r = r; 3335 if (r > -1 && r < 256) txt->text.color3.r = r;
3336 else return EINA_FALSE;
3327 if (g > -1 && g < 256) txt->text.color3.g = g; 3337 if (g > -1 && g < 256) txt->text.color3.g = g;
3338 else return EINA_FALSE;
3328 if (b > -1 && b < 256) txt->text.color3.b = b; 3339 if (b > -1 && b < 256) txt->text.color3.b = b;
3340 else return EINA_FALSE;
3329 if (a > -1 && a < 256) txt->text.color3.a = a; 3341 if (a > -1 && a < 256) txt->text.color3.a = a;
3342 else return EINA_FALSE;
3330 3343
3331 edje_object_calc_force(obj); 3344 edje_object_calc_force(obj);
3345 return EINA_TRUE;
3332} 3346}
3333 3347
3334#define FUNC_STATE_DOUBLE(Class, Value) \ 3348#define FUNC_STATE_DOUBLE(Class, Value) \