From 434ed6e0939fd6ff215845e7f24a087699edfa17 Mon Sep 17 00:00:00 2001 From: Tiago Rezende Campos Falcao Date: Wed, 6 Oct 2010 20:24:16 +0000 Subject: [PATCH] Adding elm_widget_focus_cycle method This will cycle focus inside the sub-tree of one object. SVN revision: 53113 --- legacy/elementary/src/lib/elm_widget.c | 9 +++++++++ legacy/elementary/src/lib/elm_widget.h | 1 + legacy/elementary/src/lib/elm_win.c | 7 ++----- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/legacy/elementary/src/lib/elm_widget.c b/legacy/elementary/src/lib/elm_widget.c index 6f755c8417..798ca41ad4 100644 --- a/legacy/elementary/src/lib/elm_widget.c +++ b/legacy/elementary/src/lib/elm_widget.c @@ -749,6 +749,15 @@ elm_widget_parent_event_propagate(Evas_Object *obj, Evas_Callback_Type type, voi return EINA_FALSE; } +EAPI void +elm_widget_focus_cycle(Evas_Object *obj, Elm_Focus_Direction dir) +{ + Evas_Object *target; + elm_widget_focus_next_get(obj, dir, &target); + if (target) + elm_widget_focus_steal(target); +} + EAPI Eina_Bool elm_widget_focus_next_get(Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next) { diff --git a/legacy/elementary/src/lib/elm_widget.h b/legacy/elementary/src/lib/elm_widget.h index 186cddccef..390d4898c0 100644 --- a/legacy/elementary/src/lib/elm_widget.h +++ b/legacy/elementary/src/lib/elm_widget.h @@ -251,6 +251,7 @@ EAPI Evas_Object *elm_widget_top_get(const Evas_Object *obj); EAPI Eina_Bool elm_widget_is(const Evas_Object *obj); EAPI Evas_Object *elm_widget_parent_widget_get(const Evas_Object *obj); EAPI Eina_Bool elm_widget_parent_event_propagate(Evas_Object *obj, Evas_Callback_Type type, void *event_info); +EAPI void elm_widget_focus_cycle(Evas_Object *obj, Elm_Focus_Direction dir); EAPI Eina_Bool elm_widget_focus_next_get(Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next); EAPI Eina_Bool elm_widget_focus_list_next_get(Evas_Object *obj, Eina_List *items, void *(*list_data_get) (const Eina_List *list), Elm_Focus_Direction dir, Evas_Object **next); EAPI int elm_widget_focus_jump(Evas_Object *obj, int forward); diff --git a/legacy/elementary/src/lib/elm_win.c b/legacy/elementary/src/lib/elm_win.c index 15e4845fca..3f928bcbf9 100644 --- a/legacy/elementary/src/lib/elm_win.c +++ b/legacy/elementary/src/lib/elm_win.c @@ -165,13 +165,10 @@ _elm_win_event_cb(Evas_Object *obj, Evas_Object *src, Evas_Callback_Type type, v Evas_Event_Key_Down *ev = event_info; if (!strcmp(ev->keyname, "Tab")) { - Evas_Object *target; if(evas_key_modifier_is_set(ev->modifiers, "Shift")) - elm_widget_focus_next_get(obj, ELM_FOCUS_PREVIOUS, &target); + elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS); else - elm_widget_focus_next_get(obj, ELM_FOCUS_NEXT, &target); - if (target) - elm_widget_focus_steal(target); + elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT); return EINA_TRUE; } }