edje: Edje_Edit - add edje_edit_part_item_align functions.

Summary:
Getters and setters of align for box/table items.
Following functions were added:
- edje_edit_part_item_align_x_set
- edje_edit_part_item_align_x_get
- edje_edit_part_item_align_y_set
- edje_edit_part_item_align_y_get
@feature

Reviewers: raster, seoz, cedric, Hermet

CC: reutskiy.v.v, cedric

Differential Revision: https://phab.enlightenment.org/D1045

Signed-off-by: Cedric BAIL <c.bail@partner.samsung.com>
This commit is contained in:
Vorobiov Vitalii 2014-06-16 18:57:29 +02:00 committed by Cedric BAIL
parent 7e4b9b6f09
commit bb878758e6
2 changed files with 104 additions and 1 deletions

View File

@ -1834,6 +1834,52 @@ EAPI Eina_Bool edje_edit_part_item_padding_get(Evas_Object *obj, const char *par
*/
EAPI Eina_Bool edje_edit_part_item_padding_set(Evas_Object *obj, const char *part, const char *item_name, int l, int r, int t, int b);
/** Get the horizontal align value of a part state.
*
* @param obj Object being edited.
* @param part Part that contain item.
* @param item The name of the item to get horizontal align value.
*
* @return The horizontal align value for the given align (value is between -1.0 and 1.0)
* @since 1.11
*/
EAPI double edje_edit_part_item_align_x_get(Evas_Object *obj, const char *part, const char *item);
/** Set the horizontal align value of a part state.
*
* @param obj Object being edited.
* @param part Part that contain itemf
* @param item The name of the item to set horizontal align value.
* @param align_x New value of the horizontal align.
*
* @return EINA_TRUE if successful, EINA_FALSE otherwise.
* @since 1.11
*/
EAPI Eina_Bool edje_edit_part_item_align_x_set(Evas_Object *obj, const char *part, const char *item, double align_x);
/** Get the vertical align value of a part state.
*
* @param obj Object being edited.
* @param part Part that contain item.
* @param item The name of the item to get vertical align value.
*
* @return The vertical align value for the given align (value is between -1.0 and 1.0)
* @since 1.11
*/
EAPI double edje_edit_part_item_align_y_get(Evas_Object *obj, const char *part, const char *item);
/** Set the vertical align value of a part state.
*
* @param obj Object being edited.
* @param part Part that contain item.
* @param item The name of the item to set vertical align value.
* @param align_y New value of the vertical align.
*
* @return EINA_TRUE if successful, EINA_FALSE otherwise.
* @since 1.11
*/
EAPI Eina_Bool edje_edit_part_item_align_y_set(Evas_Object *obj, const char *part, const char *item, double align_y);
//@}
/******************************************************************************/
/************************** STATES API ************************************/

View File

@ -4064,6 +4064,61 @@ edje_edit_part_item_padding_set(Evas_Object *obj, const char *part, const char *
return EINA_TRUE;
}
#define FUNC_PART_ITEM_DOUBLE(Name, Value) \
EAPI double \
edje_edit_part_item_##Name##_get(Evas_Object *obj, const char *part, const char *item_name) \
{ \
Edje_Part *ep; \
unsigned int i; \
Edje_Pack_Element *item = NULL; \
if ((!obj) || (!part) || (!item_name)) \
return 0.0; \
GET_RP_OR_RETURN(0.0); \
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 EINA_FALSE; \
return TO_DOUBLE(item->Value); \
} \
EAPI Eina_Bool \
edje_edit_part_item_##Name##_set(Evas_Object *obj, const char *part, const char *item_name, double v) \
{ \
Edje_Part *ep; \
unsigned int i; \
Edje_Pack_Element *item = NULL; \
if ((!obj) || (!part) || (!item_name)) \
return EINA_FALSE; \
if ((v < -1.0) || (v > 1.0)) \
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->Value = FROM_DOUBLE(v); \
return EINA_TRUE; \
}
FUNC_PART_ITEM_DOUBLE(align_x, align.x);
FUNC_PART_ITEM_DOUBLE(align_y, align.y);
#undef FUNC_PART_ITEM_DOUBLE
/*********************/
/* PART STATES API */
/*********************/
@ -9435,7 +9490,9 @@ _edje_generate_source_of_part(Evas_Object *obj, Edje_Part *ep, Eina_Strbuf *buf)
BUF_APPENDF(I7"padding: %d %d %d %d;\n",
item->padding.l, item->padding.r,
item->padding.t, item->padding.b);
//TODO align
if (TO_DOUBLE(item->align.x) != 0.5 || TO_DOUBLE(item->align.y) != 0.5)
BUF_APPENDF(I7"align: %g %g;\n", TO_DOUBLE(item->align.x), TO_DOUBLE(item->align.y));
//TODO weight
//TODO options
//TODO col