Edje_Edit: setters and getters for set's image size (min and max) 44/82044/2
authorVitalii Vorobiov <vi.vorobiov@samsung.com>
Wed, 27 Apr 2016 12:42:12 +0000 (15:42 +0300)
committerJaehwan Kim <jae.hwan.kim@samsung.com>
Wed, 3 Aug 2016 09:18:16 +0000 (02:18 -0700)
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

src/lib/edje/Edje_Edit.h
src/lib/edje/edje_edit.c

index c96470f..c982a74 100644 (file)
@@ -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   ************************************/
index a383493..b313a52 100644 (file)
@@ -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  */
 /****************/