summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2015-05-26 15:34:52 +0200
committerLukasz Stanislawski <l.stanislaws@samsung.com>2015-05-26 15:36:06 +0200
commit9719b3560c4a1d9e821a0dcc499bfeeaca5b09c8 (patch)
tree7480d284a94b8b971220f99631d9fff7c712262d
parent59b300063eb4d335bda8b8d5e862d15a4ddd14ae (diff)
downloadelementary-9719b3560c4a1d9e821a0dcc499bfeeaca5b09c8.tar.gz
genlist: implement Atspi_Selection interface
Allow to select and deselect genlist items by Assistive Technology Clients through org.a11y.atspi.Selection dbus interface.
-rw-r--r--src/lib/elm_genlist.c101
-rw-r--r--src/lib/elm_genlist.eo10
2 files changed, 110 insertions, 1 deletions
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index 49623470e..af2e35a97 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -5,6 +5,7 @@
#include <fnmatch.h>
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
+#define ELM_INTERFACE_ATSPI_SELECTION_PROTECTED
#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
#define ELM_WIDGET_ITEM_PROTECTED
@@ -7991,5 +7992,105 @@ _elm_genlist_elm_interface_atspi_accessible_state_set_get(Eo *obj, Elm_Genlist_D
return ret;
}
+EOLIAN int
+_elm_genlist_elm_interface_atspi_selection_selected_children_count_get(Eo *objm EINA_UNUSED, Elm_Genlist_Data *pd)
+{
+ return eina_list_count(pd->selected);
+}
+
+EOLIAN Eo*
+_elm_genlist_elm_interface_atspi_selection_selected_child_get(Eo *obj EINA_UNUSED, Elm_Genlist_Data *pd, int child_idx)
+{
+ return eina_list_nth(pd->selected, child_idx);
+}
+
+EOLIAN Eina_Bool
+_elm_genlist_elm_interface_atspi_selection_child_select(Eo *obj EINA_UNUSED, Elm_Genlist_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_genlist_item_selected_set(EO_OBJ(item), EINA_TRUE);
+ return EINA_TRUE;
+ }
+ }
+ }
+ return EINA_FALSE;
+}
+
+EOLIAN Eina_Bool
+_elm_genlist_elm_interface_atspi_selection_selected_child_deselect(Eo *obj EINA_UNUSED, Elm_Genlist_Data *pd, int child_index)
+{
+ Eo *item;
+ Eina_List *l;
+
+ EINA_LIST_FOREACH(pd->selected, l, item)
+ {
+ if (child_index-- == 0)
+ {
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+ return EINA_TRUE;
+ }
+ }
+ return EINA_FALSE;
+}
+
+EOLIAN Eina_Bool
+_elm_genlist_elm_interface_atspi_selection_is_child_selected(Eo *obj EINA_UNUSED, Elm_Genlist_Data *pd, int child_index)
+{
+ Elm_Gen_Item *item;
+
+ EINA_INLIST_FOREACH(pd->items, item)
+ {
+ if (child_index-- == 0)
+ {
+ return elm_genlist_item_selected_get(EO_OBJ(item));
+ }
+ }
+ return EINA_FALSE;
+}
+
+EOLIAN Eina_Bool
+_elm_genlist_elm_interface_atspi_selection_all_children_select(Eo *obj, Elm_Genlist_Data *pd)
+{
+ Elm_Gen_Item *item;
+
+ if (!elm_genlist_multi_select_get(obj))
+ return EINA_FALSE;
+
+ EINA_INLIST_FOREACH(pd->items, item)
+ elm_genlist_item_selected_set(EO_OBJ(item), EINA_TRUE);
+
+ return EINA_TRUE;
+}
+
+EOLIAN Eina_Bool
+_elm_genlist_elm_interface_atspi_selection_clear(Eo *obj EINA_UNUSED, Elm_Genlist_Data *pd)
+{
+ return _all_items_deselect(pd);
+}
+
+EOLIAN Eina_Bool
+_elm_genlist_elm_interface_atspi_selection_child_deselect(Eo *obj EINA_UNUSED, Elm_Genlist_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_genlist_item_selected_set(EO_OBJ(item), EINA_FALSE);
+ return EINA_TRUE;
+ }
+ }
+ }
+ return EINA_FALSE;
+}
+
#include "elm_genlist.eo.c"
#include "elm_genlist_item.eo.c"
diff --git a/src/lib/elm_genlist.eo b/src/lib/elm_genlist.eo
index 8a4b612bf..552b4d39b 100644
--- a/src/lib/elm_genlist.eo
+++ b/src/lib/elm_genlist.eo
@@ -1,7 +1,7 @@
import elm_general;
class Elm.Genlist (Elm.Layout, Elm_Interface_Scrollable, Evas.Clickable_Interface,
- Elm_Interface_Atspi_Widget_Action)
+ Elm_Interface_Atspi_Widget_Action, Elm_Interface_Atspi_Selection)
{
eo_prefix: elm_obj_genlist;
methods {
@@ -731,6 +731,14 @@ class Elm.Genlist (Elm.Layout, Elm_Interface_Scrollable, Evas.Clickable_Interfac
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;