Edje: new set/get API omogeneous, paddings and align for BOX/TABLE in Edje Edit
authorVitalii Vorobiov <vi.vorobiov@samsung.com>
Thu, 19 Feb 2015 14:57:17 +0000 (16:57 +0200)
committerVitalii Vorobiov <vi.vorobiov@samsung.com>
Thu, 19 Feb 2015 14:57:17 +0000 (16:57 +0200)
Those include such functions like:
> edje_edit_state_table_homogeneous_set/get (function for TABLE only)
> edje_edit_state_container_padding_get
(container means that functions both for TABLE and BOX)
> edje_edit_state_container_align_get (also for TABLE and BOX)

@feature

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

index 2146b22..14c83b3 100644 (file)
@@ -1833,10 +1833,10 @@ EAPI Eina_Bool edje_edit_part_drag_threshold_set(Evas_Object *obj, const char *p
 
 //@}
 /******************************************************************************/
-/**************************      BOX & TABLE API      *************************/
+/*******************************      BOX API      ****************************/
 /******************************************************************************/
-/** @name Box and Table API
- *  Functions to deal with table and box (see @ref edcref).
+/** @name Box Description API
+ *  Functions to deal with box (see @ref edcref).
  */ //@{
 
 /** Get primary layout of the box.
@@ -1933,6 +1933,132 @@ edje_edit_state_box_alt_layout_set(Evas_Object *obj, const char *part,
 
 //@}
 /******************************************************************************/
+/**************************   TABLE API   *************************************/
+/******************************************************************************/
+/** @name Table Description API
+ *  Functions to deal with table (see @ref edcref).
+ */ //@{
+
+/** Set homogeneous mode for TABLE part.
+ *
+ * @param obj Object being edited.
+ * @param part Part that have TABLE type.
+ * @param state Name of the state.
+ * @param value Value of the state.
+ * @param homogeneous Homogeneous mode for table.
+ *
+ * Possible modes:
+ *     @li EDJE_OBJECT_TABLE_HOMOGENEOUS_NONE,
+ *     @li EDJE_OBJECT_TABLE_HOMOGENEOUS_TABLE,
+ *     @li EDJE_OBJECT_TABLE_HOMOGENEOUS_ITEM
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ * @since 1.14
+ */
+EAPI Eina_Bool
+edje_edit_state_table_homogeneous_set(Evas_Object *obj, const char *part,
+                                      const char *state, double value,
+                                      unsigned char homogeneous);
+
+/** Get homogeneous mode for TABLE part.
+ *
+ * @param obj Object being edited.
+ * @param part Part that have TABLE type.
+ * @param state Name of the state.
+ * @param value Value of the state.
+ *
+ * Possible modes:
+ *     @li EDJE_OBJECT_TABLE_HOMOGENEOUS_NONE,
+ *     @li EDJE_OBJECT_TABLE_HOMOGENEOUS_TABLE,
+ *     @li EDJE_OBJECT_TABLE_HOMOGENEOUS_ITEM
+ *
+ * @return Table homogeneous mode on success or 0 on any error.
+ * @since 1.14
+ */
+EAPI unsigned char
+edje_edit_state_table_homogeneous_get(Evas_Object *obj, const char *part,
+                                      const char *state, double value);
+
+//@}
+/******************************************************************************/
+/***********************   TABLE & BOX API   **********************************/
+/******************************************************************************/
+/** @name "Container" Description API
+ * Functions to deal both with box and table (see @ref edcref).
+ * Those functions called edje_edit_state_container_<something> because they
+ * are working both for TABLE and BOX at same time.
+ */ //@{
+
+/** Get x and y paddings for BOX or TABLE part.
+ *
+ * @param obj Object being edited.
+ * @param part Part that have BOX/TABLE type.
+ * @param state Name of the state.
+ * @param value Value of the state.
+ * @param x Variable to store x padding.
+ * @param y Variable to store y padding.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ * @since 1.14
+ */
+EAPI Eina_Bool
+edje_edit_state_container_padding_get(Evas_Object *obj, const char *part,
+                                      const char *state, double value,
+                                      int *x, int *y);
+
+/** Set x and y paddings for BOX or TABLE part.
+ *
+ * @param obj Object being edited.
+ * @param part Part that have BOX/TABLE type.
+ * @param state Name of the state.
+ * @param value Value of the state.
+ * @param x Value for setting x padding.
+ * @param y Value for setting y padding.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ * @since 1.14
+ */
+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 and y align for BOX or TABLE part.
+ *
+ * @param obj Object being edited.
+ * @param part Part that have BOX/TABLE type.
+ * @param state Name of the state.
+ * @param value Value of the state.
+ * @param x Variable to store x value.
+ * @param y Variable to store y value.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ * @since 1.14
+ */
+EAPI Eina_Bool
+edje_edit_state_container_align_set(Evas_Object *obj, const char *part,
+                                    const char *state, double value,
+                                    double x, double y);
+
+/** Get x and y align for BOX or TABLE part.
+ *
+ * @param obj Object being edited.
+ * @param part Part that have BOX/TABLE type.
+ * @param state Name of the state.
+ * @param value Value of the state.
+ * @param x Value for setting x align.
+ * @param y Value for setting y align.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ * @since 1.14
+ */
+EAPI Eina_Bool
+edje_edit_state_container_align_get(Evas_Object *obj, const char *part,
+                                    const char *state, double value,
+                                    double *x, double *y);
+
+//@}
+/******************************************************************************/
 /**************************   BOX & TABLE ITEMS API   *************************/
 /******************************************************************************/
 /** @name Items API
index 49a3290..e87c632 100644 (file)
@@ -4135,7 +4135,7 @@ FUNC_PART_DRAG_ID(event);
 FUNC_PART_DRAG_ID(threshold);
 
 /***************************/
-/*     BOX & TABLE API     */
+/*         BOX API         */
 /***************************/
 
 #define FUNC_STATE_BOX_LAYOUT(Layout) \
@@ -4173,6 +4173,180 @@ FUNC_STATE_BOX_LAYOUT(layout);
 FUNC_STATE_BOX_LAYOUT(alt_layout);
 
 /***************************/
+/*        TABLE API        */
+/***************************/
+
+EAPI unsigned char
+edje_edit_state_table_homogeneous_get(Evas_Object *obj, const char *part,
+                                      const char *state, double value)
+{
+   GET_PD_OR_RETURN(0)
+
+   switch (rp->part->type)
+     {
+      case EDJE_PART_TYPE_TABLE:
+        {
+           Edje_Part_Description_Table *table;
+           table = (Edje_Part_Description_Table*) pd;
+           return table->table.homogeneous;
+        }
+      default:
+        return 0;
+     }
+   return 0;
+}
+
+EAPI Eina_Bool
+edje_edit_state_table_homogeneous_set(Evas_Object *obj, const char *part,
+                                      const char *state, double value,
+                                      unsigned char homogeneous)
+{
+   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.homogeneous = homogeneous;
+           break;
+        }
+      default:
+        return EINA_FALSE;
+     }
+   return EINA_TRUE;
+}
+
+/***************************/
+/*     BOX & TABLE API     */
+/***************************/
+
+EAPI Eina_Bool
+edje_edit_state_container_align_get(Evas_Object *obj, const char *part,
+                                 const char *state, double value,
+                                 double *x, double *y)
+{
+   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;
+           if (x) *x = FROM_DOUBLE(table->table.align.x);
+           if (y) *y = FROM_DOUBLE(table->table.align.y);
+           break;
+        }
+      case EDJE_PART_TYPE_BOX:
+        {
+           Edje_Part_Description_Box *box;
+           box = (Edje_Part_Description_Box*) pd;
+           if (x) *x = FROM_DOUBLE(box->box.align.x);
+           if (y) *y = FROM_DOUBLE(box->box.align.y);
+           break;
+        }
+      default:
+        return EINA_FALSE;
+     }
+   return EINA_TRUE;
+}
+
+EAPI Eina_Bool
+edje_edit_state_container_align_set(Evas_Object *obj, const char *part,
+                                    const char *state, double value,
+                                    double x, double y)
+{
+   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.align.x = TO_DOUBLE(x);
+           table->table.align.y = TO_DOUBLE(y);
+           break;
+        }
+      case EDJE_PART_TYPE_BOX:
+        {
+           Edje_Part_Description_Box *box;
+           box = (Edje_Part_Description_Box*) pd;
+           box->box.align.x = x;
+           box->box.align.y = y;
+           break;
+        }
+      default:
+        return EINA_FALSE;
+     }
+   return EINA_TRUE;
+}
+
+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_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;
+           if (x) *x = table->table.padding.x;
+           if (y) *y = table->table.padding.y;
+           break;
+        }
+      case EDJE_PART_TYPE_BOX:
+        {
+           Edje_Part_Description_Box *box;
+           box = (Edje_Part_Description_Box*) pd;
+           if (x) *x = box->box.padding.x;
+           if (y) *y = box->box.padding.y;
+           break;
+        }
+      default:
+        return EINA_FALSE;
+     }
+
+   return EINA_TRUE;
+}
+
+EAPI Eina_Bool
+edje_edit_state_container_padding_set(Evas_Object *obj, const char *part,
+                                    const char *state, double value,
+                                    int x, int y)
+{
+   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.padding.x = x;
+           table->table.padding.y = y;
+           break;
+        }
+      case EDJE_PART_TYPE_BOX:
+        {
+           Edje_Part_Description_Box *box;
+           box = (Edje_Part_Description_Box*) pd;
+           box->box.padding.x = x;
+           box->box.padding.y = y;
+           break;
+        }
+      default:
+       return EINA_FALSE;
+     }
+   return EINA_TRUE;
+}
+/***************************/
 /*  BOX & TABLE ITEMS API  */
 /***************************/