From eddcb693917fc19c1b1aab4f3230ad6b43453515 Mon Sep 17 00:00:00 2001 From: Vyacheslav Reutskiy Date: Mon, 21 Sep 2015 16:12:56 +0300 Subject: [PATCH] edje: edje_edit - add getters/setters for a container item position 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 --- src/lib/edje/Edje_Edit.h | 58 ++++++++++++++++++++++++++++++++++++++++ src/lib/edje/edje_edit.c | 50 ++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index 16267160ce..a9c7a3e69e 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -2776,11 +2776,39 @@ EAPI Eina_Bool edje_edit_part_item_weight_y_set(Evas_Object *obj, const char *pa * @param col Column item position. * @param row Row item position. * + * @deprecated Use edje_edit_part_item_position_col_get() and + * edje_edit_part_item_position_row_get() instead. + * * @return @c EINA_TRUE If successfull, @c EINA_FALSE otherwise. * @since 1.11 */ +EINA_DEPRECATED EAPI Eina_Bool edje_edit_part_item_position_get(Evas_Object *obj, const char *part, const char *item_name, unsigned short *col, unsigned short *row); +/** Get column position of the part's item. + * + * @param obj Object being edited. + * @param part Part that contain item. + * @param item_name The name of the item. + * + * @return The item column value. + * @since 1.16 + */ +EAPI unsigned short +edje_edit_part_item_position_col_get(Evas_Object *obj, const char *part, const char *item_name); + +/** Get row position of the part's item. + * + * @param obj Object being edited. + * @param part Part that contain item. + * @param item_name The name of the item. + * + * @return The item row value. + * @since 1.16 + */ +EAPI unsigned short +edje_edit_part_item_position_row_get(Evas_Object *obj, const char *part, const char *item_name); + /** Set column/row position of a new part's item. * * @param obj Object being edited. @@ -2789,11 +2817,41 @@ EAPI Eina_Bool edje_edit_part_item_position_get(Evas_Object *obj, const char *pa * @param col Column item position. * @param row Row item position. * + * @deprecation Use edje_edit_part_item_position_col_set() and + * edje_edit_part_item_position_row_set() instead. + * * @return @c EINA_TRUE If successfull, @c EINA_FALSE otherwise. * @since 1.11 */ +EINA_DEPRECATED 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); +/** Set column position of a part item. + * + * @param obj Object being edited. + * @param part Part that contain item. + * @param item_name The name of the item. + * @param col Column item position. + * + * @return @c EINA_TRUE If successfull, @c EINA_FALSE otherwise. + * @since 1.16 + */ +EAPI Eina_Bool +edje_edit_part_item_position_col_set(Evas_Object *obj, const char *part, const char *item_name, unsigned short col); + +/** Set row position of a part item. + * + * @param obj Object being edited. + * @param part Part that contain item. + * @param item_name The name of the item. + * @param row Row item position. + * + * @return @c EINA_TRUE If successfull, @c EINA_FALSE otherwise. + * @since 1.16 + */ +EAPI Eina_Bool +edje_edit_part_item_position_row_set(Evas_Object *obj, const char *part, const char *item_name, unsigned short row); + /** Retrieves the how many columns and rows will span for use by item. * * @param obj object being edited. diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 10a63aa650..29ccb7874f 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -5174,6 +5174,56 @@ edje_edit_part_item_position_set(Evas_Object *obj, const char *part, const char return EINA_TRUE; } +#define FUNC_PART_ITEM_USHORT(CLASS, VALUE) \ +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 0; \ + 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->VALUE; \ +} \ +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->VALUE = new_val; \ + return EINA_TRUE; \ +} + +FUNC_PART_ITEM_USHORT(position, col) +FUNC_PART_ITEM_USHORT(position, row) + +#undef FUNC_PART_ITEM_USHORT + EAPI void edje_edit_part_item_span_get(Evas_Object *obj, const char *part, const char *item_name, unsigned char *col, unsigned char *row) {