summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVorobiov Vitalii <vi.vorobiov@samsung.com>2013-10-30 22:00:11 +0900
committerCedric Bail <cedric.bail@free.fr>2013-10-30 22:30:15 +0900
commitdae7b7349ecf79a41b0e89edc5e501b690119da4 (patch)
tree500bb7aadf4096c13128e790285f623e602326d8 /src
parent5d0e0c3f16c12fa7e26343bae019c6d622871540 (diff)
edje: make setters for "edje_edit_state_image_..." return Eina_Bool.
This patch make the following function return Eina_Bool so the caller can detect errors. edje_edit_state_image_set edje_edit_state_image_border_set edje_edit_state_image_border_fill_set Reviewers: cedric, seoz CC: reutskiy.v.v Differential Revision: https://phab.enlightenment.org/D295 Signed-off-by: Cedric Bail <cedric.bail@free.fr>
Diffstat (limited to 'src')
-rw-r--r--src/lib/edje/Edje_Edit.h24
-rw-r--r--src/lib/edje/edje_edit.c60
2 files changed, 54 insertions, 30 deletions
diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h
index 31ec1a94ad..0b1e5c48ac 100644
--- a/src/lib/edje/Edje_Edit.h
+++ b/src/lib/edje/Edje_Edit.h
@@ -2598,8 +2598,10 @@ EAPI const char * edje_edit_state_image_get(Evas_Object *obj, const char *part,
2598 * @param state The name of the state to set the image that will be used (not including the state value). 2598 * @param state The name of the state to set the image that will be used (not including the state value).
2599 * @param value The state value. 2599 * @param value The state value.
2600 * @param image The name of the image (must be an image contained in the edje file). 2600 * @param image The name of the image (must be an image contained in the edje file).
2601 *
2602 * @return EINA_TRUE if successful, EINA_FALSE - otherwise.
2601 */ 2603 */
2602EAPI void edje_edit_state_image_set(Evas_Object *obj, const char *part, const char *state, double value, const char *image); 2604EAPI Eina_Bool edje_edit_state_image_set(Evas_Object *obj, const char *part, const char *state, double value, const char *image);
2603 2605
2604/** Get image id for a given image name. 2606/** Get image id for a given image name.
2605 * 2607 *
@@ -2659,33 +2661,41 @@ EAPI void edje_edit_state_image_border_get(Evas_Object *obj, const char *part, c
2659 * @param r Right border value (or -1). 2661 * @param r Right border value (or -1).
2660 * @param t Top border value (or -1). 2662 * @param t Top border value (or -1).
2661 * @param b Bottom border value (or -1). 2663 * @param b Bottom border value (or -1).
2664 *
2665 * @return EINA_TRUE if successful, EINA_FALSE - otherwise.
2662 */ 2666 */
2663EAPI void edje_edit_state_image_border_set(Evas_Object *obj, const char *part, const char *state, double value, int l, int r, int t, int b); 2667EAPI Eina_Bool edje_edit_state_image_border_set(Evas_Object *obj, const char *part, const char *state, double value, int l, int r, int t, int b);
2664 2668
2665/** Get if the image center should be draw. 2669/** Get if the image center should be draw.
2666 * 2670 *
2667 * 1 means to draw the center, 0 to don't draw it. 2671 * 1 or 2 means to draw the center, 0 to don't draw it.
2672 * If 1 - then the center will apply alpha channel.
2673 * If 2 (SOLID mode) - then the center of an image wont have alpha channel (Just black color).
2668 * 2674 *
2669 * @param obj Object being edited. 2675 * @param obj Object being edited.
2670 * @param part Part that contain state. 2676 * @param part Part that contain state.
2671 * @param state The name of the state to get the image border fill (not including the state value). 2677 * @param state The name of the state to get the image border fill (not including the state value).
2672 * @param value The state value. 2678 * @param value The state value.
2673 * 2679 *
2674 * @return 1 if the center of the bordered image is draw, 0 otherwise. 2680 * @return 2 if the center of the bordered image is draw without alpha, 1 dawing with alpha and 0 not drawing the center.
2675 */ 2681 */
2676EAPI unsigned char edje_edit_state_image_border_fill_get(Evas_Object *obj, const char *part, const char *state, double value); 2682EAPI unsigned char edje_edit_state_image_border_fill_get(Evas_Object *obj, const char *part, const char *state, double value);
2677 2683
2678/** Set if the image center should be draw. 2684/** Set if the image center should be draw.
2679 * 2685 *
2680 * 1 means to draw the center, 0 to don't draw it. 2686 * 1 or 2 means to draw the center, 0 to don't draw it.
2687 * If 1 - then the center will apply alpha channel.
2688 * If 2 (SOLID mode) - then the center of an image wont have alpha channel (Just black color).
2681 * 2689 *
2682 * @param obj Object being edited. 2690 * @param obj Object being edited.
2683 * @param part Part that contain state. 2691 * @param part Part that contain state.
2684 * @param state The name of the state to set the image border fill (not including the state value). 2692 * @param state The name of the state to set the image border fill (not including the state value).
2685 * @param value The state value. 2693 * @param value The state value.
2686 * @param fill Fill to be se. 1 if the center of the bordered image is draw, 0 otherwise. 2694 * @param fill Fill to be set. 1 or 2 if the center of the bordered image is draw, 0 otherwise.
2695 *
2696 * @return EINA_TRUE if successful, EINA_FALSE - otherwise.
2687 */ 2697 */
2688EAPI void edje_edit_state_image_border_fill_set(Evas_Object *obj, const char *part, const char *state, double value, unsigned char fill); 2698EAPI Eina_Bool edje_edit_state_image_border_fill_set(Evas_Object *obj, const char *part, const char *state, double value, unsigned char fill);
2689 2699
2690/** Get the list of all the tweens images in the given part state. 2700/** Get the list of all the tweens images in the given part state.
2691 * 2701 *
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 384f97e76f..22d3b6db0c 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -4581,27 +4581,30 @@ edje_edit_state_image_get(Evas_Object *obj, const char *part, const char *state,
4581 return eina_stringshare_add(image); 4581 return eina_stringshare_add(image);
4582} 4582}
4583 4583
4584EAPI void 4584EAPI Eina_Bool
4585edje_edit_state_image_set(Evas_Object *obj, const char *part, const char *state, double value, const char *image) 4585edje_edit_state_image_set(Evas_Object *obj, const char *part, const char *state, double value, const char *image)
4586{ 4586{
4587 Edje_Part_Description_Image *img; 4587 Edje_Part_Description_Image *img;
4588 int id; 4588 int id;
4589 4589
4590 GET_PD_OR_RETURN(); 4590 if ((!obj) || (!part) || (!state) || (!image))
4591 return EINA_FALSE;
4591 4592
4592 if (!image) return; 4593 eina_error_set(0);
4594 GET_PD_OR_RETURN(EINA_FALSE);
4593 4595
4594 if (rp->part->type != EDJE_PART_TYPE_IMAGE) 4596 if (rp->part->type != EDJE_PART_TYPE_IMAGE)
4595 return; 4597 return EINA_FALSE;
4596 4598
4597 id = _edje_image_id_find(eed, image); 4599 id = _edje_image_id_find(eed, image);
4598 //printf("SET IMAGE for %s [%s]\n", state, image);
4599 4600
4600 img = (Edje_Part_Description_Image *) pd; 4601 img = (Edje_Part_Description_Image *) pd;
4601 4602
4602 if (id > -1) img->image.id = id; 4603 if (id > -1) img->image.id = id;
4604 else return EINA_FALSE;
4603 4605
4604 edje_object_calc_force(obj); 4606 edje_object_calc_force(obj);
4607 return EINA_TRUE;
4605} 4608}
4606 4609
4607EAPI Eina_List * 4610EAPI Eina_List *
@@ -4727,26 +4730,31 @@ edje_edit_state_image_border_get(Evas_Object *obj, const char *part, const char
4727 if (b) *b = img->image.border.b; 4730 if (b) *b = img->image.border.b;
4728} 4731}
4729 4732
4730EAPI void 4733EAPI Eina_Bool
4731edje_edit_state_image_border_set(Evas_Object *obj, const char *part, const char *state, double value, int l, int r, int t, int b) 4734edje_edit_state_image_border_set(Evas_Object *obj, const char *part, const char *state, double value, int l, int r, int t, int b)
4732{ 4735{
4733 Edje_Part_Description_Image *img; 4736 Edje_Part_Description_Image *img;
4734 4737
4735 GET_PD_OR_RETURN(); 4738 if ((!obj) || (!part) || (!state))
4739 return EINA_FALSE;
4740 if ((l < -1) || (r < -1) || (t < -1) || (b < -1))
4741 return EINA_FALSE;
4742
4743 eina_error_set(0);
4744 GET_PD_OR_RETURN(EINA_FALSE);
4736 4745
4737 if (rp->part->type != EDJE_PART_TYPE_IMAGE) 4746 if (rp->part->type != EDJE_PART_TYPE_IMAGE)
4738 return; 4747 return EINA_FALSE;
4739 4748
4740 img = (Edje_Part_Description_Image *) pd; 4749 img = (Edje_Part_Description_Image *) pd;
4741 4750
4742 //printf("SET IMAGE_BORDER of state '%s'\n", state); 4751 img->image.border.l = l;
4743 4752 img->image.border.r = r;
4744 if (l > -1) img->image.border.l = l; 4753 img->image.border.t = t;
4745 if (r > -1) img->image.border.r = r; 4754 img->image.border.b = b;
4746 if (t > -1) img->image.border.t = t;
4747 if (b > -1) img->image.border.b = b;
4748 4755
4749 edje_object_calc_force(obj); 4756 edje_object_calc_force(obj);
4757 return EINA_TRUE;
4750} 4758}
4751 4759
4752EAPI unsigned char 4760EAPI unsigned char
@@ -4761,29 +4769,35 @@ edje_edit_state_image_border_fill_get(Evas_Object *obj, const char *part, const
4761 4769
4762 img = (Edje_Part_Description_Image *) pd; 4770 img = (Edje_Part_Description_Image *) pd;
4763 4771
4764 if (img->image.border.no_fill == 0) return 1; 4772 if (img->image.border.no_fill == 2) return 2;
4765 else if (img->image.border.no_fill == 1) return 0; 4773 else return !img->image.border.no_fill;
4766 else if (img->image.border.no_fill == 2) return 2; 4774
4767 return 0; 4775 return 0;
4768} 4776}
4769 4777
4770EAPI void 4778EAPI Eina_Bool
4771edje_edit_state_image_border_fill_set(Evas_Object *obj, const char *part, const char *state, double value, unsigned char fill) 4779edje_edit_state_image_border_fill_set(Evas_Object *obj, const char *part, const char *state, double value, unsigned char fill)
4772{ 4780{
4773 Edje_Part_Description_Image *img; 4781 Edje_Part_Description_Image *img;
4774 4782
4775 GET_PD_OR_RETURN(); 4783 if ((!obj) || (!part) || (!state))
4784 return EINA_FALSE;
4785 if ((fill < 0) || (fill > 2))
4786 return EINA_FALSE;
4787
4788 eina_error_set(0);
4789 GET_PD_OR_RETURN(EINA_FALSE);
4776 4790
4777 if (rp->part->type != EDJE_PART_TYPE_IMAGE) 4791 if (rp->part->type != EDJE_PART_TYPE_IMAGE)
4778 return; 4792 return EINA_FALSE;
4779 4793
4780 img = (Edje_Part_Description_Image *) pd; 4794 img = (Edje_Part_Description_Image *) pd;
4781 4795
4782 if (fill == 0) img->image.border.no_fill = 1; 4796 if (fill == 2) img->image.border.no_fill = 2;
4783 else if (fill == 1) img->image.border.no_fill = 0; 4797 else img->image.border.no_fill = !fill;
4784 else if (fill == 2) img->image.border.no_fill = 2;
4785 4798
4786 edje_object_calc_force(obj); 4799 edje_object_calc_force(obj);
4800 return EINA_TRUE;
4787} 4801}
4788 4802
4789/******************/ 4803/******************/