diff --git a/src/lib/elementary/efl_ui_focus_manager.c b/src/lib/elementary/efl_ui_focus_manager.c index 6a4f090d82..737a7b5c44 100644 --- a/src/lib/elementary/efl_ui_focus_manager.c +++ b/src/lib/elementary/efl_ui_focus_manager.c @@ -1048,4 +1048,45 @@ _efl_ui_focus_manager_efl_object_finalize(Eo *obj, Efl_Ui_Focus_Manager_Data *pd return result; } +static Eina_List* +_convert(Eina_List *node_list) +{ + Eina_List *n, *par = NULL; + Node *node; + + EINA_LIST_FOREACH(node_list, n, node) + par = eina_list_append(par, node->focusable); + + return par; +} + +EOLIAN static Efl_Ui_Focus_Relations* +_efl_ui_focus_manager_fetch(Eo *obj, Efl_Ui_Focus_Manager_Data *pd, Efl_Ui_Focus_Object *child) +{ + Efl_Ui_Focus_Relations *res; + Node *n; + + n = node_get(pd, child); + + if (!n) return NULL; + + res = calloc(1, sizeof(Efl_Ui_Focus_Relations)); + + dirty_flush(obj, pd); + +#define DIR_CLONE(dir) _convert(G(n).directions[dir].partners); + + res->right = DIR_CLONE(EFL_UI_FOCUS_DIRECTION_RIGHT); + res->left = DIR_CLONE(EFL_UI_FOCUS_DIRECTION_LEFT); + res->top = DIR_CLONE(EFL_UI_FOCUS_DIRECTION_UP); + res->down = DIR_CLONE(EFL_UI_FOCUS_DIRECTION_DOWN); + res->next = _next(n)->focusable; + res->prev = _prev(n)->focusable; + +#undef DIR_CLONE + + return res; +} + + #include "efl_ui_focus_manager.eo.c" \ No newline at end of file diff --git a/src/lib/elementary/efl_ui_focus_manager.eo b/src/lib/elementary/efl_ui_focus_manager.eo index f61b37e357..7db508dd0d 100644 --- a/src/lib/elementary/efl_ui_focus_manager.eo +++ b/src/lib/elementary/efl_ui_focus_manager.eo @@ -9,6 +9,14 @@ enum Efl.Ui.Focus.Direction { last = 6 } +struct Efl.Ui.Focus.Relations{ + right : list; + left : list; + top : list; + down : list; + next : Efl.Ui.Focus.Object; + prev : Efl.Ui.Focus.Object; +} class Efl.Ui.Focus.Manager (Efl.Object) { [[Calculates the directions of Efl.Ui.Focus.Direction @@ -120,6 +128,17 @@ class Efl.Ui.Focus.Manager (Efl.Object) { root : Efl.Ui.Focus.Object @nonull; [[Will be registered into this manager object]] } } + fetch { + [[This will fetch the data from a registered node + + Be aware this function will trigger all dirty nodes to be computed + ]] + params { + child : Efl.Ui.Focus.Object; + } + + return : own(ptr(Efl.Ui.Focus.Relations)); + } } implements { Efl.Object.constructor;