summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2015-11-27 18:14:54 +0100
committerLukasz Stanislawski <l.stanislaws@samsung.com>2015-12-02 12:04:56 +0100
commit1e390e033259c905a2215d3a96eb799a29907f02 (patch)
treeb6901b560e7df9ba6d17749694536011f57aeb6c
parent63381b64ffd7095a5c570c47f4a29d9d989800ba (diff)
menu: enhance accessibility support
-rw-r--r--src/lib/elm_atspi_bridge.c2
-rw-r--r--src/lib/elm_menu.c147
-rw-r--r--src/lib/elm_menu.eo5
-rw-r--r--src/lib/elm_menu_item.eo9
4 files changed, 161 insertions, 2 deletions
diff --git a/src/lib/elm_atspi_bridge.c b/src/lib/elm_atspi_bridge.c
index f0eec7db2..782d1fdd2 100644
--- a/src/lib/elm_atspi_bridge.c
+++ b/src/lib/elm_atspi_bridge.c
@@ -3718,6 +3718,8 @@ _set_broadcast_flag(const char *event, Eo *bridge)
3718 STATE_TYPE_SET(pd->object_broadcast_mask, ATSPI_OBJECT_EVENT_VISIBLE_DATA_CHANGED); 3718 STATE_TYPE_SET(pd->object_broadcast_mask, ATSPI_OBJECT_EVENT_VISIBLE_DATA_CHANGED);
3719 else if (!strcmp(tokens[1], "ActiveDescendantChanged")) 3719 else if (!strcmp(tokens[1], "ActiveDescendantChanged"))
3720 STATE_TYPE_SET(pd->object_broadcast_mask, ATSPI_OBJECT_EVENT_ACTIVE_DESCENDANT_CHANGED); 3720 STATE_TYPE_SET(pd->object_broadcast_mask, ATSPI_OBJECT_EVENT_ACTIVE_DESCENDANT_CHANGED);
3721 else if (!strcmp(tokens[1], "SelectionChanged"))
3722 STATE_TYPE_SET(pd->object_broadcast_mask, ATSPI_OBJECT_EVENT_SELECTION_CHANGED);
3721 } 3723 }
3722 else if (!strcmp(tokens[0], "Window")) 3724 else if (!strcmp(tokens[0], "Window"))
3723 { 3725 {
diff --git a/src/lib/elm_menu.c b/src/lib/elm_menu.c
index ce4979302..c5ca87856 100644
--- a/src/lib/elm_menu.c
+++ b/src/lib/elm_menu.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 7
7#define ELM_WIDGET_ITEM_PROTECTED 8#define ELM_WIDGET_ITEM_PROTECTED
8#include <Elementary.h> 9#include <Elementary.h>
@@ -107,6 +108,8 @@ _submenu_sizing_eval(Elm_Menu_Item_Data *parent_it)
107 { 108 {
108 ELM_MENU_ITEM_DATA_GET(eo_item, item); 109 ELM_MENU_ITEM_DATA_GET(eo_item, item);
109 elm_layout_sizing_eval(VIEW(item)); 110 elm_layout_sizing_eval(VIEW(item));
111 if (_elm_config->atspi_mode)
112 elm_interface_atspi_accessible_state_changed_signal_emit(eo_item, ELM_ATSPI_STATE_SHOWING, EINA_TRUE);
110 } 113 }
111 114
112 115
@@ -488,6 +491,7 @@ _menu_item_activate_cb(void *data,
488 if (eo_item2 != EO_OBJ(item)) 491 if (eo_item2 != EO_OBJ(item))
489 elm_menu_item_selected_set(eo_item2, 0); 492 elm_menu_item_selected_set(eo_item2, 0);
490 } 493 }
494 eo_do(ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN, elm_interface_atspi_accessible_event_emit(EO_OBJ(item->parent), ELM_INTERFACE_ATSPI_SELECTION_EVENT_SELECTION_CHANGED, NULL));
491 } 495 }
492 else 496 else
493 { 497 {
@@ -497,7 +501,10 @@ _menu_item_activate_cb(void *data,
497 if (eo_item2 != EO_OBJ(item)) 501 if (eo_item2 != EO_OBJ(item))
498 elm_menu_item_selected_set(eo_item2, 0); 502 elm_menu_item_selected_set(eo_item2, 0);
499 } 503 }
504 eo_do(ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN, elm_interface_atspi_accessible_event_emit(WIDGET(item), ELM_INTERFACE_ATSPI_SELECTION_EVENT_SELECTION_CHANGED, NULL));
500 } 505 }
506 if (_elm_config->atspi_mode)
507 elm_interface_atspi_accessible_state_changed_signal_emit(EO_OBJ(item), ELM_ATSPI_STATE_SELECTED, EINA_TRUE);
501} 508}
502 509
503static void 510static void
@@ -510,6 +517,8 @@ _menu_item_inactivate_cb(void *data,
510 517
511 item->selected = 0; 518 item->selected = 0;
512 if (item->submenu.open) _submenu_hide(item); 519 if (item->submenu.open) _submenu_hide(item);
520 if (_elm_config->atspi_mode)
521 elm_interface_atspi_accessible_state_changed_signal_emit(EO_OBJ(item), ELM_ATSPI_STATE_SELECTED, EINA_FALSE);
513} 522}
514 523
515static Eina_Bool 524static Eina_Bool
@@ -560,6 +569,7 @@ static void
560_item_obj_create(Elm_Menu_Item_Data *item) 569_item_obj_create(Elm_Menu_Item_Data *item)
561{ 570{
562 VIEW(item) = elm_layout_add(WIDGET(item)); 571 VIEW(item) = elm_layout_add(WIDGET(item));
572 eo_do(VIEW(item), elm_interface_atspi_accessible_type_set(ELM_ATSPI_TYPE_SKIPPED));
563 evas_object_size_hint_weight_set 573 evas_object_size_hint_weight_set
564 (VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 574 (VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
565 evas_object_size_hint_fill_set(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL); 575 evas_object_size_hint_fill_set(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -583,6 +593,7 @@ static void
583_item_separator_obj_create(Elm_Menu_Item_Data *item) 593_item_separator_obj_create(Elm_Menu_Item_Data *item)
584{ 594{
585 VIEW(item) = elm_layout_add(WIDGET(item)); 595 VIEW(item) = elm_layout_add(WIDGET(item));
596 eo_do(VIEW(item), elm_interface_atspi_accessible_type_set(ELM_ATSPI_TYPE_SKIPPED));
586 evas_object_size_hint_weight_set 597 evas_object_size_hint_weight_set
587 (VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 598 (VIEW(item), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
588 evas_object_size_hint_fill_set(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL); 599 evas_object_size_hint_fill_set(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -605,7 +616,9 @@ _item_submenu_obj_create(Elm_Menu_Item_Data *item)
605 char style[1024]; 616 char style[1024];
606 617
607 item->submenu.location = elm_icon_add(sd->bx); 618 item->submenu.location = elm_icon_add(sd->bx);
619 eo_do(item->submenu.location, elm_interface_atspi_accessible_type_set(ELM_ATSPI_TYPE_DISABLED));
608 item->submenu.hv = hv = elm_hover_add(sd->bx); 620 item->submenu.hv = hv = elm_hover_add(sd->bx);
621 eo_do(item->submenu.hv, elm_interface_atspi_accessible_type_set(ELM_ATSPI_TYPE_SKIPPED));
609 elm_widget_mirrored_set(hv, EINA_FALSE); 622 elm_widget_mirrored_set(hv, EINA_FALSE);
610 elm_hover_target_set(hv, item->submenu.location); 623 elm_hover_target_set(hv, item->submenu.location);
611 elm_hover_parent_set(hv, sd->parent); 624 elm_hover_parent_set(hv, sd->parent);
@@ -671,8 +684,10 @@ _elm_menu_evas_object_smart_add(Eo *obj, Elm_Menu_Data *priv)
671 elm_widget_can_focus_set(obj, EINA_FALSE); 684 elm_widget_can_focus_set(obj, EINA_FALSE);
672 685
673 priv->location = elm_icon_add(obj); 686 priv->location = elm_icon_add(obj);
687 eo_do(priv->location, elm_interface_atspi_accessible_type_set(ELM_ATSPI_TYPE_DISABLED));
674 688
675 priv->hv = elm_hover_add(obj); 689 priv->hv = elm_hover_add(obj);
690 eo_do(priv->hv, elm_interface_atspi_accessible_type_set(ELM_ATSPI_TYPE_SKIPPED));
676 elm_widget_mirrored_set(priv->hv, EINA_FALSE); 691 elm_widget_mirrored_set(priv->hv, EINA_FALSE);
677 692
678 elm_object_style_set(priv->hv, "menu/default"); 693 elm_object_style_set(priv->hv, "menu/default");
@@ -680,6 +695,7 @@ _elm_menu_evas_object_smart_add(Eo *obj, Elm_Menu_Data *priv)
680 (ELM_HOVER_EVENT_DISMISSED, _hover_dismissed_cb, obj)); 695 (ELM_HOVER_EVENT_DISMISSED, _hover_dismissed_cb, obj));
681 696
682 priv->bx = elm_box_add(obj); 697 priv->bx = elm_box_add(obj);
698 eo_do(priv->bx, elm_interface_atspi_accessible_type_set(ELM_ATSPI_TYPE_SKIPPED));
683 elm_widget_mirrored_set(priv->bx, EINA_FALSE); 699 elm_widget_mirrored_set(priv->bx, EINA_FALSE);
684 evas_object_size_hint_weight_set 700 evas_object_size_hint_weight_set
685 (priv->bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 701 (priv->bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -1010,6 +1026,7 @@ _elm_menu_item_add(Eo *obj, Elm_Menu_Data *sd, Elm_Object_Item *parent, const ch
1010 Evas_Object *icon_obj; 1026 Evas_Object *icon_obj;
1011 1027
1012 icon_obj = elm_icon_add(obj); 1028 icon_obj = elm_icon_add(obj);
1029 eo_do(icon_obj, elm_interface_atspi_accessible_type_set(ELM_ATSPI_TYPE_DISABLED));
1013 if (!icon_obj) return NULL; 1030 if (!icon_obj) return NULL;
1014 1031
1015 eo_item = eo_add(ELM_MENU_ITEM_CLASS, obj); 1032 eo_item = eo_add(ELM_MENU_ITEM_CLASS, obj);
@@ -1041,6 +1058,12 @@ _elm_menu_item_add(Eo *obj, Elm_Menu_Data *sd, Elm_Object_Item *parent, const ch
1041 it->dbus_idx = _elm_dbus_menu_item_add(sd->dbus_menu, eo_item); 1058 it->dbus_idx = _elm_dbus_menu_item_add(sd->dbus_menu, eo_item);
1042 it->dbus_menu = sd->dbus_menu; 1059 it->dbus_menu = sd->dbus_menu;
1043 } 1060 }
1061 if (_elm_config->atspi_mode)
1062 {
1063 elm_interface_atspi_accessible_added(eo_item);
1064 elm_interface_atspi_accessible_children_changed_added_signal_emit(parent ? parent : obj, eo_item);
1065 }
1066
1044 return eo_item; 1067 return eo_item;
1045} 1068}
1046 1069
@@ -1265,5 +1288,129 @@ _elm_menu_class_constructor(Eo_Class *klass)
1265 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass); 1288 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
1266} 1289}
1267 1290
1291EOLIAN static Eina_List*
1292_elm_menu_elm_interface_atspi_accessible_children_get(Eo *obj, Elm_Menu_Data *sd)
1293{
1294 Eina_List *ret;
1295 eo_do_super(obj, ELM_MENU_CLASS, ret = elm_interface_atspi_accessible_children_get());
1296 return eina_list_merge(eina_list_clone(sd->items), ret);
1297}
1298
1299EOLIAN static Eina_List*
1300_elm_menu_item_elm_interface_atspi_accessible_children_get(Eo *obj EINA_UNUSED, Elm_Menu_Item_Data *sd)
1301{
1302 return eina_list_clone(sd->submenu.items);
1303}
1304
1305EOLIAN static Elm_Interface_Atspi_Accessible*
1306_elm_menu_item_elm_interface_atspi_accessible_parent_get(Eo *obj EINA_UNUSED, Elm_Menu_Item_Data *sd)
1307{
1308 return sd->parent ? EO_OBJ(sd->parent) : WIDGET(sd);
1309}
1310
1311EOLIAN static Elm_Atspi_Role
1312_elm_menu_item_elm_interface_atspi_accessible_role_get(Eo *obj EINA_UNUSED, Elm_Menu_Item_Data *sd)
1313{
1314 return sd->submenu.items ? ELM_ATSPI_ROLE_MENU : ELM_ATSPI_ROLE_MENU_ITEM;
1315}
1316
1317EOLIAN static char*
1318_elm_menu_item_elm_interface_atspi_accessible_name_get(Eo *obj EINA_UNUSED, Elm_Menu_Item_Data *sd)
1319{
1320 return sd->label ? strdup(sd->label) : NULL;
1321}
1322
1323EOLIAN static Elm_Atspi_State_Set
1324_elm_menu_item_elm_interface_atspi_accessible_state_set_get(Eo *obj EINA_UNUSED, Elm_Menu_Item_Data *sd)
1325{
1326 Elm_Atspi_State_Set ret;
1327 eo_do_super(obj, ELM_MENU_ITEM_CLASS, ret = elm_interface_atspi_accessible_state_set_get());
1328
1329 STATE_TYPE_SET(ret, ELM_ATSPI_STATE_SELECTABLE);
1330
1331 if (sd->selected)
1332 STATE_TYPE_SET(ret, ELM_ATSPI_STATE_SELECTED);
1333
1334 return ret;
1335}
1336
1337EOLIAN static int
1338_elm_menu_item_elm_interface_atspi_selection_selected_children_count_get(Eo *obj EINA_UNUSED, Elm_Menu_Item_Data *sd)
1339{
1340 int ret = 0;
1341 Elm_Object_Item *sobj = NULL;
1342 Eina_List *l;
1343
1344 EINA_LIST_FOREACH(sd->submenu.items, l, sobj)
1345 {
1346 if (!sobj) continue;
1347 ELM_MENU_ITEM_DATA_GET(sobj, item);
1348 if (item && item->selected) ret++;
1349 }
1350
1351 return ret;
1352}
1353
1354EOLIAN static Eo*
1355_elm_menu_item_elm_interface_atspi_selection_selected_child_get(Eo *obj EINA_UNUSED, Elm_Menu_Item_Data *sd, int child)
1356{
1357 int seq = 0;
1358 Elm_Object_Item *sobj = NULL;
1359 Eina_List *l;
1360
1361 EINA_LIST_FOREACH(sd->submenu.items, l, sobj)
1362 {
1363 if (!sobj) continue;
1364 ELM_MENU_ITEM_DATA_GET(sobj, item);
1365
1366 if (item && item->selected)
1367 {
1368 if (child == seq++)
1369 break;
1370 }
1371 }
1372
1373 return sobj;
1374}
1375
1376EOLIAN static int
1377_elm_menu_elm_interface_atspi_selection_selected_children_count_get(Eo *obj EINA_UNUSED, Elm_Menu_Data *sd)
1378{
1379 Elm_Object_Item *sobj = NULL;
1380 Eina_List *l;
1381 int ret = 0;
1382
1383 EINA_LIST_FOREACH(sd->items, l, sobj)
1384 {
1385 ELM_MENU_ITEM_DATA_GET(sobj, item);
1386 if (item && item->selected) ret++;
1387 }
1388
1389 return ret;
1390}
1391
1392EOLIAN static Eo*
1393_elm_menu_elm_interface_atspi_selection_selected_child_get(Eo *obj EINA_UNUSED, Elm_Menu_Data *sd, int child)
1394{
1395 int seq = 0;
1396 Elm_Object_Item *sobj = NULL;
1397 Eina_List *l;
1398
1399 EINA_LIST_FOREACH(sd->items, l, sobj)
1400 {
1401 if (!sobj) continue;
1402 ELM_MENU_ITEM_DATA_GET(sobj, item);
1403
1404 if (item && item->selected)
1405 {
1406 if (child == seq++)
1407 break;
1408 }
1409 }
1410
1411 return sobj;
1412
1413}
1414
1268#include "elm_menu_item.eo.c" 1415#include "elm_menu_item.eo.c"
1269#include "elm_menu.eo.c" 1416#include "elm_menu.eo.c"
diff --git a/src/lib/elm_menu.eo b/src/lib/elm_menu.eo
index 13bdaa0a4..a37e5646c 100644
--- a/src/lib/elm_menu.eo
+++ b/src/lib/elm_menu.eo
@@ -1,4 +1,4 @@
1class Elm.Menu (Elm.Widget, Evas.Clickable_Interface) 1class Elm.Menu (Elm.Widget, Evas.Clickable_Interface, Elm_Interface_Atspi_Selection)
2{ 2{
3 eo_prefix: elm_obj_menu; 3 eo_prefix: elm_obj_menu;
4 methods { 4 methods {
@@ -76,6 +76,9 @@ class Elm.Menu (Elm.Widget, Evas.Clickable_Interface)
76 Elm.Widget.parent; 76 Elm.Widget.parent;
77 Elm.Widget.theme_apply; 77 Elm.Widget.theme_apply;
78 Elm.Widget.translate; 78 Elm.Widget.translate;
79 Elm_Interface_Atspi_Accessible.children.get;
80 Elm_Interface_Atspi_Selection.selected_children_count.get;
81 Elm_Interface_Atspi_Selection.selected_child.get;
79 } 82 }
80 events { 83 events {
81 language,changed; 84 language,changed;
diff --git a/src/lib/elm_menu_item.eo b/src/lib/elm_menu_item.eo
index 0a95bb89a..543de9d8b 100644
--- a/src/lib/elm_menu_item.eo
+++ b/src/lib/elm_menu_item.eo
@@ -1,4 +1,4 @@
1class Elm.Menu_Item(Elm.Widget_Item) 1class Elm.Menu_Item(Elm.Widget_Item, Elm_Interface_Atspi_Selection)
2{ 2{
3 eo_prefix: elm_obj_menu_item; 3 eo_prefix: elm_obj_menu_item;
4 methods { 4 methods {
@@ -81,5 +81,12 @@ class Elm.Menu_Item(Elm.Widget_Item)
81 Elm.Widget_Item.part_text.set; 81 Elm.Widget_Item.part_text.set;
82 Elm.Widget_Item.part_content.get; 82 Elm.Widget_Item.part_content.get;
83 Elm.Widget_Item.part_content.set; 83 Elm.Widget_Item.part_content.set;
84 Elm_Interface_Atspi_Accessible.children.get;
85 Elm_Interface_Atspi_Accessible.parent.get;
86 Elm_Interface_Atspi_Accessible.role.get;
87 Elm_Interface_Atspi_Accessible.name.get;
88 Elm_Interface_Atspi_Accessible.state_set.get;
89 Elm_Interface_Atspi_Selection.selected_children_count.get;
90 Elm_Interface_Atspi_Selection.selected_child.get;
84 } 91 }
85} 92}