Adding elm_widget_focus_cycle method

This will cycle focus inside the sub-tree of one object.

SVN revision: 53113
This commit is contained in:
Tiago Rezende Campos Falcao 2010-10-06 20:24:16 +00:00
parent 198ca1fd95
commit 434ed6e093
3 changed files with 12 additions and 5 deletions

View File

@ -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)
{

View File

@ -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);

View File

@ -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;
}
}