summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2015-12-28 14:40:34 +0100
committerLukasz Stanislawski <l.stanislaws@samsung.com>2016-01-04 12:00:40 +0100
commitfa6bcdda8cf5cc69c37a96a96c1bd7ed93df52c9 (patch)
treebf3d54ea90b834966532b56439e79cdd1989618a
parent4a35e8df513c2799465694d63c02abb33f43d713 (diff)
index: accessibilitize index items
Expose elm_index items as accessiblie buttons. Provide name and "activate" action.
-rw-r--r--src/lib/elm_index.c70
-rw-r--r--src/lib/elm_index.eo1
-rw-r--r--src/lib/elm_index_item.eo4
-rw-r--r--src/tests/elm_test_index.c2
4 files changed, 74 insertions, 3 deletions
diff --git a/src/lib/elm_index.c b/src/lib/elm_index.c
index c09df9e70..17f844a3b 100644
--- a/src/lib/elm_index.c
+++ b/src/lib/elm_index.c
@@ -3,6 +3,8 @@
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_WIDGET_ACTION_PROTECTED
7#define ELM_INTERFACE_ATSPI_COMPONENT_PROTECTED
6 8
7#define ELM_WIDGET_ITEM_PROTECTED 9#define ELM_WIDGET_ITEM_PROTECTED
8#include <Elementary.h> 10#include <Elementary.h>
@@ -529,6 +531,7 @@ _elm_index_item_eo_base_constructor(Eo *obj, Elm_Index_Item_Data *it)
529{ 531{
530 obj = eo_do_super_ret(obj, ELM_INDEX_ITEM_CLASS, obj, eo_constructor()); 532 obj = eo_do_super_ret(obj, ELM_INDEX_ITEM_CLASS, obj, eo_constructor());
531 it->base = eo_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS); 533 it->base = eo_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS);
534 eo_do(obj, elm_interface_atspi_accessible_role_set(ELM_ATSPI_ROLE_PUSH_BUTTON));
532 535
533 return obj; 536 return obj;
534} 537}
@@ -1229,7 +1232,7 @@ _elm_index_eo_base_constructor(Eo *obj, Elm_Index_Data *_pd EINA_UNUSED)
1229 eo_do(obj, 1232 eo_do(obj,
1230 evas_obj_type_set(MY_CLASS_NAME_LEGACY), 1233 evas_obj_type_set(MY_CLASS_NAME_LEGACY),
1231 evas_obj_smart_callbacks_descriptions_set(_smart_callbacks), 1234 evas_obj_smart_callbacks_descriptions_set(_smart_callbacks),
1232 elm_interface_atspi_accessible_role_set(ELM_ATSPI_ROLE_LIST)); 1235 elm_interface_atspi_accessible_role_set(ELM_ATSPI_ROLE_SCROLL_BAR));
1233 1236
1234 return obj; 1237 return obj;
1235} 1238}
@@ -1369,6 +1372,12 @@ _elm_index_item_append(Eo *obj, Elm_Index_Data *sd, const char *letter, Evas_Sma
1369 ELM_INDEX_ITEM_DATA_GET(eo_item, it); 1372 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
1370 VIEW(it) = edje_object_add(evas_object_evas_get(obj)); 1373 VIEW(it) = edje_object_add(evas_object_evas_get(obj));
1371 1374
1375 if (_elm_config->atspi_mode)
1376 {
1377 elm_interface_atspi_accessible_added(eo_item);
1378 elm_interface_atspi_accessible_children_changed_added_signal_emit(obj, eo_item);
1379 }
1380
1372 return eo_item; 1381 return eo_item;
1373} 1382}
1374 1383
@@ -1385,6 +1394,12 @@ _elm_index_item_prepend(Eo *obj, Elm_Index_Data *sd, const char *letter, Evas_Sm
1385 ELM_INDEX_ITEM_DATA_GET(eo_item, it); 1394 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
1386 VIEW(it) = edje_object_add(evas_object_evas_get(obj)); 1395 VIEW(it) = edje_object_add(evas_object_evas_get(obj));
1387 1396
1397 if (_elm_config->atspi_mode)
1398 {
1399 elm_interface_atspi_accessible_added(eo_item);
1400 elm_interface_atspi_accessible_children_changed_added_signal_emit(obj, eo_item);
1401 }
1402
1388 return eo_item; 1403 return eo_item;
1389} 1404}
1390 1405
@@ -1414,6 +1429,12 @@ _elm_index_item_insert_after(Eo *obj, Elm_Index_Data *sd, Elm_Object_Item *after
1414 ELM_INDEX_ITEM_DATA_GET(eo_item, it); 1429 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
1415 VIEW(it) = edje_object_add(evas_object_evas_get(obj)); 1430 VIEW(it) = edje_object_add(evas_object_evas_get(obj));
1416 1431
1432 if (_elm_config->atspi_mode)
1433 {
1434 elm_interface_atspi_accessible_added(eo_item);
1435 elm_interface_atspi_accessible_children_changed_added_signal_emit(obj, eo_item);
1436 }
1437
1417 return eo_item; 1438 return eo_item;
1418} 1439}
1419 1440
@@ -1432,6 +1453,12 @@ _elm_index_item_insert_before(Eo *obj, Elm_Index_Data *sd, Elm_Object_Item *befo
1432 ELM_INDEX_ITEM_DATA_GET(eo_item, it); 1453 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
1433 VIEW(it) = edje_object_add(evas_object_evas_get(obj)); 1454 VIEW(it) = edje_object_add(evas_object_evas_get(obj));
1434 1455
1456 if (_elm_config->atspi_mode)
1457 {
1458 elm_interface_atspi_accessible_added(eo_item);
1459 elm_interface_atspi_accessible_children_changed_added_signal_emit(obj, eo_item);
1460 }
1461
1435 return eo_item; 1462 return eo_item;
1436} 1463}
1437 1464
@@ -1470,6 +1497,12 @@ _elm_index_item_sorted_insert(Eo *obj, Elm_Index_Data *sd, const char *letter, E
1470 ELM_INDEX_ITEM_DATA_GET(eo_item, it); 1497 ELM_INDEX_ITEM_DATA_GET(eo_item, it);
1471 VIEW(it) = edje_object_add(evas_object_evas_get(obj)); 1498 VIEW(it) = edje_object_add(evas_object_evas_get(obj));
1472 1499
1500 if (_elm_config->atspi_mode)
1501 {
1502 elm_interface_atspi_accessible_added(eo_item);
1503 elm_interface_atspi_accessible_children_changed_added_signal_emit(obj, eo_item);
1504 }
1505
1473 if (!eo_item) return NULL; 1506 if (!eo_item) return NULL;
1474 else return eo_item; 1507 else return eo_item;
1475} 1508}
@@ -1654,5 +1687,40 @@ _elm_index_class_constructor(Eo_Class *klass)
1654 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass); 1687 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
1655} 1688}
1656 1689
1690static Eina_Bool
1691_item_action_activate(Eo *obj, const char *params EINA_UNUSED EINA_UNUSED)
1692{
1693 elm_index_item_selected_set(obj, EINA_TRUE);
1694 return EINA_TRUE;
1695}
1696
1697EOLIAN static Eina_List*
1698_elm_index_elm_interface_atspi_accessible_children_get(Eo *obj, Elm_Index_Data *data)
1699{
1700 Eina_List *ret;
1701 eo_do_super(obj, ELM_INDEX_CLASS, ret = elm_interface_atspi_accessible_children_get());
1702 return eina_list_merge(eina_list_clone(data->items), ret);
1703}
1704
1705EOLIAN static char*
1706_elm_index_item_elm_interface_atspi_accessible_name_get(Eo *eo_it, Elm_Index_Item_Data *data)
1707{
1708 char *name;
1709 eo_do_super(eo_it, ELM_INDEX_ITEM_CLASS, name = elm_interface_atspi_accessible_name_get());
1710 if (name) return name;
1711
1712 return data->letter ? strdup(data->letter) : NULL;
1713}
1714
1715EOLIAN static const Elm_Atspi_Action*
1716_elm_index_item_elm_interface_atspi_widget_action_elm_actions_get(Eo *eo_it EINA_UNUSED, Elm_Index_Item_Data *data EINA_UNUSED)
1717{
1718 static Elm_Atspi_Action atspi_actions[] = {
1719 { "activate", "activate", NULL, _item_action_activate},
1720 { NULL, NULL, NULL, NULL }
1721 };
1722 return &atspi_actions[0];
1723}
1724
1657#include "elm_index_item.eo.c" 1725#include "elm_index_item.eo.c"
1658#include "elm_index.eo.c" 1726#include "elm_index.eo.c"
diff --git a/src/lib/elm_index.eo b/src/lib/elm_index.eo
index e51f779d3..5f10880b8 100644
--- a/src/lib/elm_index.eo
+++ b/src/lib/elm_index.eo
@@ -243,6 +243,7 @@ class Elm.Index (Elm.Layout, Evas.Clickable_Interface, Evas.Selectable_Interface
243 Elm.Widget.access; 243 Elm.Widget.access;
244 Elm.Widget.focus_next; 244 Elm.Widget.focus_next;
245 Elm.Layout.sizing_eval; 245 Elm.Layout.sizing_eval;
246 Elm_Interface_Atspi_Accessible.children.get;
246 } 247 }
247 events { 248 events {
248 changed; 249 changed;
diff --git a/src/lib/elm_index_item.eo b/src/lib/elm_index_item.eo
index 36d490ade..c9f7a7a37 100644
--- a/src/lib/elm_index_item.eo
+++ b/src/lib/elm_index_item.eo
@@ -1,4 +1,4 @@
1class Elm.Index_Item(Elm.Widget_Item) 1class Elm.Index_Item(Elm.Widget_Item, Elm_Interface_Atspi_Widget_Action)
2{ 2{
3 eo_prefix: elm_obj_index_item; 3 eo_prefix: elm_obj_index_item;
4 methods { 4 methods {
@@ -42,5 +42,7 @@ class Elm.Index_Item(Elm.Widget_Item)
42 Eo.Base.constructor; 42 Eo.Base.constructor;
43 Eo.Base.destructor; 43 Eo.Base.destructor;
44 Elm.Widget_Item.access_register; 44 Elm.Widget_Item.access_register;
45 Elm_Interface_Atspi_Accessible.name.get;
46 Elm_Interface_Atspi_Widget_Action.elm_actions.get;
45 } 47 }
46} 48}
diff --git a/src/tests/elm_test_index.c b/src/tests/elm_test_index.c
index a07b76e92..6b9fdc132 100644
--- a/src/tests/elm_test_index.c
+++ b/src/tests/elm_test_index.c
@@ -18,7 +18,7 @@ START_TEST (elm_atspi_role_get)
18 idx = elm_index_add(win); 18 idx = elm_index_add(win);
19 eo_do(idx, role = elm_interface_atspi_accessible_role_get()); 19 eo_do(idx, role = elm_interface_atspi_accessible_role_get());
20 20
21 ck_assert(role == ELM_ATSPI_ROLE_LIST); 21 ck_assert(role == ELM_ATSPI_ROLE_SCROLL_BAR);
22 22
23 elm_shutdown(); 23 elm_shutdown();
24} 24}