From: WooHyun Jung Date: Tue, 15 May 2012 10:39:07 +0000 (+0000) Subject: elementary/elm_grid : Add focus_direction. X-Git-Tag: v1.7.0~683 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1721918059892de38d3cb3ece763e19d8cc8923b;p=platform%2Fupstream%2Felementary.git elementary/elm_grid : Add focus_direction. SVN revision: 71103 --- diff --git a/src/lib/elm_grid.c b/src/lib/elm_grid.c index f166e95..0e6c0c8 100644 --- a/src/lib/elm_grid.c +++ b/src/lib/elm_grid.c @@ -69,6 +69,44 @@ _elm_grid_smart_focus_next(const Evas_Object *obj, return ret; } +static Eina_Bool +_elm_grid_smart_focus_direction(const Evas_Object *obj, + const Evas_Object *base, + double degree, + Evas_Object **direction, + double *weight) +{ + Eina_Bool ret; + const Eina_List *items; + Eina_List *(*list_free)(Eina_List *list); + void *(*list_data_get)(const Eina_List *list); + + ELM_GRID_DATA_GET(obj, sd); + + /* Focus chain */ + /* TODO: Change this to use other chain */ + if ((items = elm_widget_focus_custom_chain_get(obj))) + { + list_data_get = eina_list_data_get; + list_free = NULL; + } + else + { + items = evas_object_grid_children_get(sd->resize_obj); + list_data_get = eina_list_data_get; + list_free = eina_list_free; + + if (!items) return EINA_FALSE; + } + + ret = elm_widget_focus_list_direction_get(obj, base, items, list_data_get, + degree, direction, weight); + + if (list_free) list_free((Eina_List *)items); + + return ret; +} + static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl) { @@ -132,6 +170,7 @@ _elm_grid_smart_set_user(Elm_Widget_Smart_Class *sc) sc->theme = _elm_grid_smart_theme; sc->focus_next = _elm_grid_smart_focus_next; + sc->focus_direction = _elm_grid_smart_focus_direction; } EAPI Evas_Object *