edje: Edje_Edit - add edje_edit_part_item_weight functions.
authorVorobiov Vitalii <vi.vorobiov@samsung.com>
Mon, 7 Jul 2014 13:23:50 +0000 (15:23 +0200)
committerCedric BAIL <c.bail@partner.samsung.com>
Mon, 7 Jul 2014 13:51:12 +0000 (15:51 +0200)
Summary:
Add four main functions to deal with TABLE or BOX items:
- edje_edit_part_item_weight_x_get
- edje_edit_part_item_weight_x_set
- edje_edit_part_item_weight_y_get
- edje_edit_part_item_weight_y_set

@feature

Reviewers: cedric, raster, seoz, Hermet

CC: reutskiy.v.v, cedric
Differential Revision: https://phab.enlightenment.org/D1131

Signed-off-by: Cedric BAIL <c.bail@partner.samsung.com>
src/lib/edje/Edje_Edit.h
src/lib/edje/edje_edit.c

index 7868ca5..cd35c4f 100644 (file)
@@ -2114,6 +2114,52 @@ EAPI double edje_edit_part_item_align_y_get(Evas_Object *obj, const char *part,
  */
 EAPI Eina_Bool edje_edit_part_item_align_y_set(Evas_Object *obj, const char *part, const char *item, double align_y);
 
+/** Get the horizontal weight value of a part item.
+ *
+ * @param obj Object being edited.
+ * @param part Part that contain item.
+ * @param item The name of the item to get horizontal weight value.
+ *
+ * @return The horizontal weight value for the given item (value is between -1.0 and 1.0)
+ * @since 1.11
+ */
+EAPI double edje_edit_part_item_weight_x_get(Evas_Object *obj, const char *part, const char *item);
+
+/** Set the horizontal we value of a part item.
+ *
+ * @param obj Object being edited.
+ * @param part Part that contain itemf
+ * @param item The name of the item to set horizontal weight value.
+ * @param weight_x New value of the horizontal weight.
+ *
+ * @return @c EINA_TRUE If successfull, @c EINA_FALSE otherwise.
+ * @since 1.11
+ */
+EAPI Eina_Bool edje_edit_part_item_weight_x_set(Evas_Object *obj, const char *part, const char *item, double weight_x);
+
+/** Get the vertical weight value of a part item.
+ *
+ * @param obj Object being edited.
+ * @param part Part that contain item.
+ * @param item The name of the item to get vertical weight value.
+ *
+ * @return The vertical weight value for the given item (value is between -1.0 and 1.0)
+ * @since 1.11
+ */
+EAPI double edje_edit_part_item_weight_y_get(Evas_Object *obj, const char *part, const char *item);
+
+/** Set the vertical weight value of a part item.
+ *
+ * @param obj Object being edited.
+ * @param part Part that contain item.
+ * @param item The name of the item to set vertical weight value.
+ * @param weight_y New value of the vertical weight.
+ *
+ * @return @c EINA_TRUE If successfull, @c EINA_FALSE otherwise.
+ * @since 1.11
+ */
+EAPI Eina_Bool edje_edit_part_item_weight_y_set(Evas_Object *obj, const char *part, const char *item, double weight_y);
+
 /** Get column/row position of the part's item.
  *
  * @param obj Object being edited.
index 91947bc..6924b91 100644 (file)
@@ -4372,7 +4372,7 @@ edje_edit_part_item_padding_set(Evas_Object *obj, const char *part, const char *
    return EINA_TRUE;
 }
 
-#define FUNC_PART_ITEM_DOUBLE(Name, Value)                             \
+#define FUNC_PART_ITEM_DOUBLE(Name, Value, Min, Max)                   \
   EAPI double                                                          \
   edje_edit_part_item_##Name##_get(Evas_Object *obj, const char *part, const char *item_name) \
   {                                                                    \
@@ -4402,7 +4402,7 @@ edje_edit_part_item_padding_set(Evas_Object *obj, const char *part, const char *
      Edje_Pack_Element *item = NULL;                                   \
      if ((!obj) || (!part) || (!item_name))                            \
        return EINA_FALSE;                                              \
-     if ((v < -1.0) || (v > 1.0))                                      \
+     if ((v < Min) || (v > Max))                                       \
        return EINA_FALSE;                                              \
      GET_RP_OR_RETURN(EINA_FALSE);                                     \
      ep = rp->part;                                                    \
@@ -4422,8 +4422,10 @@ edje_edit_part_item_padding_set(Evas_Object *obj, const char *part, const char *
      return EINA_TRUE;                                                  \
   }
 
-FUNC_PART_ITEM_DOUBLE(align_x, align.x);
-FUNC_PART_ITEM_DOUBLE(align_y, align.y);
+FUNC_PART_ITEM_DOUBLE(align_x, align.x, -1.0, 1.0);
+FUNC_PART_ITEM_DOUBLE(align_y, align.y, -1.0, 1.0);
+FUNC_PART_ITEM_DOUBLE(weight_x, weight.x, 0.0, 99999.990);
+FUNC_PART_ITEM_DOUBLE(weight_y, weight.y, 0.0, 99999.990);
 
 #undef FUNC_PART_ITEM_DOUBLE