efl_ui_focus_manager: add new api to receive child configuration
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>
Fri, 4 Nov 2016 16:42:26 +0000 (17:42 +0100)
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>
Thu, 20 Apr 2017 12:38:57 +0000 (14:38 +0200)
src/lib/elementary/efl_ui_focus_manager.c
src/lib/elementary/efl_ui_focus_manager.eo

index 6a4f090..737a7b5 100644 (file)
@@ -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
index f61b37e..7db508d 100644 (file)
@@ -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;