From: Vitalii Vorobiov Date: Wed, 27 Apr 2016 13:34:02 +0000 (+0300) Subject: Edje_Edit: setter and getter for set image's scale_by X-Git-Tag: upstream/1.20.0~6568 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a8afffe10584fe5ffc72d3d8c74827c11275a200;p=platform%2Fupstream%2Fefl.git Edje_Edit: setter and getter for set image's scale_by edje_edit_image_set_image_border_scale_set edje_edit_image_set_image_border_scale_get --- diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index 2aafa8a..f5dd78d 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -5724,6 +5724,33 @@ edje_edit_image_set_image_border_get(Evas_Object *obj, const char *set_name, uns EAPI Eina_Bool edje_edit_image_set_image_border_set(Evas_Object *obj, const char *set_name, unsigned int place, int l, int r, int b, int t); +/** Get border scale of set's image. + * + * @param obj Object being edited. + * @param set_name name of image set. + * @param place position of image. + * + * @return @c border scale value on success, @c -1 otherwise. + * + * @since 1.18 + */ +EAPI double +edje_edit_image_set_image_border_scale_get(Evas_Object *obj, const char *set_name, unsigned int place); + +/** Set border scale of set's image. + * + * @param obj Object being edited. + * @param set_name name of image set. + * @param place position of image. + * @param scale_by New border scale. + * + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. + * + * @since 1.18 + */ +EAPI Eina_Bool +edje_edit_image_set_image_border_scale_set(Evas_Object *obj, const char *set_name, unsigned int place, double scale_by); + //@} /******************************************************************************/ /************************** IMAGES API ************************************/ diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 1274087..a5581bf 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -8754,6 +8754,60 @@ edje_edit_image_set_image_border_set(Evas_Object *obj, const char *set_name, uns return EINA_TRUE; } +EAPI double +edje_edit_image_set_image_border_scale_get(Evas_Object *obj, const char *set_name, unsigned int place) +{ + Edje_Image_Directory_Set *de = NULL; + Edje_Image_Directory_Set_Entry *dim = NULL; + unsigned int i; + + GET_ED_OR_RETURN(-1); + + if (!ed->file) return -1; + if (!ed->file->image_dir) return -1; + + for (i = 0; i < ed->file->image_dir->sets_count; ++i) + { + de = ed->file->image_dir->sets + i; + if ((de->name) && (!strcmp(set_name, de->name))) + break; + } + if (i == ed->file->image_dir->sets_count) return -1; + + dim = eina_list_nth(de->entries, place); + if (!dim) return -1; + + return dim->border.scale_by; +} + +EAPI Eina_Bool +edje_edit_image_set_image_border_scale_set(Evas_Object *obj, const char *set_name, unsigned int place, double scale_by) +{ + Edje_Image_Directory_Set *de = NULL; + Edje_Image_Directory_Set_Entry *dim = NULL; + unsigned int i; + + GET_ED_OR_RETURN(EINA_FALSE); + + if (!ed->file) return EINA_FALSE; + if (!ed->file->image_dir) return EINA_FALSE; + + for (i = 0; i < ed->file->image_dir->sets_count; ++i) + { + de = ed->file->image_dir->sets + i; + if ((de->name) && (!strcmp(set_name, de->name))) + break; + } + if (i == ed->file->image_dir->sets_count) return EINA_FALSE; + + dim = eina_list_nth(de->entries, place); + if (!dim) return EINA_FALSE; + + if (scale_by >= 0) dim->border.scale_by = scale_by; + + return EINA_TRUE; +} + /****************/ /* IMAGES API */ /****************/