edje: edje_edit - add getters/setters for a container item spans 72/49972/2
authorVyacheslav Reutskiy <v.reutskiy@samsung.com>
Mon, 21 Sep 2015 13:48:07 +0000 (16:48 +0300)
committerNikita Belyavskij <m.biliavskyi@samsung.com>
Thu, 22 Oct 2015 23:40:46 +0000 (16:40 -0700)
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

Change-Id: I51362acfbe3a377a4892343c9d6c9d89aabe45dc
origin: upstream

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

index 5d07bec..4a77be8 100644 (file)
@@ -2779,10 +2779,38 @@ EAPI Eina_Bool edje_edit_part_item_position_set(Evas_Object *obj, const char *pa
  * @param col Pointer to an unsigned char in which to store the columns count.
  * @param row Pointer to an unsigned char in which to store the rows count.
  *
+ * @deprecated Use edje_edit_part_item_span_row_get() and
+ * edje_edit_part_item_span_col_get() instead.
+ *
  * @since 1.11
  */
+EINA_DEPRECATED
 EAPI void edje_edit_part_item_span_get(Evas_Object *obj, const char *part, const char *item, unsigned char *col, unsigned char *row);
 
+/** Get the number of span columns.
+ *
+ * @param obj Object being edited.
+ * @param part Part that contain item.
+ * @param item The name of the item of part.
+ *
+ * @return The count of span columns.
+ * @since 1.16
+ */
+EAPI unsigned short
+edje_edit_part_item_span_col_get(Evas_Object *obj, const char *part, const char *item);
+
+/** Get the number of span rows.
+ *
+ * @param obj Object being edited.
+ * @param part Part that contain item.
+ * @param item The name of the item of part.
+ *
+ * @return The count of span rows.
+ * @since 1.16
+ */
+EAPI unsigned short
+edje_edit_part_item_span_row_get(Evas_Object *obj, const char *part, const char *item);
+
 /** Set the count of columns and rows, which this item will spans for use.
  *
  * @param obj object being edited.
@@ -2794,8 +2822,35 @@ EAPI void edje_edit_part_item_span_get(Evas_Object *obj, const char *part, const
  * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise.
  * @since 1.11
  */
+EINA_DEPRECATED
 EAPI Eina_Bool edje_edit_part_item_span_set(Evas_Object *obj, const char *part, const char *item, unsigned char col, unsigned char row);
 
+/** Set the count of columns which this item will spans for use.
+ *
+ * @param obj Object being edited.
+ * @param part Part that contain item.
+ * @param item The name of the item.
+ * @param col new count of the columns spans.
+ *
+ * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise.
+ * @since 1.16
+ */
+EAPI Eina_Bool
+edje_edit_part_item_span_col_set(Evas_Object *obj, const char *part, const char *item, unsigned short col);
+
+/** Set the count of rows which this item will spans for use.
+ *
+ * @param obj Object being edited.
+ * @param part Part that contain item.
+ * @param item The name of the item.
+ * @param row new count of the rows spans.
+ *
+ * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise.
+ * @since 1.16
+ */
+EAPI Eina_Bool
+edje_edit_part_item_span_row_set(Evas_Object *obj, const char *part, const char *item, unsigned short row);
+
 //@}
 /******************************************************************************/
 /**************************   STATES API   ************************************/
index 49ccdea..b1d7a99 100644 (file)
@@ -5106,6 +5106,56 @@ edje_edit_part_item_span_set(Evas_Object *obj, const char *part,
    return EINA_TRUE;
 }
 
+#define FUNC_PART_ITEM_USHORT(CLASS, VALUE, MEMBER) \
+EAPI unsigned short \
+edje_edit_part_item_##CLASS##_##VALUE##_get(Evas_Object *obj, const char *part, const char *item_name) \
+{ \
+   Edje_Part *ep; \
+   unsigned int i; \
+   Edje_Pack_Element *item = NULL; \
+   GET_RP_OR_RETURN(0); \
+   if (!item_name) return 0; \
+   ep = rp->part; \
+   if (rp->part->type != EDJE_PART_TYPE_TABLE) return EINA_FALSE; \
+   for (i = 0; i < ep->items_count; ++i) \
+     { \
+        if ((ep->items[i]->name) && (!strcmp(ep->items[i]->name, item_name))) \
+          { \
+             item = ep->items[i]; \
+             break; \
+          } \
+     } \
+   if (!item) return 0; \
+   return  item->MEMBER; \
+} \
+EAPI Eina_Bool \
+edje_edit_part_item_##CLASS##_##VALUE##_set(Evas_Object *obj, const char *part, const char *item_name, unsigned short new_val) \
+{ \
+   Edje_Part *ep; \
+   unsigned int i; \
+   Edje_Pack_Element *item = NULL; \
+   GET_RP_OR_RETURN(EINA_FALSE); \
+   if (!item_name) return EINA_FALSE; \
+   ep = rp->part; \
+   if (rp->part->type != EDJE_PART_TYPE_TABLE) return EINA_FALSE; \
+   for (i = 0; i < ep->items_count; i++) \
+     { \
+        if ((ep->items[i]->name) && (!strcmp(ep->items[i]->name, item_name))) \
+          { \
+             item = ep->items[i]; \
+             break; \
+          } \
+     } \
+   if (!item) return EINA_FALSE; \
+   item->MEMBER = new_val; \
+   return EINA_TRUE; \
+}
+
+FUNC_PART_ITEM_USHORT(span, col, colspan)
+FUNC_PART_ITEM_USHORT(span, row, rowspan)
+
+#undef FUNC_PART_ITEM_USHORT
+
 /*********************/
 /*  PART STATES API  */
 /*********************/