stanluk pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=571a83a019a04002a4aa96265c73a0531c94dc28

commit 571a83a019a04002a4aa96265c73a0531c94dc28
Author: Lukasz Stanislawski <l.stanisl...@samsung.com>
Date:   Wed May 27 08:23:17 2015 +0200

    gengrid: implement Atspi_Selection interface
    
    Allow to select and deselect gengrid items by Assistive Technology
    Clients through org.a11y.atspi.Selection dbus interface.
---
 src/lib/elm_gengrid.c  | 101 +++++++++++++++++++++++++++++++++++++++++++++++++
 src/lib/elm_gengrid.eo |  11 +++++-
 2 files changed, 111 insertions(+), 1 deletion(-)

diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c
index cb9aa78..5089f21 100644
--- a/src/lib/elm_gengrid.c
+++ b/src/lib/elm_gengrid.c
@@ -3,6 +3,7 @@
 #endif
 
 #define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
+#define ELM_INTERFACE_ATSPI_SELECTION_PROTECTED
 #define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
 #define ELM_WIDGET_ITEM_PROTECTED
 
@@ -5167,5 +5168,105 @@ 
_elm_gengrid_elm_interface_atspi_accessible_state_set_get(Eo *obj, Elm_Gengrid_D
    return ret;
 }
 
+EOLIAN int
+_elm_gengrid_elm_interface_atspi_selection_selected_children_count_get(Eo 
*objm EINA_UNUSED, Elm_Gengrid_Data *pd)
+{
+   return eina_list_count(pd->selected);
+}
+
+EOLIAN Eo*
+_elm_gengrid_elm_interface_atspi_selection_selected_child_get(Eo *obj 
EINA_UNUSED, Elm_Gengrid_Data *pd, int child_idx)
+{
+   return eina_list_nth(pd->selected, child_idx);
+}
+
+EOLIAN Eina_Bool
+_elm_gengrid_elm_interface_atspi_selection_child_select(Eo *obj EINA_UNUSED, 
Elm_Gengrid_Data *pd, int child_index)
+{
+   Elm_Gen_Item *item;
+   if (pd->select_mode != ELM_OBJECT_SELECT_MODE_NONE)
+     {
+        EINA_INLIST_FOREACH(pd->items, item)
+          {
+             if (child_index-- == 0)
+               {
+                  elm_gengrid_item_selected_set(EO_OBJ(item), EINA_TRUE);
+                  return EINA_TRUE;
+               }
+          }
+     }
+   return EINA_FALSE;
+}
+
+EOLIAN Eina_Bool
+_elm_gengrid_elm_interface_atspi_selection_selected_child_deselect(Eo *obj 
EINA_UNUSED, Elm_Gengrid_Data *pd, int child_index)
+{
+   Eo *item;
+   Eina_List *l;
+
+   EINA_LIST_FOREACH(pd->selected, l, item)
+     {
+        if (child_index-- == 0)
+          {
+             elm_gengrid_item_selected_set(item, EINA_FALSE);
+             return EINA_TRUE;
+          }
+     }
+   return EINA_FALSE;
+}
+
+EOLIAN Eina_Bool
+_elm_gengrid_elm_interface_atspi_selection_is_child_selected(Eo *obj 
EINA_UNUSED, Elm_Gengrid_Data *pd, int child_index)
+{
+   Elm_Gen_Item *item;
+
+   EINA_INLIST_FOREACH(pd->items, item)
+     {
+        if (child_index-- == 0)
+          {
+             return elm_gengrid_item_selected_get(EO_OBJ(item));
+          }
+     }
+   return EINA_FALSE;
+}
+
+EOLIAN Eina_Bool
+_elm_gengrid_elm_interface_atspi_selection_all_children_select(Eo *obj, 
Elm_Gengrid_Data *pd)
+{
+   Elm_Gen_Item *item;
+
+   if (!elm_gengrid_multi_select_get(obj))
+     return EINA_FALSE;
+
+   EINA_INLIST_FOREACH(pd->items, item)
+      elm_gengrid_item_selected_set(EO_OBJ(item), EINA_TRUE);
+
+   return EINA_TRUE;
+}
+
+EOLIAN Eina_Bool
+_elm_gengrid_elm_interface_atspi_selection_clear(Eo *obj EINA_UNUSED, 
Elm_Gengrid_Data *pd)
+{
+   return _all_items_deselect(pd);
+}
+
+EOLIAN Eina_Bool
+_elm_gengrid_elm_interface_atspi_selection_child_deselect(Eo *obj EINA_UNUSED, 
Elm_Gengrid_Data *pd, int child_index)
+{
+   Elm_Gen_Item *item;
+   if (pd->select_mode != ELM_OBJECT_SELECT_MODE_NONE)
+     {
+        EINA_INLIST_FOREACH(pd->items, item)
+          {
+             if (child_index-- == 0)
+               {
+                  elm_gengrid_item_selected_set(EO_OBJ(item), EINA_FALSE);
+                  return EINA_TRUE;
+               }
+          }
+     }
+   return EINA_FALSE;
+}
+
 #include "elm_gengrid.eo.c"
 #include "elm_gengrid_item.eo.c"
diff --git a/src/lib/elm_gengrid.eo b/src/lib/elm_gengrid.eo
index d688f33..e343f94 100644
--- a/src/lib/elm_gengrid.eo
+++ b/src/lib/elm_gengrid.eo
@@ -1,7 +1,8 @@
 import elm_general;
 
 class Elm.Gengrid (Elm.Layout, Elm_Interface_Scrollable,
-                   Evas.Clickable_Interface, Elm_Interface_Atspi_Widget_Action)
+                   Evas.Clickable_Interface, Elm_Interface_Atspi_Widget_Action,
+                   Elm_Interface_Atspi_Selection)
 {
    eo_prefix: elm_obj_gengrid;
    methods {
@@ -707,6 +708,14 @@ class Elm.Gengrid (Elm.Layout, Elm_Interface_Scrollable,
       Elm_Interface_Atspi_Accessible.children.get;
       Elm_Interface_Atspi_Accessible.state_set.get;
       Elm_Interface_Atspi_Widget_Action.elm_actions.get;
+      Elm_Interface_Atspi_Selection.selected_children_count.get;
+      Elm_Interface_Atspi_Selection.selected_child.get;
+      Elm_Interface_Atspi_Selection.selected_child_deselect;
+      Elm_Interface_Atspi_Selection.child_select;
+      Elm_Interface_Atspi_Selection.child_deselect;
+      Elm_Interface_Atspi_Selection.is_child_selected;
+      Elm_Interface_Atspi_Selection.all_children_select;
+      Elm_Interface_Atspi_Selection.clear;
    }
    events {
       language,changed;

-- 


Reply via email to