edje: edje_edit - add getters/setters for a container item spans

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
This commit is contained in:
Vyacheslav Reutskiy 2015-09-21 16:48:07 +03:00
parent eddcb69391
commit 27b81e44bc
2 changed files with 105 additions and 0 deletions

View File

@ -2860,10 +2860,38 @@ edje_edit_part_item_position_row_set(Evas_Object *obj, const char *part, const c
* @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.
@ -2875,8 +2903,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 ************************************/

View File

@ -5275,6 +5275,56 @@ edje_edit_part_item_span_set(Evas_Object *obj, const char *part, const char *ite
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 */
/*********************/