forked from enlightenment/efl
Adding function to set cell selected in elm_scrolled_grid
By: Rafael Fonseca SVN revision: 49173
This commit is contained in:
parent
bb3868efb5
commit
a5fa20a9ab
|
@ -176,6 +176,8 @@ test_grid(void *data, Evas_Object *obj, void *event_info)
|
|||
item[i].mode = i;
|
||||
item[i].path = eina_stringshare_add(buf);
|
||||
item[i].cell = elm_scrolled_grid_cell_add(grid, &gcc, &(item[i]), grid_sel, NULL);
|
||||
if (!(i % 5))
|
||||
elm_scrolled_grid_cell_selected_set(item[i].cell, EINA_TRUE);
|
||||
}
|
||||
|
||||
evas_object_show(grid);
|
||||
|
|
|
@ -588,6 +588,7 @@ extern "C" {
|
|||
EAPI void elm_scrolled_grid_clear(Evas_Object *obj);
|
||||
EAPI void *elm_scrolled_grid_cell_data_get(Elm_Grid_Cell *cell);
|
||||
EAPI void elm_scrolled_grid_cell_pos_get(const Elm_Grid_Cell *cell, unsigned int *x, unsigned int *y);
|
||||
EAPI void elm_scrolled_grid_cell_selected_set(Elm_Grid_Cell *cell, Eina_Bool selected);
|
||||
EAPI Eina_Bool elm_scrolled_grid_cell_selected_get(const Elm_Grid_Cell *cell);
|
||||
EAPI const Evas_Object *elm_scrolled_grid_cell_object_get(Elm_Grid_Cell *cell);
|
||||
EAPI const Eina_List *elm_scrolled_grid_selected_cells_get(const Evas_Object *obj);
|
||||
|
|
|
@ -1366,6 +1366,40 @@ elm_scrolled_grid_selected_cells_get(const Evas_Object *obj)
|
|||
return wd->selected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the selected state of a cell.
|
||||
*
|
||||
* This sets the selected state of a cell. If multi-select is not enabled and
|
||||
* selected is EINA_TRUE, previously selected cells are unselected.
|
||||
*
|
||||
* @param cell The cell
|
||||
* @param selected The selected state.
|
||||
*
|
||||
* @ingroup Grid
|
||||
*/
|
||||
EAPI void
|
||||
elm_scrolled_grid_cell_selected_set(Elm_Grid_Cell *cell, Eina_Bool selected)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(cell->wd->self);
|
||||
if (!wd) return;
|
||||
if (!cell || cell->delete_me) return;
|
||||
selected = !!selected;
|
||||
if (cell->selected == selected) return;
|
||||
|
||||
if (selected)
|
||||
{
|
||||
if (!wd->multi)
|
||||
{
|
||||
while (wd->selected)
|
||||
_cell_unselect(wd->selected->data);
|
||||
}
|
||||
_cell_hilight(cell);
|
||||
_cell_select(cell);
|
||||
}
|
||||
else
|
||||
_cell_unselect(cell);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the selected state of a cell.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue