From: Vitalii Vorobiov Date: Wed, 27 Apr 2016 12:42:12 +0000 (+0300) Subject: Edje_Edit: setters and getters for set's image size (min and max) X-Git-Tag: accepted/tizen/common/20160804.174451~49 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F44%2F82044%2F2;p=platform%2Fupstream%2Fefl.git Edje_Edit: setters and getters for set's image size (min and max) Functions are: edje_edit_image_set_image_min_get edje_edit_image_set_image_min_set edje_edit_image_set_image_max_get edje_edit_image_set_image_max_set Change-Id: Ib378f0fdce6e3ffc99dd5059411752847c40b090 --- diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index c96470f..c982a74 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -5340,6 +5340,66 @@ edje_edit_image_set_image_add(Evas_Object *obj, const char *set_name, const char EAPI Eina_Bool edje_edit_image_set_image_del(Evas_Object *obj, const char *set_name, unsigned int place); +/** Get min size of set's image. + * + * @param obj Object being edited. + * @param set_name name of image set. + * @param place position of image. + * @param w Where to store the width min value. + * @param h Where to store the height min value. + * + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. + * + * @since 1.18 + */ +EAPI Eina_Bool +edje_edit_image_set_image_min_get(Evas_Object *obj, const char *set_name, unsigned int place, int *w, int *h); + +/** Set min size of set's image. + * + * @param obj Object being edited. + * @param set_name name of image set. + * @param place position of image. + * @param w New value of picture's min width. + * @param h New value of picture's min height. + * + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. + * + * @since 1.18 + */ +EAPI Eina_Bool +edje_edit_image_set_image_min_set(Evas_Object *obj, const char *set_name, unsigned int place, int w, int h); + +/** Get max size of set's image. + * + * @param obj Object being edited. + * @param set_name name of image set. + * @param place position of image. + * @param w Where to store the width max value. + * @param h Where to store the height max value. + * + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. + * + * @since 1.18 + */ +EAPI Eina_Bool +edje_edit_image_set_image_max_get(Evas_Object *obj, const char *set_name, unsigned int place, int *w, int *h); + +/** Set max size of set's image. + * + * @param obj Object being edited. + * @param set_name name of image set. + * @param place position of image. + * @param w New value of picture's max width. + * @param h New value of picture's max height. + * + * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. + * + * @since 1.18 + */ +EAPI Eina_Bool +edje_edit_image_set_image_max_set(Evas_Object *obj, const char *set_name, unsigned int place, int w, int h); + //@} /******************************************************************************/ /************************** IMAGES API ************************************/ diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index a383493..b313a52 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -8336,6 +8336,55 @@ edje_edit_image_set_image_del(Evas_Object *obj, const char *set_name, unsigned i return EINA_TRUE; } +#define FUNC_IMAGE_SET_API_SIZE(Value) \ + EAPI Eina_Bool \ + edje_edit_image_set_image_##Value##_get(Evas_Object *obj, const char *set_name, unsigned int place, int *w, int *h) \ + { \ + 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 (w) *w = dim->size.Value.w; \ + if (h) *h = dim->size.Value.h; \ + return EINA_TRUE; \ + } \ + EAPI Eina_Bool \ + edje_edit_image_set_image_##Value##_set(Evas_Object *obj, const char *set_name, unsigned int place, int w, int h) \ + { \ + 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; \ + dim->size.Value.w = w; \ + dim->size.Value.h = h; \ + return EINA_TRUE; \ + } + +FUNC_IMAGE_SET_API_SIZE(min); +FUNC_IMAGE_SET_API_SIZE(max); + /****************/ /* IMAGES API */ /****************/