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)
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 @@
5#include <fnmatch.h> 5#include <fnmatch.h>
6 6
7#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED 7#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
8#define ELM_INTERFACE_ATSPI_SELECTION_PROTECTED
8#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED 9#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
9#define ELM_WIDGET_ITEM_PROTECTED 10#define ELM_WIDGET_ITEM_PROTECTED
10 11
@@ -7991,5 +7992,105 @@ _elm_genlist_elm_interface_atspi_accessible_state_set_get(Eo *obj, Elm_Genlist_D
7991 return ret; 7992 return ret;
7992} 7993}
7993 7994
7995EOLIAN int
7996_elm_genlist_elm_interface_atspi_selection_selected_children_count_get(Eo *objm EINA_UNUSED, Elm_Genlist_Data *pd)
7997{
7998 return eina_list_count(pd->selected);
7999}
8000
8001EOLIAN Eo*
8002_elm_genlist_elm_interface_atspi_selection_selected_child_get(Eo *obj EINA_UNUSED, Elm_Genlist_Data *pd, int child_idx)
8003{
8004 return eina_list_nth(pd->selected, child_idx);
8005}
8006
8007EOLIAN Eina_Bool
8008_elm_genlist_elm_interface_atspi_selection_child_select(Eo *obj EINA_UNUSED, Elm_Genlist_Data *pd, int child_index)
8009{
8010 Elm_Gen_Item *item;
8011 if (pd->select_mode != ELM_OBJECT_SELECT_MODE_NONE)
8012 {
8013 EINA_INLIST_FOREACH(pd->items, item)
8014 {
8015 if (child_index-- == 0)
8016 {
8017 elm_genlist_item_selected_set(EO_OBJ(item), EINA_TRUE);
8018 return EINA_TRUE;
8019 }
8020 }
8021 }
8022 return EINA_FALSE;
8023}
8024
8025EOLIAN Eina_Bool
8026_elm_genlist_elm_interface_atspi_selection_selected_child_deselect(Eo *obj EINA_UNUSED, Elm_Genlist_Data *pd, int child_index)
8027{
8028 Eo *item;
8029 Eina_List *l;
8030
8031 EINA_LIST_FOREACH(pd->selected, l, item)
8032 {
8033 if (child_index-- == 0)
8034 {
8035 elm_genlist_item_selected_set(item, EINA_FALSE);
8036 return EINA_TRUE;
8037 }
8038 }
8039 return EINA_FALSE;
8040}
8041
8042EOLIAN Eina_Bool
8043_elm_genlist_elm_interface_atspi_selection_is_child_selected(Eo *obj EINA_UNUSED, Elm_Genlist_Data *pd, int child_index)
8044{
8045 Elm_Gen_Item *item;
8046
8047 EINA_INLIST_FOREACH(pd->items, item)
8048 {
8049 if (child_index-- == 0)
8050 {
8051 return elm_genlist_item_selected_get(EO_OBJ(item));
8052 }
8053 }
8054 return EINA_FALSE;
8055}
8056
8057EOLIAN Eina_Bool
8058_elm_genlist_elm_interface_atspi_selection_all_children_select(Eo *obj, Elm_Genlist_Data *pd)
8059{
8060 Elm_Gen_Item *item;
8061
8062 if (!elm_genlist_multi_select_get(obj))
8063 return EINA_FALSE;
8064
8065 EINA_INLIST_FOREACH(pd->items, item)
8066 elm_genlist_item_selected_set(EO_OBJ(item), EINA_TRUE);
8067
8068 return EINA_TRUE;
8069}
8070
8071EOLIAN Eina_Bool
8072_elm_genlist_elm_interface_atspi_selection_clear(Eo *obj EINA_UNUSED, Elm_Genlist_Data *pd)
8073{
8074 return _all_items_deselect(pd);
8075}
8076
8077EOLIAN Eina_Bool
8078_elm_genlist_elm_interface_atspi_selection_child_deselect(Eo *obj EINA_UNUSED, Elm_Genlist_Data *pd, int child_index)
8079{
8080 Elm_Gen_Item *item;
8081 if (pd->select_mode != ELM_OBJECT_SELECT_MODE_NONE)
8082 {
8083 EINA_INLIST_FOREACH(pd->items, item)
8084 {
8085 if (child_index-- == 0)
8086 {
8087 elm_genlist_item_selected_set(EO_OBJ(item), EINA_FALSE);
8088 return EINA_TRUE;
8089 }
8090 }
8091 }
8092 return EINA_FALSE;
8093}
8094
7994#include "elm_genlist.eo.c" 8095#include "elm_genlist.eo.c"
7995#include "elm_genlist_item.eo.c" 8096#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 @@
1import elm_general; 1import elm_general;
2 2
3class Elm.Genlist (Elm.Layout, Elm_Interface_Scrollable, Evas.Clickable_Interface, 3class Elm.Genlist (Elm.Layout, Elm_Interface_Scrollable, Evas.Clickable_Interface,
4 Elm_Interface_Atspi_Widget_Action) 4 Elm_Interface_Atspi_Widget_Action, Elm_Interface_Atspi_Selection)
5{ 5{
6 eo_prefix: elm_obj_genlist; 6 eo_prefix: elm_obj_genlist;
7 methods { 7 methods {
@@ -731,6 +731,14 @@ class Elm.Genlist (Elm.Layout, Elm_Interface_Scrollable, Evas.Clickable_Interfac
731 Elm_Interface_Atspi_Accessible.children.get; 731 Elm_Interface_Atspi_Accessible.children.get;
732 Elm_Interface_Atspi_Accessible.state_set.get; 732 Elm_Interface_Atspi_Accessible.state_set.get;
733 Elm_Interface_Atspi_Widget_Action.elm_actions.get; 733 Elm_Interface_Atspi_Widget_Action.elm_actions.get;
734 Elm_Interface_Atspi_Selection.selected_children_count.get;
735 Elm_Interface_Atspi_Selection.selected_child.get;
736 Elm_Interface_Atspi_Selection.selected_child_deselect;
737 Elm_Interface_Atspi_Selection.child_select;
738 Elm_Interface_Atspi_Selection.child_deselect;
739 Elm_Interface_Atspi_Selection.is_child_selected;
740 Elm_Interface_Atspi_Selection.all_children_select;
741 Elm_Interface_Atspi_Selection.clear;
734 } 742 }
735 events { 743 events {
736 language,changed; 744 language,changed;