edje: edje_edit - add getters/setters for container padding
authorVyacheslav Reutskiy <v.reutskiy@samsung.com>
Mon, 21 Sep 2015 12:47:27 +0000 (15:47 +0300)
committerVyacheslav Reutskiy <v.reutskiy@samsung.com>
Tue, 22 Sep 2015 06:23:46 +0000 (09:23 +0300)
This functions designed that make the edje edit API's more
homogeneous. The all edje attribute setters and getters
treated only ony attribute, besides container API's.

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

index df3fc05..6026b03 100644 (file)
@@ -2125,12 +2125,41 @@ edje_edit_state_container_min_y_set(Evas_Object *obj, const char *part, const ch
  * @param x Variable to store x padding.
  * @param y Variable to store y padding.
  *
+ * @deprecated Use edje_edit_state_container_padding_x_get() and
+ * edje_edit_state_container_padding_y_get() instead.
+ *
  * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
  * @since 1.14
  */
-EAPI Eina_Bool
+EINA_DEPRECATED EAPI Eina_Bool
 edje_edit_state_container_padding_get(Evas_Object *obj, const char *part, const char *state, double value, int *x, int *y);
 
+/** Get x padding for BOX or TABLE part.
+ *
+ * @param obj Object being edited.
+ * @param part Part that has BOX/TABLE type.
+ * @param state Name of the state.
+ * @param value Value of the state.
+ *
+ * @return The padding by x axis.
+ * @since 1.16
+ */
+EAPI int
+edje_edit_state_container_padding_x_get(Evas_Object *obj, const char *part, const char *state, double value);
+
+/** Get y padding for BOX or TABLE part.
+ *
+ * @param obj Object being edited.
+ * @param part Part that has BOX/TABLE type.
+ * @param state Name of the state.
+ * @param value Value of the state.
+ *
+ * @return The padding by y axis.
+ * @since 1.16
+ */
+EAPI int
+edje_edit_state_container_padding_y_get(Evas_Object *obj, const char *part, const char *state, double value);
+
 /** Set x and y paddings for BOX or TABLE part.
  *
  * @param obj Object being edited.
@@ -2140,12 +2169,43 @@ edje_edit_state_container_padding_get(Evas_Object *obj, const char *part, const
  * @param x Value for setting x padding.
  * @param y Value for setting y padding.
  *
+ * @deprecated Use edje_edit_state_container_padding_x_set() and
+ * edje_edit_state_container_padding_y_set() instead.
+ *
  * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
  * @since 1.14
  */
-EAPI Eina_Bool
+EINA_DEPRECATED EAPI Eina_Bool
 edje_edit_state_container_padding_set(Evas_Object *obj, const char *part, const char *state, double value, int x, int y);
 
+/** Set x padding for BOX or TABLE part.
+ *
+ * @param obj Object being edited.
+ * @param part Part that has BOX/TABLE type.
+ * @param state Name of the state.
+ * @param value Value of the state.
+ * @param x New x padding value.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ * @since 1.16
+ */
+EAPI Eina_Bool
+edje_edit_state_container_padding_x_set(Evas_Object *obj, const char *part, const char *state, double value, int x);
+
+/** Set y padding for BOX or TABLE part.
+ *
+ * @param obj Object being edited.
+ * @param part Part that has BOX/TABLE type.
+ * @param state Name of the state.
+ * @param value Value of the state.
+ * @param y New y padding value.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ * @since 1.16
+ */
+EAPI Eina_Bool
+edje_edit_state_container_padding_y_set(Evas_Object *obj, const char *part, const char *state, double value, int y);
+
 /** Set x and y align for BOX or TABLE part.
  *
  * @param obj Object being edited.
index 0af12a6..3b86aac 100644 (file)
@@ -4362,6 +4362,64 @@ FUNC_CONTAINER_BOOL(min, h)
 
 #undef FUNC_CONTAINER_BOOL
 
+#define FUNC_CONTAINER_INT(CLASS, VALUE) \
+EAPI int \
+edje_edit_state_container_##CLASS##_##VALUE##_get(Evas_Object *obj, const char *part, const char *state, double value) \
+{ \
+   int val; \
+   GET_PD_OR_RETURN(EINA_FALSE) \
+   switch (rp->part->type) \
+     { \
+      case EDJE_PART_TYPE_TABLE: \
+      { \
+         Edje_Part_Description_Table *table; \
+         table = (Edje_Part_Description_Table *)pd; \
+         val = table->table.CLASS.VALUE; \
+         break; \
+      } \
+      case EDJE_PART_TYPE_BOX: \
+      { \
+         Edje_Part_Description_Box *box; \
+         box = (Edje_Part_Description_Box *)pd; \
+         val = box->box.CLASS.VALUE; \
+         break; \
+      } \
+      default: \
+        val = 0; \
+     } \
+   return val; \
+} \
+EAPI Eina_Bool \
+edje_edit_state_container_##CLASS##_##VALUE##_set(Evas_Object *obj, const char *part, const char *state, double value, int new_val) \
+{ \
+   GET_PD_OR_RETURN(EINA_FALSE) \
+   switch (rp->part->type) \
+     { \
+      case EDJE_PART_TYPE_TABLE: \
+      { \
+         Edje_Part_Description_Table *table; \
+         table = (Edje_Part_Description_Table *)pd; \
+         table->table.CLASS.VALUE = new_val; \
+         break; \
+      } \
+      case EDJE_PART_TYPE_BOX: \
+      { \
+         Edje_Part_Description_Box *box; \
+         box = (Edje_Part_Description_Box *)pd; \
+         box->box.CLASS.VALUE = new_val; \
+         break; \
+      } \
+      default: \
+        return EINA_FALSE; \
+     } \
+   return EINA_TRUE; \
+}
+
+FUNC_CONTAINER_INT(padding, x)
+FUNC_CONTAINER_INT(padding, y)
+
+#undef FUNC_CONTAINER_INT
+
 EAPI Eina_Bool
 edje_edit_state_container_align_get(Evas_Object *obj, const char *part, const char *state, double value, double *x, double *y)
 {