access: implement AT-SPI2 interfaces in elm_access object. 25/65825/1
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Mon, 15 Jun 2015 12:00:16 +0000 (14:00 +0200)
committerPrasoon Singh <prasoon.16@samsung.com>
Wed, 13 Apr 2016 05:57:53 +0000 (11:27 +0530)
Path enables elm_access widgets to use access interfaces to commutnicate
with Assistive Technology Applications using AT-SPI2 interfaces.

Elm_access can be used to provide accessiblity features on Evas_Object
that do not inherit from elm_widget.

Conflicts:
src/lib/elm_access.c
src/lib/elm_access.eo

Change-Id: I1b45f9c7e2c854a8a025da0c57327d39d4611d3c

src/lib/elm_access.c
src/lib/elm_access.eo

index 2f20dc0..b33bec6 100644 (file)
@@ -2,6 +2,10 @@
 # include "elementary_config.h"
 #endif
 
+#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
+#define ELM_INTERFACE_ATSPI_COMPONENT_PROTECTED
+#define ELM_INTERFACE_ATSPI_ACTION_PROTECTED
+
 #include <Elementary.h>
 #include "elm_priv.h"
 
@@ -73,6 +77,17 @@ _access_action_callback_call(Evas_Object *obj,
    return ret;
 }
 
+static Eina_Bool
+_access_action_callback_have(Evas_Object *obj, Elm_Access_Action_Type type)
+{
+   Action_Info *a;
+   a = evas_object_data_get(obj, "_elm_access_action_info");
+
+   if (!a) return EINA_FALSE;
+
+   return a->fn[type].cb ? EINA_TRUE : EINA_FALSE;
+}
+
 EOLIAN static Eina_Bool
 _elm_access_elm_widget_activate(Eo *obj, void *_pd EINA_UNUSED, Elm_Activate act)
 {
@@ -1451,4 +1466,62 @@ _elm_access_class_constructor(Eo_Class *klass)
    evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
 }
 
+EOLIAN static char*
+_elm_access_elm_interface_atspi_accessible_name_get(Eo *obj, void *pd EINA_UNUSED)
+{
+   return elm_access_info_get(obj, ELM_ACCESS_INFO);
+}
+
+EOLIAN static const char*
+_elm_access_elm_interface_atspi_accessible_description_get(Eo *obj, void *pd EINA_UNUSED)
+{
+   return elm_access_info_get(obj, ELM_ACCESS_CONTEXT_INFO);
+}
+
+EOLIAN static Eina_Bool
+_elm_access_elm_interface_atspi_component_highlight_grab(Eo *obj, void *pd EINA_UNUSED)
+{
+   if (!_access_action_callback_call(obj, ELM_ACCESS_ACTION_HIGHLIGHT, NULL))
+     eo_do_super(obj, ELM_ACCESS_CLASS, elm_interface_atspi_component_highlight_grab());
+
+   return EINA_TRUE;
+}
+
+EOLIAN static Eina_Bool
+_elm_access_elm_interface_atspi_component_highlight_clear(Eo *obj, void *pd EINA_UNUSED)
+{
+   if (!_access_action_callback_call(obj, ELM_ACCESS_ACTION_UNHIGHLIGHT, NULL))
+     eo_do_super(obj, ELM_ACCESS_CLASS, elm_interface_atspi_component_highlight_clear());
+
+   return EINA_TRUE;
+}
+
+EOLIAN static Eina_Bool
+_elm_access_elm_interface_atspi_action_action_do(Eo *obj, void *pd EINA_UNUSED, int id)
+{
+   if (id != 0)
+     return EINA_FALSE;
+
+   return _access_action_callback_call(obj, ELM_ACCESS_ACTION_ACTIVATE, NULL);
+}
+
+EOLIAN static const char *
+_elm_access_elm_interface_atspi_action_name_get(Eo *obj, void *pd EINA_UNUSED, int id)
+{
+   if ((id != 0) || !_access_action_callback_have(obj, ELM_ACCESS_ACTION_ACTIVATE))
+     return NULL;
+   return "activate";
+}
+
+EOLIAN static Eina_List*
+_elm_access_elm_interface_atspi_action_actions_get(Eo *obj, void *pd EINA_UNUSED)
+{
+   Eina_List *ret = NULL;
+
+   if (_access_action_callback_have(obj, ELM_ACCESS_ACTION_ACTIVATE))
+      ret = eina_list_append(ret, &("activate"));
+
+   return ret;
+}
+
 #include "elm_access.eo.c"
index 8844d65..1f820dd 100644 (file)
@@ -1,4 +1,4 @@
-class Elm.Access (Elm.Widget)
+class Elm.Access (Elm.Widget, Elm_Interface_Atspi_Action)
 {
 eo_prefix: elm_obj_access;
    data: null;
@@ -8,6 +8,12 @@ eo_prefix: elm_obj_access;
       Evas.Object_Smart.add;
       Elm.Widget.activate;
       Elm.Widget.on_focus;
+      Elm_Interface_Atspi_Accessible.name.get;
+      Elm_Interface_Atspi_Accessible.description.get;
+      Elm_Interface_Atspi_Component.highlight_grab;
+      Elm_Interface_Atspi_Component.highlight_clear;
+      Elm_Interface_Atspi_Action.action_do;
+      Elm_Interface_Atspi_Action.name.get;
+      Elm_Interface_Atspi_Action.actions.get;
    }
-
 }