summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2015-05-27 08:23:17 +0200
committerLukasz Stanislawski <l.stanislaws@samsung.com>2015-05-27 08:23:51 +0200
commit571a83a019a04002a4aa96265c73a0531c94dc28 (patch)
treee35487238eb6d7478adf52e05a5a53dbd07cbd1c
parent665ac2aa07d975988c132eaf7cc182971101b19f (diff)
gengrid: implement Atspi_Selection interface
Allow to select and deselect gengrid items by Assistive Technology Clients through org.a11y.atspi.Selection dbus interface.
-rw-r--r--src/lib/elm_gengrid.c101
-rw-r--r--src/lib/elm_gengrid.eo11
2 files changed, 111 insertions, 1 deletions
diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c
index cb9aa78b2..5089f2172 100644
--- a/src/lib/elm_gengrid.c
+++ b/src/lib/elm_gengrid.c
@@ -3,6 +3,7 @@
3#endif 3#endif
4 4
5#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED 5#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
6#define ELM_INTERFACE_ATSPI_SELECTION_PROTECTED
6#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED 7#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
7#define ELM_WIDGET_ITEM_PROTECTED 8#define ELM_WIDGET_ITEM_PROTECTED
8 9
@@ -5167,5 +5168,105 @@ _elm_gengrid_elm_interface_atspi_accessible_state_set_get(Eo *obj, Elm_Gengrid_D
5167 return ret; 5168 return ret;
5168} 5169}
5169 5170
5171EOLIAN int
5172_elm_gengrid_elm_interface_atspi_selection_selected_children_count_get(Eo *objm EINA_UNUSED, Elm_Gengrid_Data *pd)
5173{
5174 return eina_list_count(pd->selected);
5175}
5176
5177EOLIAN Eo*
5178_elm_gengrid_elm_interface_atspi_selection_selected_child_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *pd, int child_idx)
5179{
5180 return eina_list_nth(pd->selected, child_idx);
5181}
5182
5183EOLIAN Eina_Bool
5184_elm_gengrid_elm_interface_atspi_selection_child_select(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *pd, int child_index)
5185{
5186 Elm_Gen_Item *item;
5187 if (pd->select_mode != ELM_OBJECT_SELECT_MODE_NONE)
5188 {
5189 EINA_INLIST_FOREACH(pd->items, item)
5190 {
5191 if (child_index-- == 0)
5192 {
5193 elm_gengrid_item_selected_set(EO_OBJ(item), EINA_TRUE);
5194 return EINA_TRUE;
5195 }
5196 }
5197 }
5198 return EINA_FALSE;
5199}
5200
5201EOLIAN Eina_Bool
5202_elm_gengrid_elm_interface_atspi_selection_selected_child_deselect(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *pd, int child_index)
5203{
5204 Eo *item;
5205 Eina_List *l;
5206
5207 EINA_LIST_FOREACH(pd->selected, l, item)
5208 {
5209 if (child_index-- == 0)
5210 {
5211 elm_gengrid_item_selected_set(item, EINA_FALSE);
5212 return EINA_TRUE;
5213 }
5214 }
5215 return EINA_FALSE;
5216}
5217
5218EOLIAN Eina_Bool
5219_elm_gengrid_elm_interface_atspi_selection_is_child_selected(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *pd, int child_index)
5220{
5221 Elm_Gen_Item *item;
5222
5223 EINA_INLIST_FOREACH(pd->items, item)
5224 {
5225 if (child_index-- == 0)
5226 {
5227 return elm_gengrid_item_selected_get(EO_OBJ(item));
5228 }
5229 }
5230 return EINA_FALSE;
5231}
5232
5233EOLIAN Eina_Bool
5234_elm_gengrid_elm_interface_atspi_selection_all_children_select(Eo *obj, Elm_Gengrid_Data *pd)
5235{
5236 Elm_Gen_Item *item;
5237
5238 if (!elm_gengrid_multi_select_get(obj))
5239 return EINA_FALSE;
5240
5241 EINA_INLIST_FOREACH(pd->items, item)
5242 elm_gengrid_item_selected_set(EO_OBJ(item), EINA_TRUE);
5243
5244 return EINA_TRUE;
5245}
5246
5247EOLIAN Eina_Bool
5248_elm_gengrid_elm_interface_atspi_selection_clear(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *pd)
5249{
5250 return _all_items_deselect(pd);
5251}
5252
5253EOLIAN Eina_Bool
5254_elm_gengrid_elm_interface_atspi_selection_child_deselect(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *pd, int child_index)
5255{
5256 Elm_Gen_Item *item;
5257 if (pd->select_mode != ELM_OBJECT_SELECT_MODE_NONE)
5258 {
5259 EINA_INLIST_FOREACH(pd->items, item)
5260 {
5261 if (child_index-- == 0)
5262 {
5263 elm_gengrid_item_selected_set(EO_OBJ(item), EINA_FALSE);
5264 return EINA_TRUE;
5265 }
5266 }
5267 }
5268 return EINA_FALSE;
5269}
5270
5170#include "elm_gengrid.eo.c" 5271#include "elm_gengrid.eo.c"
5171#include "elm_gengrid_item.eo.c" 5272#include "elm_gengrid_item.eo.c"
diff --git a/src/lib/elm_gengrid.eo b/src/lib/elm_gengrid.eo
index d688f338f..e343f94be 100644
--- a/src/lib/elm_gengrid.eo
+++ b/src/lib/elm_gengrid.eo
@@ -1,7 +1,8 @@
1import elm_general; 1import elm_general;
2 2
3class Elm.Gengrid (Elm.Layout, Elm_Interface_Scrollable, 3class Elm.Gengrid (Elm.Layout, Elm_Interface_Scrollable,
4 Evas.Clickable_Interface, Elm_Interface_Atspi_Widget_Action) 4 Evas.Clickable_Interface, Elm_Interface_Atspi_Widget_Action,
5 Elm_Interface_Atspi_Selection)
5{ 6{
6 eo_prefix: elm_obj_gengrid; 7 eo_prefix: elm_obj_gengrid;
7 methods { 8 methods {
@@ -707,6 +708,14 @@ class Elm.Gengrid (Elm.Layout, Elm_Interface_Scrollable,
707 Elm_Interface_Atspi_Accessible.children.get; 708 Elm_Interface_Atspi_Accessible.children.get;
708 Elm_Interface_Atspi_Accessible.state_set.get; 709 Elm_Interface_Atspi_Accessible.state_set.get;
709 Elm_Interface_Atspi_Widget_Action.elm_actions.get; 710 Elm_Interface_Atspi_Widget_Action.elm_actions.get;
711 Elm_Interface_Atspi_Selection.selected_children_count.get;
712 Elm_Interface_Atspi_Selection.selected_child.get;
713 Elm_Interface_Atspi_Selection.selected_child_deselect;
714 Elm_Interface_Atspi_Selection.child_select;
715 Elm_Interface_Atspi_Selection.child_deselect;
716 Elm_Interface_Atspi_Selection.is_child_selected;
717 Elm_Interface_Atspi_Selection.all_children_select;
718 Elm_Interface_Atspi_Selection.clear;
710 } 719 }
711 events { 720 events {
712 language,changed; 721 language,changed;