From 9f9032befa7f99dee97b7b6658bf3c7cce675804 Mon Sep 17 00:00:00 2001 From: Vitalii Vorobiov Date: Wed, 24 Feb 2016 13:50:36 +0000 Subject: [PATCH] Edje_Edit: support image border_scale and border_scale_by setters and getters --- src/lib/edje/Edje_Edit.h | 72 ++++++++++++++++++++++++++++++++++++++++ src/lib/edje/edje_edit.c | 67 +++++++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index 34902602eb..3de71a21ca 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -5717,6 +5717,78 @@ EAPI void edje_edit_state_image_border_get(Evas_Object *obj, const char *part, c */ EAPI 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); +/** Get the border scale value of a part state. + * + * This value tells Edje if the border should be scaled by + * the object/global edje scale factors + * + * @param obj Object being edited. + * @param part Part that contain state. + * @param state The name of the state to get the image border scale (not + * including the state value). + * @param value The state value. + * + * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise. + * + * @since 1.18 + */ +EAPI Eina_Bool +edje_edit_state_image_border_scale_get(Evas_Object *obj, const char *part, const char *state, double value); + +/** Set the border scale value of a part state. + * + * This value tells Edje if the border should be scaled by + * the object/global edje scale factors + * + * @param obj Object being edited. + * @param part Part that contain state. + * @param state The name of the state to set the image border scale (not + * including the state value). + * @param value The state value. + * @param scale New image border scale value. + * + * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise. + * + * @since 1.18 + */ +EAPI Eina_Bool +edje_edit_state_image_border_scale_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool scale); + +/** Get the border scale by value of a part state. + * + * Valid values are: 0.0 or bigger (0.0 or 1.0 to turn it off) + * + * @param obj Object being edited. + * @param part Part that contain state. + * @param state The name of the state to get the image border scale by (not + * including the state value). + * @param value The state value. + * + * @return border scaling value. + * + * @since 1.18 + */ +EAPI double +edje_edit_state_image_border_scale_by_get(Evas_Object *obj, const char *part, const char *state, double value); + +/** Set the border scale by value of a part state. + * + * Valid values are: 0.0 or bigger (0.0 or 1.0 to turn it off) + * + * @param obj Object being edited. + * @param part Part that contain state. + * @param state The name of the state to set the image border scale by (not + * including the state value). + * @param value The state value. + * @param scale New image border scale value. + * + * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise. + * + * @since 1.18 + */ +EAPI Eina_Bool +edje_edit_state_image_border_scale_by_set(Evas_Object *obj, const char *part, const char *state, double value, double scale); + /** Get if the image center should be draw. * * 1 or 2 means to draw the center, 0 to don't draw it. diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 3e58451f68..9c0a49525f 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -9211,6 +9211,73 @@ edje_edit_state_image_border_set(Evas_Object *obj, const char *part, const char return EINA_TRUE; } +EAPI Eina_Bool +edje_edit_state_image_border_scale_get(Evas_Object *obj, const char *part, const char *state, double value) +{ + Edje_Part_Description_Image *img; + + GET_PD_OR_RETURN(EINA_FALSE); + + if (rp->part->type != EDJE_PART_TYPE_IMAGE) + return EINA_FALSE; + + img = (Edje_Part_Description_Image *)pd; + + return img->image.border.scale; +} + +EAPI Eina_Bool +edje_edit_state_image_border_scale_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool scale) +{ + Edje_Part_Description_Image *img; + + GET_PD_OR_RETURN(EINA_FALSE); + + if (rp->part->type != EDJE_PART_TYPE_IMAGE) + return EINA_FALSE; + + img = (Edje_Part_Description_Image *)pd; + + img->image.border.scale = scale; + + return EINA_TRUE; +} + +EAPI double +edje_edit_state_image_border_scale_by_get(Evas_Object *obj, const char *part, const char *state, double value) +{ + Edje_Part_Description_Image *img; + + GET_PD_OR_RETURN(EINA_FALSE); + + if (rp->part->type != EDJE_PART_TYPE_IMAGE) + return EINA_FALSE; + + img = (Edje_Part_Description_Image *)pd; + + return TO_DOUBLE(img->image.border.scale_by); +} + +EAPI Eina_Bool +edje_edit_state_image_border_scale_by_set(Evas_Object *obj, const char *part, const char *state, double value, double border_scale) +{ + Edje_Part_Description_Image *img; + + GET_PD_OR_RETURN(EINA_FALSE); + + if (border_scale < 0.0) + return EINA_FALSE; + + if (rp->part->type != EDJE_PART_TYPE_IMAGE) + return EINA_FALSE; + + img = (Edje_Part_Description_Image *)pd; + + img->image.border.scale_by = FROM_DOUBLE(border_scale); + + return EINA_TRUE; +} + EAPI unsigned char edje_edit_state_image_border_fill_get(Evas_Object *obj, const char *part, const char *state, double value) {