[Gengrid] Fix gengrid item position update bug, when item is reordered or deleted.

Summary:
When gengrid item is reordered or deleted, gengrid didn't update item's position.
         This Patch update item's position when item is placed. if middle of item deleted,
         every item after the deleted one, will re-postion on _item_place function, so they
         will be update there position well.

Test Plan:
modify test_gengrid grid_sel fuction to print there position. so when item selected,
           they print there position and it works fine both horizontal and vertical.

Reviewers: bluezery, seoz, raster

Reviewed By: raster

CC: Hermet, chinmaya061

Differential Revision: https://phab.enlightenment.org/D855
This commit is contained in:
SangHyeon Lee 2014-05-15 12:13:23 +09:00 committed by Carsten Haitzler (Rasterman)
parent e6748f033a
commit c565ec1cde
2 changed files with 14 additions and 1 deletions

View File

@ -275,7 +275,7 @@ grid_del(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED)
static void
grid_sel(void *data, Evas_Object *obj, void *event_info)
{
printf("sel item data [%p] on grid obj [%p], pointer [%p]\n", data, obj, event_info);
printf("sel item data [%p] on grid obj [%p], pointer [%p], position [%d]\n", data, obj, event_info, elm_gengrid_item_index_get(event_info));
}
static void

View File

@ -998,6 +998,7 @@ _item_place(Elm_Gen_Item *it,
Eina_Bool was_realized;
Elm_Gen_Item_Type *item;
long items_count;
int item_pos;
item = GG_IT(it);
wsd = GG_IT(it)->wsd;
@ -1040,6 +1041,12 @@ _item_place(Elm_Gen_Item *it,
else
tch = items_row * wsd->item_height;
alignh = (vh - tch) * wsd->align_y;
item_pos = items_row * cx + cy + 1;
if (item_pos != it->position)
{
it->position = item_pos;
it->position_update = EINA_TRUE;
}
}
else
{
@ -1067,6 +1074,12 @@ _item_place(Elm_Gen_Item *it,
else
tcw = items_col * wsd->item_width;
alignw = (vw - tcw) * wsd->align_x;
item_pos = cx + items_col * cy + 1;
if (item_pos != it->position)
{
it->position = item_pos;
it->position_update = EINA_TRUE;
}
}
if (it->group)