elm_genlist: behaviour fixes for genlist

This implements the behaviour in case no item is yet focused, but the
genlist is focused.

ref T6805

Reviewed-by: YeongJong Lee <yj34.lee@samsung.com>
Differential Revision: https://phab.enlightenment.org/D7452
This commit is contained in:
Marcel Hollerbach 2018-12-12 12:49:19 +01:00
parent 6922761f3f
commit e779492a1c
2 changed files with 44 additions and 0 deletions

View File

@ -3455,6 +3455,49 @@ _elm_genlist_efl_ui_focus_manager_manager_focus_get(const Eo *obj, Elm_Genlist_D
return focused_obj;
}
static Efl_Ui_Focus_Object*
_select_candidate(Eo *obj, Elm_Genlist_Data *pd, Efl_Ui_Focus_Direction direction)
{
Elm_Object_Item *first = elm_genlist_first_item_get(obj);
Elm_Object_Item *last = elm_genlist_last_item_get(obj);
switch(direction)
{
case EFL_UI_FOCUS_DIRECTION_DOWN:
case EFL_UI_FOCUS_DIRECTION_RIGHT:
elm_object_item_focus_set(first, EINA_TRUE);
return obj;
break;
case EFL_UI_FOCUS_DIRECTION_UP:
case EFL_UI_FOCUS_DIRECTION_LEFT:
elm_object_item_focus_set(last, EINA_TRUE);
return obj;
break;
case EFL_UI_FOCUS_DIRECTION_NEXT:
case EFL_UI_FOCUS_DIRECTION_PREVIOUS:
//do not go further with logical movement
return NULL;
break;
default:
ERR("Uncaught focus direction");
return NULL;
break;
}
}
EOLIAN static Efl_Ui_Focus_Object*
_elm_genlist_efl_ui_focus_manager_move(Eo *obj, Elm_Genlist_Data *pd, Efl_Ui_Focus_Direction direction)
{
if (efl_ui_focus_manager_focus_get(obj) == obj)
{
return _select_candidate(obj, pd, direction);
}
else
{
return efl_ui_focus_manager_move(efl_super(obj, MY_CLASS), direction);
}
}
EOLIAN static Eina_Bool
_elm_genlist_efl_ui_focus_object_on_focus_update(Eo *obj, Elm_Genlist_Data *sd)
{

View File

@ -556,6 +556,7 @@ class Elm.Genlist (Efl.Ui.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
Efl.Ui.Widget.focus_state_apply;
Efl.Ui.Focus.Manager.setup_on_first_touch;
Efl.Ui.Focus.Manager.manager_focus { get; }
Efl.Ui.Focus.Manager.move;
}
events {
item,focused: Efl.Object; [[Called when genlist item got focus]]