stanluk pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=4d72cad449a41e792113762d3162badb8f16720d

commit 4d72cad449a41e792113762d3162badb8f16720d
Author: Lukasz Stanislawski <l.stanisl...@samsung.com>
Date:   Tue May 26 16:28:35 2015 +0200

    toolbar: implement Atspi_Selection interface
    
    Allow to select and deselect toolbar items by Assistive Technology
    Clients through org.a11y.atspi.Selection dbus interface.
---
 src/lib/elm_toolbar.c  | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++
 src/lib/elm_toolbar.eo | 10 +++++-
 2 files changed, 104 insertions(+), 1 deletion(-)

diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c
index 609878d..d62edad 100644
--- a/src/lib/elm_toolbar.c
+++ b/src/lib/elm_toolbar.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
 
@@ -3827,5 +3828,99 @@ 
_elm_toolbar_elm_interface_atspi_accessible_state_set_get(Eo *obj, Elm_Toolbar_D
    return ret;
 }
 
+EOLIAN int
+_elm_toolbar_elm_interface_atspi_selection_selected_children_count_get(Eo *obj 
EINA_UNUSED, Elm_Toolbar_Data *pd)
+{
+   return pd->selected_item ? 1 : 0;
+}
+
+EOLIAN Eo*
+_elm_toolbar_elm_interface_atspi_selection_selected_child_get(Eo *obj 
EINA_UNUSED, Elm_Toolbar_Data *pd, int child_idx)
+{
+   if (child_idx != 0)
+     return NULL;
+
+   return pd->selected_item;
+}
+
+EOLIAN Eina_Bool
+_elm_toolbar_elm_interface_atspi_selection_child_select(Eo *obj EINA_UNUSED, 
Elm_Toolbar_Data *pd, int child_index)
+{
+   Elm_Toolbar_Item_Data *item;
+   if (pd->select_mode != ELM_OBJECT_SELECT_MODE_NONE)
+     {
+        EINA_INLIST_FOREACH(pd->items, item)
+          {
+             if (child_index-- == 0)
+               {
+                  elm_toolbar_item_selected_set(EO_OBJ(item), EINA_TRUE);
+                  return EINA_TRUE;
+               }
+          }
+     }
+   return EINA_FALSE;
+}
+
+EOLIAN Eina_Bool
+_elm_toolbar_elm_interface_atspi_selection_selected_child_deselect(Eo *obj 
EINA_UNUSED, Elm_Toolbar_Data *pd, int child_index)
+{
+   if (child_index != 0)
+     return EINA_FALSE;
+
+   if (!pd->selected_item)
+     return EINA_FALSE;
+
+   elm_toolbar_item_selected_set(pd->selected_item, EINA_FALSE);
+
+   return EINA_TRUE;
+}
+
+EOLIAN Eina_Bool
+_elm_toolbar_elm_interface_atspi_selection_is_child_selected(Eo *obj 
EINA_UNUSED, Elm_Toolbar_Data *pd, int child_index)
+{
+   Elm_Toolbar_Item_Data *item;
+
+   EINA_INLIST_FOREACH(pd->items, item)
+     {
+        if (child_index-- == 0)
+          {
+             return elm_toolbar_item_selected_get(EO_OBJ(item));
+          }
+     }
+   return EINA_FALSE;
+}
+
+EOLIAN Eina_Bool
+_elm_toolbar_elm_interface_atspi_selection_all_children_select(Eo *obj 
EINA_UNUSED, Elm_Toolbar_Data *pd EINA_UNUSED)
+{
+   return EINA_FALSE;
+}
+
+EOLIAN Eina_Bool
+_elm_toolbar_elm_interface_atspi_selection_clear(Eo *obj EINA_UNUSED, 
Elm_Toolbar_Data *pd)
+{
+   if (pd->selected_item)
+     elm_toolbar_item_selected_set(pd->selected_item, EINA_FALSE);
+   return EINA_TRUE;
+}
+
+EOLIAN Eina_Bool
+_elm_toolbar_elm_interface_atspi_selection_child_deselect(Eo *obj EINA_UNUSED, 
Elm_Toolbar_Data *pd, int child_index)
+{
+   Elm_Toolbar_Item_Data *item;
+   if (pd->select_mode != ELM_OBJECT_SELECT_MODE_NONE)
+     {
+        EINA_INLIST_FOREACH(pd->items, item)
+          {
+             if (child_index-- == 0)
+               {
+                  elm_toolbar_item_selected_set(EO_OBJ(item), EINA_FALSE);
+                  return EINA_TRUE;
+               }
+          }
+     }
+   return EINA_FALSE;
+}
+
 #include "elm_toolbar.eo.c"
 #include "elm_toolbar_item.eo.c"
diff --git a/src/lib/elm_toolbar.eo b/src/lib/elm_toolbar.eo
index 21c03ce..a6d6431 100644
--- a/src/lib/elm_toolbar.eo
+++ b/src/lib/elm_toolbar.eo
@@ -28,7 +28,7 @@ enum Elm.Toolbar.Shrink_Mode
 }
 
 class Elm.Toolbar (Elm.Widget, Elm_Interface_Scrollable,
-                   Elm_Interface_Atspi_Widget_Action)
+                   Elm_Interface_Atspi_Widget_Action, 
Elm_Interface_Atspi_Selection)
 {
    eo_prefix: elm_obj_toolbar;
    methods {
@@ -543,6 +543,14 @@ class Elm.Toolbar (Elm.Widget, Elm_Interface_Scrollable,
       Elm_Interface_Atspi_Widget_Action.elm_actions.get;
       Elm_Interface_Atspi_Accessible.children.get;
       Elm_Interface_Atspi_Accessible.state_set.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 {
       scroll;

-- 


Reply via email to