edje: edje_edit - add getters/setters for min container size
authorVyacheslav Reutskiy <v.reutskiy@samsung.com>
Mon, 21 Sep 2015 07:25:24 +0000 (10:25 +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.

TODO:
 * separate edje_edit_state_container_padding_get/set
 * separate edje_edit_state_container_align_set/set
 * separate edje_edit_part_item_position_get/set
 * separate edje_edit_part_item_span_get/set

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

index 5492881..df3fc05 100644 (file)
@@ -2025,11 +2025,45 @@ EAPI unsigned char edje_edit_state_table_homogeneous_get(Evas_Object *obj, const
  * @param h Variable to store horizontal min value.
  * @param v Variable to store vertical min value.
  *
+ * @deprecated Use edje_edit_state_container_min_x_get() and
+ * edje_edit_state_container_min_y_get() instead.
+ *
  * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
  * @since 1.14
  */
+EINA_DEPRECATED
 EAPI Eina_Bool edje_edit_state_container_min_get(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool *h, Eina_Bool *v);
 
+/** Get whether horizontal min size of the container is equal to the min
+ * horizontal size of items (BOX and TABLE part functions).
+ *
+ * @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 @c EINA_TRUE If the part forces container's minimal horizontal size,
+ *         @c EINA_FALSE otherwise.
+ * @since 1.16
+ */
+EAPI Eina_Bool
+edje_edit_state_container_min_x_get(Evas_Object *obj, const char *part, const char *state, double value);
+
+/** Get whether vertical min size of the container is equal to the min vertical
+ * size of items (BOX and TABLE part functions).
+ *
+ * @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 @c EINA_TRUE If the part forces container's minimal horizontal size,
+ *         @c EINA_FALSE otherwise.
+ * @since 1.16
+ */
+EAPI Eina_Bool
+edje_edit_state_container_min_y_get(Evas_Object *obj, const char *part, const char *state, double value);
+
 /** Set whether vertical or horizontal minimum size's of the box are equal
  * to the minimum vertical or horizontal size of items
  * (function for BOX or TABLE part.
@@ -2042,11 +2076,46 @@ EAPI Eina_Bool edje_edit_state_container_min_get(Evas_Object *obj, const char *p
  * @param h horizontal min value.
  * @param v vertical min value.
  *
+ * @deprecated Use edje_edit_state_container_min_x_set() and
+ * edje_edit_state_container_min_y_set() instead.
+ *
  * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
  * @since 1.14
  */
+EINA_DEPRECATED
 EAPI Eina_Bool edje_edit_state_container_min_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool h, Eina_Bool v);
 
+/** Set whether horizontal min size of the container should be equal to the min
+ * horizontal size of items (BOX and TABLE part functions).
+ *
+ * @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 h New horizontal min value.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ *
+ * @since 1.16
+ */
+EAPI Eina_Bool
+edje_edit_state_container_min_x_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool v);
+
+/** Set whether vertical min size of the container should be equal to the min
+ * vertical size of items (BOX and TABLE part functions).
+ *
+ * @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 v New vertical min value.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ * @since 1.16
+ */
+EAPI Eina_Bool
+edje_edit_state_container_min_y_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool h);
+
 /** Get x and y paddings for BOX or TABLE part.
  *
  * @param obj Object being edited.
index c229d4d..0af12a6 100644 (file)
@@ -4304,6 +4304,64 @@ edje_edit_state_table_homogeneous_set(Evas_Object *obj, const char *part, const
 /*     BOX & TABLE API     */
 /***************************/
 
+#define FUNC_CONTAINER_BOOL(CLASS, VALUE) \
+EAPI Eina_Bool \
+edje_edit_state_container_##CLASS##_##VALUE##_get(Evas_Object *obj, const char *part, const char *state, double value) \
+{ \
+   Eina_Bool 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 = EINA_FALSE; \
+     } \
+   return val; \
+} \
+EAPI Eina_Bool \
+edje_edit_state_container_##CLASS##_##VALUE##_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool 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_BOOL(min, v)
+FUNC_CONTAINER_BOOL(min, h)
+
+#undef FUNC_CONTAINER_BOOL
+
 EAPI Eina_Bool
 edje_edit_state_container_align_get(Evas_Object *obj, const char *part, const char *state, double value, double *x, double *y)
 {