forked from enlightenment/efl
efl_ui_focus_manager_sub: update to recenent changes
This commit is contained in:
parent
7eb1df349c
commit
669db4841a
|
@ -6,11 +6,11 @@
|
||||||
#include "elm_priv.h"
|
#include "elm_priv.h"
|
||||||
|
|
||||||
#define MY_CLASS EFL_UI_FOCUS_MANAGER_SUB_CLASS
|
#define MY_CLASS EFL_UI_FOCUS_MANAGER_SUB_CLASS
|
||||||
#define MY_DATA(o, p) Efl_Ui_Focus_Manager_Sub_Data *pd = efl_data_scope_get(o, MY_CLASS);
|
#define MY_DATA(o, p) Efl_Ui_Focus_Manager_Sub_Data *p = efl_data_scope_get(o, MY_CLASS);
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
Efl_Ui_Focus_Manager *manager;//the manager where current_border is currently registered
|
||||||
Eina_Bool self_dirty;
|
Eina_Bool self_dirty;
|
||||||
Eina_List *current_border; //the current set of widgets which is registered as borders
|
Eina_List *current_border; //the current set of widgets which is registered as borders
|
||||||
Efl_Ui_Focus_Manager *manager;//the manager where current_border is currently registered
|
|
||||||
} Efl_Ui_Focus_Manager_Sub_Data;
|
} Efl_Ui_Focus_Manager_Sub_Data;
|
||||||
|
|
||||||
static Eina_List*
|
static Eina_List*
|
||||||
|
@ -34,9 +34,15 @@ _border_flush(Eo *obj, Efl_Ui_Focus_Manager_Sub_Data *pd)
|
||||||
{
|
{
|
||||||
Eina_Iterator *borders;
|
Eina_Iterator *borders;
|
||||||
Eina_List *selection, *tmp;
|
Eina_List *selection, *tmp;
|
||||||
Efl_Ui_Focus_Object *node;
|
Efl_Ui_Focus_Object *node, *logical;
|
||||||
|
Efl_Ui_Focus_Manager *manager;
|
||||||
|
Efl_Ui_Focus_Manager *elem;
|
||||||
|
|
||||||
|
elem = efl_parent_get(obj);
|
||||||
|
manager = efl_ui_focus_user_manager_get(elem);
|
||||||
|
logical = efl_ui_focus_user_parent_get(elem);
|
||||||
borders = efl_ui_focus_manager_border_elements_get(obj);
|
borders = efl_ui_focus_manager_border_elements_get(obj);
|
||||||
|
|
||||||
selection = NULL;
|
selection = NULL;
|
||||||
EINA_ITERATOR_FOREACH(borders, node)
|
EINA_ITERATOR_FOREACH(borders, node)
|
||||||
{
|
{
|
||||||
|
@ -50,7 +56,8 @@ _border_flush(Eo *obj, Efl_Ui_Focus_Manager_Sub_Data *pd)
|
||||||
|
|
||||||
EINA_LIST_FREE(tmp, node)
|
EINA_LIST_FREE(tmp, node)
|
||||||
{
|
{
|
||||||
efl_ui_focus_manager_unregister(pd->manager, node);
|
if (node == elem) continue;
|
||||||
|
efl_ui_focus_manager_unregister(manager, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
//set of the elements which are new without those which are currently registered
|
//set of the elements which are new without those which are currently registered
|
||||||
|
@ -59,7 +66,8 @@ _border_flush(Eo *obj, Efl_Ui_Focus_Manager_Sub_Data *pd)
|
||||||
|
|
||||||
EINA_LIST_FREE(tmp, node)
|
EINA_LIST_FREE(tmp, node)
|
||||||
{
|
{
|
||||||
efl_ui_focus_manager_register(pd->manager, node, efl_ui_focus_user_parent_get(obj), obj);
|
if (node == elem) continue;
|
||||||
|
efl_ui_focus_manager_register(manager, node, logical, elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
eina_list_free(pd->current_border);
|
eina_list_free(pd->current_border);
|
||||||
|
@ -67,13 +75,19 @@ _border_flush(Eo *obj, Efl_Ui_Focus_Manager_Sub_Data *pd)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_border_unregister(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Sub_Data *pd)
|
_border_unregister(Eo *obj, Efl_Ui_Focus_Manager_Sub_Data *pd)
|
||||||
{
|
{
|
||||||
Efl_Ui_Focus_Object *node;
|
Efl_Ui_Focus_Object *node;
|
||||||
|
Efl_Ui_Focus_Manager *manager;
|
||||||
|
Efl_Ui_Focus_Manager *elem;
|
||||||
|
|
||||||
|
elem = efl_parent_get(obj);
|
||||||
|
|
||||||
|
manager = efl_ui_focus_user_manager_get(elem);
|
||||||
EINA_LIST_FREE(pd->current_border, node)
|
EINA_LIST_FREE(pd->current_border, node)
|
||||||
{
|
{
|
||||||
efl_ui_focus_manager_unregister(pd->manager, node);
|
if (node == elem) continue;
|
||||||
|
efl_ui_focus_manager_unregister(manager, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
pd->current_border = NULL;
|
pd->current_border = NULL;
|
||||||
|
@ -84,7 +98,7 @@ _parent_manager_pre_flush(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||||
{
|
{
|
||||||
MY_DATA(data, pd);
|
MY_DATA(data, pd);
|
||||||
|
|
||||||
if (!pd->self_dirty) return; //we are not interested
|
//if (!pd->self_dirty) return; //we are not interested
|
||||||
|
|
||||||
_border_flush(data, pd);
|
_border_flush(data, pd);
|
||||||
}
|
}
|
||||||
|
@ -94,9 +108,9 @@ EFL_CALLBACKS_ARRAY_DEFINE(parent_manager,
|
||||||
);
|
);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_self_manager_dirty(void *data EINA_UNUSED, const Efl_Event *ev)
|
_self_manager_dirty(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
|
||||||
{
|
{
|
||||||
MY_DATA(ev->object , pd);
|
MY_DATA(data, pd);
|
||||||
|
|
||||||
pd->self_dirty = EINA_TRUE;
|
pd->self_dirty = EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -104,34 +118,41 @@ _self_manager_dirty(void *data EINA_UNUSED, const Efl_Event *ev)
|
||||||
static void
|
static void
|
||||||
_logical_manager_change(void *data EINA_UNUSED, const Efl_Event *ev)
|
_logical_manager_change(void *data EINA_UNUSED, const Efl_Event *ev)
|
||||||
{
|
{
|
||||||
MY_DATA(ev->object, pd);
|
MY_DATA(data, pd);
|
||||||
Eina_List *n;
|
Eina_List *n;
|
||||||
Efl_Ui_Focus_User *b;
|
Efl_Ui_Focus_User *b;
|
||||||
|
Efl_Ui_Focus_Manager *manager;
|
||||||
|
manager = efl_ui_focus_user_manager_get(ev->object);
|
||||||
|
|
||||||
EINA_LIST_FOREACH(pd->current_border , n, b)
|
EINA_LIST_FOREACH(pd->current_border, n, b)
|
||||||
{
|
{
|
||||||
efl_ui_focus_manager_update_parent(pd->manager , b, ev->info);
|
if (b == ev->object) continue;
|
||||||
|
efl_ui_focus_manager_update_parent(manager, b, ev->info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_manager_change(void *data EINA_UNUSED, const Efl_Event *ev)
|
_manager_change(void *data, const Efl_Event *ev)
|
||||||
{
|
{
|
||||||
MY_DATA(ev->object, pd);
|
MY_DATA(data, pd);
|
||||||
Eina_List *n;
|
|
||||||
Efl_Ui_Focus_User *b;
|
|
||||||
Efl_Ui_Focus_Manager *manager;
|
|
||||||
|
|
||||||
manager = efl_ui_focus_user_manager_get(ev->info);
|
Efl_Ui_Focus_Manager *manager;
|
||||||
|
Efl_Ui_Focus_Object *logical;
|
||||||
|
Efl_Ui_Focus_User *b;
|
||||||
|
Eina_List *n;
|
||||||
|
|
||||||
|
logical = efl_ui_focus_user_parent_get(ev->object);
|
||||||
|
manager = efl_ui_focus_user_manager_get(ev->object);
|
||||||
|
|
||||||
//unregister from the old
|
//unregister from the old
|
||||||
efl_event_callback_array_del(pd->manager, parent_manager(), ev->object);
|
efl_event_callback_array_del(pd->manager, parent_manager(), data);
|
||||||
efl_event_callback_array_add(manager, parent_manager(), ev->object);
|
efl_event_callback_array_add(manager, parent_manager(), data);
|
||||||
|
|
||||||
EINA_LIST_FOREACH(pd->current_border , n, b)
|
EINA_LIST_FOREACH(pd->current_border , n, b)
|
||||||
{
|
{
|
||||||
|
if (b == ev->object) continue;
|
||||||
efl_ui_focus_manager_unregister(pd->manager, b);
|
efl_ui_focus_manager_unregister(pd->manager, b);
|
||||||
efl_ui_focus_manager_register(manager, b, efl_ui_focus_user_parent_get(ev->object), ev->object);
|
efl_ui_focus_manager_register(manager, b, logical, ev->object);
|
||||||
}
|
}
|
||||||
//unregister the old manager, use the new
|
//unregister the old manager, use the new
|
||||||
pd->manager = manager;
|
pd->manager = manager;
|
||||||
|
@ -143,19 +164,23 @@ EFL_CALLBACKS_ARRAY_DEFINE(self_manager,
|
||||||
{EFL_UI_FOCUS_USER_EVENT_MANAGER_CHANGED, _manager_change}
|
{EFL_UI_FOCUS_USER_EVENT_MANAGER_CHANGED, _manager_change}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_efl_ui_focus_manager_sub_efl_object_parent_set(Eo *obj, Efl_Ui_Focus_Manager_Sub_Data *pd EINA_UNUSED, Efl_Object *parent)
|
||||||
|
{
|
||||||
|
efl_event_callback_array_del(efl_parent_get(obj), self_manager(), obj);
|
||||||
|
efl_parent_set(efl_super(obj, MY_CLASS), parent);
|
||||||
|
efl_event_callback_array_add(efl_parent_get(obj), self_manager(), obj);
|
||||||
|
}
|
||||||
|
|
||||||
EOLIAN static Efl_Object*
|
EOLIAN static Efl_Object*
|
||||||
_efl_ui_focus_manager_sub_efl_object_constructor(Eo *obj, Efl_Ui_Focus_Manager_Sub_Data *pd EINA_UNUSED)
|
_efl_ui_focus_manager_sub_efl_object_constructor(Eo *obj, Efl_Ui_Focus_Manager_Sub_Data *pd EINA_UNUSED)
|
||||||
{
|
{
|
||||||
efl_event_callback_array_add(obj, self_manager(), NULL);
|
|
||||||
|
|
||||||
return efl_constructor(efl_super(obj, MY_CLASS));
|
return efl_constructor(efl_super(obj, MY_CLASS));
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_ui_focus_manager_sub_efl_object_destructor(Eo *obj, Efl_Ui_Focus_Manager_Sub_Data *pd)
|
_efl_ui_focus_manager_sub_efl_object_destructor(Eo *obj, Efl_Ui_Focus_Manager_Sub_Data *pd)
|
||||||
{
|
{
|
||||||
efl_event_callback_array_del(obj, self_manager(), NULL);
|
|
||||||
|
|
||||||
_border_unregister(obj, pd);
|
_border_unregister(obj, pd);
|
||||||
|
|
||||||
return efl_destructor(efl_super(obj, MY_CLASS));
|
return efl_destructor(efl_super(obj, MY_CLASS));
|
||||||
|
|
|
@ -2,17 +2,19 @@ class Efl.Ui.Focus.Manager.Sub (Efl.Ui.Focus.Manager, Efl.Object)
|
||||||
{
|
{
|
||||||
[[A abstract class to have a sub manager
|
[[A abstract class to have a sub manager
|
||||||
|
|
||||||
This submanager will register its border elements on the parent manager. The parent manager is found with the Efl.Ui.Focus.User interface.
|
This submanager will register its border elements on the parent manager. The parent manager is found with the Efl.Ui.Focus.User interface of the eo parent.
|
||||||
|
|
||||||
Each submanager also has to be a focus object, the object itself will be registered into the parent manager. It will be used as logical parent while registering the border elements.
|
Each submanager also has to be a focus object, the object itself will be registered into the parent manager. It will be used as logical parent while registering the border elements.
|
||||||
|
|
||||||
You can filter the border elements by overriding the border_elements property of the manager.
|
You can filter the border elements by overriding the border_elements property of the manager.
|
||||||
|
|
||||||
|
This class is only working as composite object to a Efl.Ui.Focus.User and Efl.Ui.Focus.Object.
|
||||||
]]
|
]]
|
||||||
methods {
|
methods {
|
||||||
|
|
||||||
}
|
}
|
||||||
implements {
|
implements {
|
||||||
Efl.Object.constructor;
|
Efl.Object.constructor;
|
||||||
Efl.Object.destructor;
|
Efl.Object.destructor;
|
||||||
|
Efl.Object.parent.set;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue