summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2017-12-03 21:23:29 +0100
committerLukasz Stanislawski <lukasz.stanislawski@gmail.com>2017-12-03 22:11:12 +0100
commit3541b1305ef8337cfee3f3b8c2b9768a8d93b944 (patch)
treea60eb5f65b47ad9fd9fbad0db4a955b93a4addcd
parentcc6a4af37bec3834ee2fd27d61a83ea3b667fd1c (diff)
downloadefl-3541b1305ef8337cfee3f3b8c2b9768a8d93b944.tar.gz
elm: efl_access_cache implementation
Summary: Change-Id: Ib2f65104d9daa3160221fb3920959018dcbeab5c Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5583
-rw-r--r--src/Makefile_Elementary.am1
-rw-r--r--src/lib/elementary/Elementary.h1
-rw-r--r--src/lib/elementary/a11y/efl_access_cache.c82
-rw-r--r--src/lib/elementary/a11y/efl_access_cache.eo13
4 files changed, 94 insertions, 3 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index efdf5c9c0b..e34f47353b 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -730,6 +730,7 @@ lib_elementary_libelementary_la_SOURCES = \
lib/elementary/elm_widget_item_static_focus.c \
lib/elementary/a11y/elm_bus_watcher.c \
lib/elementary/a11y/elm_atspi_bus_watcher.c \
+ lib/elementary/a11y/efl_access_cache.c \
$(NULL)
diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h
index eb3bd43435..6513a5d7f6 100644
--- a/src/lib/elementary/Elementary.h
+++ b/src/lib/elementary/Elementary.h
@@ -309,6 +309,7 @@ EAPI extern Elm_Version *elm_version;
# include <efl_ui_image_factory.eo.h>
# include <a11y/elm_bus_watcher.eo.h>
# include <a11y/elm_atspi_bus_watcher.eo.h>
+# include <a11y/efl_access_cache.eo.h>
#endif
/* include deprecated calls last of all */
diff --git a/src/lib/elementary/a11y/efl_access_cache.c b/src/lib/elementary/a11y/efl_access_cache.c
new file mode 100644
index 0000000000..0c93cc3552
--- /dev/null
+++ b/src/lib/elementary/a11y/efl_access_cache.c
@@ -0,0 +1,82 @@
+#ifdef HAVE_CONFIG_H
+ #include "elementary_config.h"
+#endif
+
+#include <Elementary.h>
+#include "elm_priv.h"
+#include "efl_access_cache.eo.h"
+
+typedef struct _Efl_Access_Cache_Data
+{
+ Eina_Hash *objects;
+ Efl_Access *root;
+} Efl_Access_Cache_Data;
+
+EOLIAN static Eo*
+_efl_access_cache_efl_object_constructor(Eo *obj, Efl_Access_Cache_Data *pd)
+{
+ obj = efl_constructor(efl_super(obj, EFL_ACCESS_CACHE_CLASS));
+ pd->objects = eina_hash_pointer_new(NULL);
+ return obj;
+}
+
+EOLIAN static void
+_efl_access_cache_efl_object_destructor(Eo *obj, Efl_Access_Cache_Data *pd)
+{
+ eina_hash_free(pd->objects);
+ efl_destructor(efl_super(obj, EFL_ACCESS_CACHE_CLASS));
+}
+
+EOLIAN static void
+_efl_access_cache_root_set(Efl_Access_Cache *obj, Efl_Access_Cache_Data *pd, Efl_Access *root)
+{
+ if (root == pd->root)
+ return;
+
+ pd->root = root;
+ efl_event_callback_call(obj, EFL_ACCESS_CACHE_EVENT_ROOT_CHANGED, root);
+}
+
+EOLIAN static Efl_Access*
+_efl_access_cache_root_get(Efl_Access_Cache *obj EINA_UNUSED, Efl_Access_Cache_Data *pd)
+{
+ return pd->root;
+}
+
+EOLIAN static Eina_Bool
+_efl_access_cache_contains(Efl_Access_Cache *obj EINA_UNUSED, Efl_Access_Cache_Data *pd, Efl_Access *access)
+{
+ return eina_hash_find(pd->objects, &access) != NULL;
+}
+
+EOLIAN static Eina_Bool
+_efl_access_cache_add(Efl_Access_Cache *obj EINA_UNUSED, Efl_Access_Cache_Data *pd, Efl_Access *access)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(access, EINA_FALSE);
+
+ if (!eina_hash_add(pd->objects, &access, access))
+ return EINA_FALSE;
+
+ efl_event_callback_call(obj, EFL_ACCESS_CACHE_EVENT_ADDED, access);
+ return EINA_TRUE;
+}
+
+EOLIAN static Eina_Bool
+_efl_access_cache_remove(Efl_Access_Cache *obj EINA_UNUSED, Efl_Access_Cache_Data *pd, Efl_Access *access)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(access, EINA_FALSE);
+
+ if (!eina_hash_del_by_key(pd->objects, &access))
+ return EINA_FALSE;
+
+ efl_event_callback_call(obj, EFL_ACCESS_CACHE_EVENT_REMOVED, access);
+ return EINA_TRUE;
+}
+
+EOLIAN static Eina_Iterator*
+_efl_access_cache_objects_iterator_new(Efl_Access_Cache *obj EINA_UNUSED, Efl_Access_Cache_Data *pd)
+{
+ return eina_hash_iterator_key_new(pd->objects);
+}
+
+#include "efl_access_cache.eo.c"
diff --git a/src/lib/elementary/a11y/efl_access_cache.eo b/src/lib/elementary/a11y/efl_access_cache.eo
index ec14dc53d3..8d25f3bd47 100644
--- a/src/lib/elementary/a11y/efl_access_cache.eo
+++ b/src/lib/elementary/a11y/efl_access_cache.eo
@@ -3,17 +3,19 @@ class Efl.Access.Cache (Efl.Object)
methods {
add {
params {
- @in obj: Efl.Access;
+ @in access: Efl.Access;
}
+ return: bool;
}
remove {
params {
- @in obj: Efl.Access;
+ @in access: Efl.Access;
}
+ return: bool;
}
contains {
params {
- @in obj: Efl.Access;
+ @in access: Efl.Access;
}
return: bool;
}
@@ -30,8 +32,13 @@ class Efl.Access.Cache (Efl.Object)
return: iterator<Efl.Access> @owned @warn_unused;
}
}
+ implements {
+ Efl.Object.constructor;
+ Efl.Object.destructor;
+ }
events {
added;
removed;
+ root,changed;
}
}