forked from enlightenment/efl
efl_ui_focus_manager: new api for adding a logical widget
a widget which is registered logically will not be used for right left top or down relations.
This commit is contained in:
parent
9aa7c63b2f
commit
f2248410b2
|
@ -36,6 +36,7 @@ struct _Border {
|
||||||
typedef enum {
|
typedef enum {
|
||||||
NODE_TYPE_NORMAL = 0,
|
NODE_TYPE_NORMAL = 0,
|
||||||
NODE_TYPE_LISTENER = 1,
|
NODE_TYPE_LISTENER = 1,
|
||||||
|
NODE_TYPE_ONLY_LOGICAL = 2,
|
||||||
} Node_Type;
|
} Node_Type;
|
||||||
|
|
||||||
struct _Node{
|
struct _Node{
|
||||||
|
@ -252,12 +253,17 @@ _calculate_node(Efl_Ui_Focus_Manager_Data *pd, Efl_Ui_Focus_Object *node, Dimens
|
||||||
|
|
||||||
EINA_ITERATOR_FOREACH(nodes, focus_key)
|
EINA_ITERATOR_FOREACH(nodes, focus_key)
|
||||||
{
|
{
|
||||||
|
Node *n;
|
||||||
Eina_Rectangle op_rect = EINA_RECTANGLE_INIT;
|
Eina_Rectangle op_rect = EINA_RECTANGLE_INIT;
|
||||||
int min, max;
|
int min, max;
|
||||||
|
|
||||||
op = *focus_key;
|
op = *focus_key;
|
||||||
if (op == node) continue;
|
if (op == node) continue;
|
||||||
|
|
||||||
|
n = node_get(pd, op);
|
||||||
|
|
||||||
|
if (n->type == NODE_TYPE_ONLY_LOGICAL) continue;
|
||||||
|
|
||||||
efl_ui_focus_object_geometry_get(op, &op_rect);
|
efl_ui_focus_object_geometry_get(op, &op_rect);
|
||||||
|
|
||||||
if (dim == DIMENSION_X)
|
if (dim == DIMENSION_X)
|
||||||
|
@ -430,6 +436,12 @@ dirty_flush(Efl_Ui_Focus_Manager *obj, Efl_Ui_Focus_Manager_Data *pd)
|
||||||
static void
|
static void
|
||||||
dirty_add(Eo *obj, Efl_Ui_Focus_Manager_Data *pd, Node *dirty)
|
dirty_add(Eo *obj, Efl_Ui_Focus_Manager_Data *pd, Node *dirty)
|
||||||
{
|
{
|
||||||
|
if (dirty->type == NODE_TYPE_ONLY_LOGICAL)
|
||||||
|
{
|
||||||
|
ERR("Only not only logical nodes can be marked dirty");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//if (eina_list_data_find(pd->dirty, dirty)) return;
|
//if (eina_list_data_find(pd->dirty, dirty)) return;
|
||||||
pd->dirty = eina_list_remove(pd->dirty, dirty);
|
pd->dirty = eina_list_remove(pd->dirty, dirty);
|
||||||
pd->dirty = eina_list_append(pd->dirty, dirty);
|
pd->dirty = eina_list_append(pd->dirty, dirty);
|
||||||
|
@ -494,11 +506,29 @@ _register(Eo *obj, Efl_Ui_Focus_Manager_Data *pd, Efl_Ui_Focus_Object *child, No
|
||||||
T(parent).children = eina_list_append(T(parent).children, node);
|
T(parent).children = eina_list_append(T(parent).children, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
//listen to changes
|
|
||||||
efl_event_callback_array_add(child, focusable_node(), obj);
|
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_efl_ui_focus_manager_register_logical(Eo *obj, Efl_Ui_Focus_Manager_Data *pd, Efl_Ui_Focus_Object *child, Efl_Ui_Focus_Object *parent)
|
||||||
|
{
|
||||||
|
Node *node = NULL;
|
||||||
|
Node *pnode = NULL;
|
||||||
|
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(child, EINA_FALSE);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, EINA_FALSE);
|
||||||
|
|
||||||
|
pnode = node_get(pd, parent);
|
||||||
|
if (!pnode) return EINA_FALSE;
|
||||||
|
|
||||||
|
node = _register(obj, pd, child, pnode);
|
||||||
|
if (!node) return EINA_FALSE;
|
||||||
|
|
||||||
|
node->type = NODE_TYPE_ONLY_LOGICAL;
|
||||||
|
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
EOLIAN static Eina_Bool
|
EOLIAN static Eina_Bool
|
||||||
_efl_ui_focus_manager_register(Eo *obj, Efl_Ui_Focus_Manager_Data *pd, Efl_Ui_Focus_Object *child, Efl_Ui_Focus_Object *parent, Efl_Ui_Focus_Manager *redirect)
|
_efl_ui_focus_manager_register(Eo *obj, Efl_Ui_Focus_Manager_Data *pd, Efl_Ui_Focus_Object *child, Efl_Ui_Focus_Object *parent, Efl_Ui_Focus_Manager *redirect)
|
||||||
|
@ -515,6 +545,9 @@ _efl_ui_focus_manager_register(Eo *obj, Efl_Ui_Focus_Manager_Data *pd, Efl_Ui_Fo
|
||||||
node = _register(obj, pd, child, pnode);
|
node = _register(obj, pd, child, pnode);
|
||||||
if (!node) return EINA_FALSE;
|
if (!node) return EINA_FALSE;
|
||||||
|
|
||||||
|
//listen to changes
|
||||||
|
efl_event_callback_array_add(child, focusable_node(), obj);
|
||||||
|
|
||||||
if (!redirect)
|
if (!redirect)
|
||||||
{
|
{
|
||||||
node->type = NODE_TYPE_NORMAL;
|
node->type = NODE_TYPE_NORMAL;
|
||||||
|
@ -1021,6 +1054,9 @@ _efl_ui_focus_manager_root_set(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Data *p
|
||||||
|
|
||||||
node = _register(obj, pd, root, NULL);
|
node = _register(obj, pd, root, NULL);
|
||||||
|
|
||||||
|
//listen to changes
|
||||||
|
efl_event_callback_array_add(node->focusable, focusable_node(), obj);
|
||||||
|
|
||||||
pd->root = node;
|
pd->root = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,18 @@ class Efl.Ui.Focus.Manager (Efl.Object) {
|
||||||
}
|
}
|
||||||
return : bool; [[$true if it was successfull $false if not]]
|
return : bool; [[$true if it was successfull $false if not]]
|
||||||
}
|
}
|
||||||
|
register_logical {
|
||||||
|
[[Register a new item just for the logical parent.
|
||||||
|
|
||||||
|
This item can just be used as a parent for a child. It cannot be reached via coordinate wise movements.
|
||||||
|
]]
|
||||||
|
params {
|
||||||
|
child : Efl.Ui.Focus.Object @nonull;
|
||||||
|
parent : Efl.Ui.Focus.Object @nonull;
|
||||||
|
}
|
||||||
|
return : bool; [[$true if it was successfull $false if not]]
|
||||||
|
}
|
||||||
|
|
||||||
update_redirect {
|
update_redirect {
|
||||||
[[Set a new redirect object for the given child
|
[[Set a new redirect object for the given child
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue