edje: Edje_Edit - add edje_edit_part_item_row/col_span functions.
authorMykyta Biliavskyi <m.biliavskyi@samsung.com>
Mon, 7 Jul 2014 17:04:52 +0000 (19:04 +0200)
committerCedric BAIL <c.bail@partner.samsung.com>
Mon, 7 Jul 2014 17:08:41 +0000 (19:08 +0200)
Summary:
Getter and setter of span for box/table items.
Following functions were added:
   edje_edit_part_item_span_set
   edje_edit_part_item_span_get

Reviewers: raster, seoz, cedric, Hermet, reutskiy.v.v

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

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

index 3596119..20506b9 100644 (file)
@@ -2306,6 +2306,31 @@ EAPI Eina_Bool edje_edit_part_item_position_get(Evas_Object *obj, const char *pa
  */
 EAPI Eina_Bool edje_edit_part_item_position_set(Evas_Object *obj, const char *part, const char *item_name, unsigned short col, unsigned short row);
 
+/** Retrieves the how many columns and rows will span for use by item.
+ *
+ * @param obj object being edited.
+ * @param part part that contain item.
+ * @param item the name of the item of part.
+ * @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.
+ *
+ * @since 1.11
+ */
+EAPI void edje_edit_part_item_span_get(Evas_Object *obj, const char *part, const char *item, unsigned char *col, unsigned char *row);
+
+/** Set the count of columns and 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 to set new count of columns spans.
+ * @param col new count of the columns spans.
+ * @param row new count of the rows spans.
+ *
+ * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise.
+ * @since 1.11
+ */
+EAPI Eina_Bool edje_edit_part_item_span_set(Evas_Object *obj, const char *part, const char *item, unsigned char col, unsigned char row);
+
 //@}
 /******************************************************************************/
 /**************************   STATES API   ************************************/
index 776f395..e5db9ba 100644 (file)
@@ -4490,6 +4490,61 @@ edje_edit_part_item_position_set(Evas_Object *obj, const char *part,
      return EINA_TRUE;
   }
 
+EAPI void
+edje_edit_part_item_span_get(Evas_Object *obj, const char *part,
+                             const char *item_name, unsigned char *col,
+                             unsigned char *row)
+{
+   Edje_Part *ep;
+   unsigned int i;
+   Edje_Pack_Element *item = NULL;
+   if ((!obj) || (!part) || (!item_name))
+     return;
+   GET_RP_OR_RETURN();
+   ep = rp->part;
+   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;
+   if (col) *col = item->colspan;
+   if (row) *row = item->rowspan;
+   return;
+}
+
+EAPI Eina_Bool
+edje_edit_part_item_span_set(Evas_Object *obj, const char *part,
+                             const char *item_name, unsigned char col,
+                             unsigned char row)
+{
+   Edje_Part *ep;
+   unsigned int i;
+   Edje_Pack_Element *item = NULL;
+   if ((!obj) || (!part) || (!item_name))
+     return EINA_FALSE;
+   GET_RP_OR_RETURN(EINA_FALSE);
+   ep = rp->part;
+   if ((rp->part->type != EDJE_PART_TYPE_BOX) &&
+      (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->colspan = col;
+   item->rowspan = row;
+   return EINA_TRUE;
+}
+
 /*********************/
 /*  PART STATES API  */
 /*********************/
@@ -10280,10 +10335,14 @@ _edje_generate_source_of_part(Evas_Object *obj, Edje_Part *ep, Eina_Strbuf *buf)
 
                   if (edje_edit_part_type_get(obj, part) == EDJE_PART_TYPE_TABLE)
                     BUF_APPENDF(I7"position: %d %d;\n", item->col, item->row);
+                  if ((item->colspan != 1) || (item->rowspan != 1))
+                    BUF_APPENDF(I7"span: %d %d;\n", item->colspan, item->rowspan);
+
                   //TODO weight
                   //TODO options
-                  //TODO colspan
-                  //TODO rowspan
+                  //TODO col
+                  //TODO row
+
                   BUF_APPEND(I6"}\n");
                }
              BUF_APPEND(I5"}\n");