aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel@osg.samsung.com>2018-04-13 17:07:30 +0200
committerMarcel Hollerbach <marcel@osg.samsung.com>2018-04-30 19:24:47 +0200
commit27d6f3a65d9afe56bc2faecede88e2db03423177 (patch)
tree149b5650c2f739e867cd66734ba1a79f7e20ba5c
parentefl_canvas_object: Add event info to animation events in eo (diff)
downloadefl-27d6f3a65d9afe56bc2faecede88e2db03423177.tar.gz
efl_ui_focus_util: add new function for complementing the direction
-rw-r--r--src/lib/elementary/efl_ui_focus_manager_calc.c26
-rw-r--r--src/lib/elementary/efl_ui_focus_util.c16
-rw-r--r--src/lib/elementary/efl_ui_focus_util.eo6
3 files changed, 27 insertions, 21 deletions
diff --git a/src/lib/elementary/efl_ui_focus_manager_calc.c b/src/lib/elementary/efl_ui_focus_manager_calc.c
index 0d29f42a84..a80b45fd07 100644
--- a/src/lib/elementary/efl_ui_focus_manager_calc.c
+++ b/src/lib/elementary/efl_ui_focus_manager_calc.c
@@ -107,22 +107,6 @@ _manager_in_chain_set(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd)
efl_class_name_get(pd->root->focusable), root);
}
-static Efl_Ui_Focus_Direction
-_complement(Efl_Ui_Focus_Direction dir)
-{
- #define COMP(a,b) \
- if (dir == a) return b; \
- if (dir == b) return a;
-
- COMP(EFL_UI_FOCUS_DIRECTION_RIGHT, EFL_UI_FOCUS_DIRECTION_LEFT)
- COMP(EFL_UI_FOCUS_DIRECTION_UP, EFL_UI_FOCUS_DIRECTION_DOWN)
- COMP(EFL_UI_FOCUS_DIRECTION_PREVIOUS, EFL_UI_FOCUS_DIRECTION_NEXT)
-
- #undef COMP
-
- return EFL_UI_FOCUS_DIRECTION_LAST;
-}
-
/*
* Set this new list of partners to the border.
* All old partners will be deleted
@@ -140,7 +124,7 @@ border_partners_set(Node *node, Efl_Ui_Focus_Direction direction, Eina_List *lis
EINA_LIST_FREE(border->partners, partner)
{
- Border *comp_border = &DIRECTION_ACCESS(partner, _complement(direction));
+ Border *comp_border = &DIRECTION_ACCESS(partner, efl_ui_focus_util_direction_complement(EFL_UI_FOCUS_UTIL_CLASS,direction));
comp_border->partners = eina_list_remove(comp_border->partners, node);
}
@@ -149,7 +133,7 @@ border_partners_set(Node *node, Efl_Ui_Focus_Direction direction, Eina_List *lis
EINA_LIST_FOREACH(border->partners, lnode, partner)
{
- Border *comp_border = &DIRECTION_ACCESS(partner,_complement(direction));
+ Border *comp_border = &DIRECTION_ACCESS(partner,efl_ui_focus_util_direction_complement(EFL_UI_FOCUS_UTIL_CLASS,direction));
comp_border->partners = eina_list_append(comp_border->partners, node);
}
@@ -168,7 +152,7 @@ border_onedirection_set(Node *node, Efl_Ui_Focus_Direction direction, Eina_List
EINA_LIST_FREE(border->one_direction, partner)
{
- Border *b = &DIRECTION_ACCESS(partner, _complement(direction));
+ Border *b = &DIRECTION_ACCESS(partner, efl_ui_focus_util_direction_complement(EFL_UI_FOCUS_UTIL_CLASS,direction));
b->cleanup_nodes = eina_list_remove(b->cleanup_nodes, node);
}
@@ -176,7 +160,7 @@ border_onedirection_set(Node *node, Efl_Ui_Focus_Direction direction, Eina_List
EINA_LIST_FOREACH(border->one_direction, lnode, partner)
{
- Border *comp_border = &DIRECTION_ACCESS(partner,_complement(direction));
+ Border *comp_border = &DIRECTION_ACCESS(partner,efl_ui_focus_util_direction_complement(EFL_UI_FOCUS_UTIL_CLASS,direction));
comp_border->cleanup_nodes = eina_list_append(comp_border->cleanup_nodes, node);
}
@@ -194,7 +178,7 @@ border_onedirection_cleanup(Node *node, Efl_Ui_Focus_Direction direction)
EINA_LIST_FREE(border->cleanup_nodes, partner)
{
- Border *b = &DIRECTION_ACCESS(partner, _complement(direction));
+ Border *b = &DIRECTION_ACCESS(partner, efl_ui_focus_util_direction_complement(EFL_UI_FOCUS_UTIL_CLASS,direction));
b->one_direction = eina_list_remove(b->one_direction, node);
}
}
diff --git a/src/lib/elementary/efl_ui_focus_util.c b/src/lib/elementary/efl_ui_focus_util.c
index ce3677f721..aa342a92f4 100644
--- a/src/lib/elementary/efl_ui_focus_util.c
+++ b/src/lib/elementary/efl_ui_focus_util.c
@@ -62,5 +62,21 @@ _efl_ui_focus_util_active_manager(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl
return manager;
}
+EOLIAN static Efl_Ui_Focus_Direction
+_efl_ui_focus_util_direction_complement(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Ui_Focus_Direction dir)
+{
+ #define COMP(a,b) \
+ if (dir == a) return b; \
+ if (dir == b) return a;
+
+ COMP(EFL_UI_FOCUS_DIRECTION_RIGHT, EFL_UI_FOCUS_DIRECTION_LEFT)
+ COMP(EFL_UI_FOCUS_DIRECTION_UP, EFL_UI_FOCUS_DIRECTION_DOWN)
+ COMP(EFL_UI_FOCUS_DIRECTION_PREVIOUS, EFL_UI_FOCUS_DIRECTION_NEXT)
+
+ #undef COMP
+
+ return EFL_UI_FOCUS_DIRECTION_LAST;
+}
+
#include "efl_ui_focus_util.eo.c"
diff --git a/src/lib/elementary/efl_ui_focus_util.eo b/src/lib/elementary/efl_ui_focus_util.eo
index 8b4293709a..fdf270874d 100644
--- a/src/lib/elementary/efl_ui_focus_util.eo
+++ b/src/lib/elementary/efl_ui_focus_util.eo
@@ -14,5 +14,11 @@ class Efl.Ui.Focus.Util(Efl.Object) {
}
return: Efl.Ui.Focus.Manager;
}
+ direction_complement @class {
+ params {
+ dir : Efl.Ui.Focus.Direction;
+ }
+ return: Efl.Ui.Focus.Direction;
+ }
}
}