edje: Edje_Edit - add edje_edit_part_item_padding functions.

Summary:
1. Changing item's paddings and getting current padding of the item.
Add getter and setter functions for padding of the item.
- edje_edit_part_item_padding_get
- edje_edit_part_item_padding_set

2. Also some code generatings fixes for paddings, box/table and max values.

Reviewers: cedric, Hermet, seoz, raster

CC: reutskiy.v.v, cedric

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

Signed-off-by: Cedric BAIL <c.bail@partner.samsung.com>
This commit is contained in:
Vorobiov Vitalii 2014-06-16 16:58:38 +02:00 committed by Cedric BAIL
parent 8ae41a547b
commit 32024b076a
2 changed files with 105 additions and 3 deletions

View File

@ -1805,6 +1805,35 @@ EAPI int edje_edit_part_item_prefer_h_get(Evas_Object *obj, const char *part, co
*/
EAPI Eina_Bool edje_edit_part_item_prefer_h_set(Evas_Object *obj, const char *part, const char *item, int prefer_h);
/** Get paddings of the part's item.
*
* @param obj Object being edited.
* @param part Part that contain item.
* @param item_name The name of the item.
* @param l A pointer to store the left padding value.
* @param r A pointer to store the right padding value.
* @param t A pointer to store the top padding value.
* @param b A pointer to store the bottom padding value.
*
* @return EINA_TRUE If successfull, EINA_FALSE otherwise.
*/
EAPI Eina_Bool edje_edit_part_item_padding_get(Evas_Object *obj, const char *part, const char *item_name, int *l, int *r, int *t, int *b);
/** Set paddings of the part's item.
*
* @param obj Object being edited.
* @param part Part that contain item.
* @param item_name The name of the item.
* @param l Value of the left padding.
* @param r Value of the right padding.
* @param t Value of the top padding.
* @param b Value of the bottom padding.
*
* @return EINA_TRUE If successfull, EINA_FALSE otherwise.
*/
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);
//@}
/******************************************************************************/
/************************** STATES API ************************************/

View File

@ -3998,6 +3998,72 @@ FUNC_PART_ITEM_INT(aspect, h, 0);
FUNC_PART_ITEM_INT(prefer, w, 0);
FUNC_PART_ITEM_INT(prefer, h, 0);
EAPI Eina_Bool
edje_edit_part_item_padding_get(Evas_Object *obj, const char *part, const char *item_name, int *l, int *r, int *t, int *b)
{
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;
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;
if (l) *l = item->padding.l;
if (t) *t = item->padding.t;
if (r) *r = item->padding.r;
if (b) *b = item->padding.b;
return EINA_TRUE;
}
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)
{
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;
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;
if (l > -1) item->padding.l = l;
else return EINA_FALSE;
if (t > -1) item->padding.t = t;
else return EINA_FALSE;
if (r > -1) item->padding.r = r;
else return EINA_FALSE;
if (b > -1) item->padding.b = b;
else return EINA_FALSE;
return EINA_TRUE;
}
/*********************/
/* PART STATES API */
/*********************/
@ -9271,7 +9337,10 @@ _edje_generate_source_of_part(Evas_Object *obj, Edje_Part *ep, Eina_Strbuf *buf)
{
if (ep->items_count != 0)
{
BUF_APPEND(I4"box {\n");
if (edje_edit_part_type_get(obj, part) == EDJE_PART_TYPE_BOX)
BUF_APPEND(I4"box {\n");
else
BUF_APPEND(I4"table {\n");
BUF_APPEND(I5"items {\n");
for (i = 0; i < ep->items_count; ++i)
{
@ -9284,7 +9353,7 @@ _edje_generate_source_of_part(Evas_Object *obj, Edje_Part *ep, Eina_Strbuf *buf)
BUF_APPENDF(I7"source: \"%s\";\n", item->source);
if ((item->min.w != 0) || (item->min.h != 0))
BUF_APPENDF(I7"min: %d %d;\n", item->min.h, item->min.h);
if ((item->max.w != 0) || (item->max.h != 0))
if ((item->max.w != -1) || (item->max.h != -1))
BUF_APPENDF(I7"max: %d %d;\n", item->max.h, item->max.h);
//TODO aspect mode
if ((item->aspect.w != 0) || (item->aspect.h != 0))
@ -9293,7 +9362,11 @@ _edje_generate_source_of_part(Evas_Object *obj, Edje_Part *ep, Eina_Strbuf *buf)
BUF_APPENDF(I7"prefer: %d %d;\n", item->prefer.h, item->prefer.h);
if ((item->spread.w != 1) || (item->spread.h != 1))
BUF_APPENDF(I7"spread: %d %d;\n", item->spread.h, item->spread.h);
//TODO padding
if ((item->padding.l != 0) || (item->padding.t != 0) ||
(item->padding.r != 0) || (item->padding.b != 0))
BUF_APPENDF(I7"padding: %d %d %d %d;\n",
item->padding.l, item->padding.r,
item->padding.t, item->padding.b);
//TODO align
//TODO weight
//TODO options