forked from enlightenment/efl
efl_ui_focus_manager: add new api to receive child configuration
This commit is contained in:
parent
78e7891029
commit
0eefeca64b
|
@ -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"
|
|
@ -9,6 +9,14 @@ enum Efl.Ui.Focus.Direction {
|
|||
last = 6
|
||||
}
|
||||
|
||||
struct Efl.Ui.Focus.Relations{
|
||||
right : list<Efl.Ui.Focus.Object>;
|
||||
left : list<Efl.Ui.Focus.Object>;
|
||||
top : list<Efl.Ui.Focus.Object>;
|
||||
down : list<Efl.Ui.Focus.Object>;
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue