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
This commit is contained in:
Vitalii Vorobiov 2016-04-27 15:42:12 +03:00
parent 49f6baa7aa
commit 4589816309
2 changed files with 109 additions and 0 deletions

View File

@ -5630,6 +5630,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 ************************************/

View File

@ -8643,6 +8643,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 */
/****************/