From 6992c77377e7b85e183b7f56be574b0aff206076 Mon Sep 17 00:00:00 2001 From: Lukasz Stanislawski Date: Fri, 17 Apr 2015 13:59:08 +0200 Subject: [PATCH] atspi: add new APIs for setting atspi relationship. Introduce new APIs elm_object_atspi_relationship_append and elm_object_atspi_relationship_remove allowing to set developer-defined accessibility relationships between widgets. @tizen_feature Conflicts: src/lib/elm_atspi_bridge.c src/lib/elm_interface_atspi_accessible.c src/lib/elm_interface_atspi_accessible.eo src/lib/elm_interface_atspi_accessible.h src/lib/elm_widget.c src/lib/elm_widget.eo src/lib/elm_widget.h src/tests/elm_test_atspi.c Change-Id: If851c10396fef6e1f024299133bc01b95a729d35 --- src/lib/elm_interface_atspi_accessible.eo | 6 +++ src/lib/elm_widget.c | 41 ++++++++++++++++ src/lib/elm_widget.eo | 4 ++ src/lib/elm_widget.h | 6 +++ src/lib/elm_widget_item.eo | 4 ++ src/tests/elm_test_atspi.c | 81 ++++++++++++++++++++++++++++++- 6 files changed, 141 insertions(+), 1 deletion(-) diff --git a/src/lib/elm_interface_atspi_accessible.eo b/src/lib/elm_interface_atspi_accessible.eo index 027138b..993d447 100644 --- a/src/lib/elm_interface_atspi_accessible.eo +++ b/src/lib/elm_interface_atspi_accessible.eo @@ -195,4 +195,10 @@ mixin Elm_Interface_Atspi_Accessible () added; removed; } + //TIZEN_ONLY(20150709) : atspi relations api + implements { + @virtual .relationship_append; + @virtual .relationship_remove; + } + ////////// } diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index ce0a062..ee696a0 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -4488,6 +4488,9 @@ _elm_widget_item_eo_base_destructor(Eo *eo_item, Elm_Widget_Item_Data *item) elm_interface_atspi_accessible_removed(eo_item); + if (item->atspi_custom_relations) + elm_atspi_relation_set_free(&item->atspi_custom_relations); + EINA_MAGIC_SET(item, EINA_MAGIC_NONE); eo_do_super(eo_item, ELM_WIDGET_ITEM_CLASS, eo_destructor()); @@ -5770,6 +5773,10 @@ _elm_widget_eo_base_destructor(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSED) elm_interface_atspi_accessible_translation_domain_set(NULL), elm_interface_atspi_accessible_relationships_clear() ); + // TIZEN_ONLY(20150709) : atspi relations api + if (sd->atspi_custom_relations) + elm_atspi_relation_set_free(&sd->atspi_custom_relations); + // eo_do_super(obj, ELM_WIDGET_CLASS, eo_destructor()); sd->on_destroy = EINA_FALSE; @@ -6035,6 +6042,14 @@ _elm_widget_elm_interface_atspi_accessible_attributes_get(Eo *obj, Elm_Widget_Sm return ret; } +// TIZEN_ONLY(20150709) : atspi relations api +EOLIAN static Elm_Atspi_Relation_Set +_elm_widget_elm_interface_atspi_accessible_relation_set_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd) +{ + return elm_atspi_relation_set_clone(&sd->atspi_custom_relations); +} +////////////////////////////// + EOLIAN static void _elm_widget_item_elm_interface_atspi_component_extents_get(Eo *obj EINA_UNUSED, Elm_Widget_Item_Data *sd EINA_UNUSED, Eina_Bool screen_coords, int *x, int *y, int *w, int *h) { @@ -6190,5 +6205,31 @@ _elm_widget_elm_interface_atspi_component_accessible_at_point_get(Eo *obj, Elm_W } // +//TIZEN_ONLY(20150709) add relations atpi +EOLIAN static Eina_Bool +_elm_widget_elm_interface_atspi_accessible_relationship_append(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd, Elm_Atspi_Relation_Type type, const Eo *relation_obj) +{ + return elm_atspi_relation_set_relation_append(&sd->atspi_custom_relations, type, relation_obj); +} + +EOLIAN static void +_elm_widget_elm_interface_atspi_accessible_relationship_remove(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd, Elm_Atspi_Relation_Type type, const Eo *relation_obj) +{ + elm_atspi_relation_set_relation_remove(&sd->atspi_custom_relations, type, relation_obj); +} + +EOLIAN static Eina_Bool +_elm_widget_item_elm_interface_atspi_accessible_relationship_append(Eo *obj EINA_UNUSED, Elm_Widget_Item_Data *sd, Elm_Atspi_Relation_Type type, const Eo *relation_obj) +{ + return elm_atspi_relation_set_relation_append(&sd->atspi_custom_relations, type, relation_obj); +} + +EOLIAN static void +_elm_widget_item_elm_interface_atspi_accessible_relationship_remove(Eo *obj EINA_UNUSED, Elm_Widget_Item_Data *sd, Elm_Atspi_Relation_Type type, const Eo *relation_obj) +{ + elm_atspi_relation_set_relation_remove(&sd->atspi_custom_relations, type, relation_obj); +} +/////////////////////////////////// + #include "elm_widget_item.eo.c" #include "elm_widget.eo.c" diff --git a/src/lib/elm_widget.eo b/src/lib/elm_widget.eo index 88fdbc6..8a7b404 100644 --- a/src/lib/elm_widget.eo +++ b/src/lib/elm_widget.eo @@ -771,6 +771,10 @@ abstract Elm.Widget (Evas.Object_Smart, Elm_Interface_Atspi_Accessible, Elm_Inte Elm_Interface_Atspi_Accessible.children.get; Elm_Interface_Atspi_Accessible.parent.get; Elm_Interface_Atspi_Accessible.attributes.get; + //TIZEN_ONLY(20150709) : atspi relations api + Elm_Interface_Atspi_Accessible.relationship_append; + Elm_Interface_Atspi_Accessible.relationship_remove; + // Elm_Interface_Atspi_Component.focus_grab; //TIZEN_ONLY(20160329): atspi: implement HighlightGrab and HighlightClear methods (29e253e2f7ef3c632ac3a64c489bf569df407f30) Elm_Interface_Atspi_Component.highlight_grab; diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h index b0fd06e..1245b17 100644 --- a/src/lib/elm_widget.h +++ b/src/lib/elm_widget.h @@ -414,6 +414,9 @@ typedef struct _Elm_Widget_Smart_Data int role; /**< Accessibility role */ const char *description; /**< Accessibility description */ Eo *atspi_custom_parent; /**< Accessibility parent if different then parent_obj */ + //TIZEN_ONLY(20150709) add relations atpi + Elm_Atspi_Relation_Set atspi_custom_relations; /**< Developer-defined accessiblity relations */ + /////////////////////////////////// /* this is a hook to be set on-the-fly on widgets. this is code * handling the request of showing a specific region from an inner @@ -633,6 +636,9 @@ struct _Elm_Widget_Item_Data /**< A11Y info */ const char *description; int role; + //TIZEN_ONLY(20150709) add relations atpi + Elm_Atspi_Relation_Set atspi_custom_relations; /**< Developer-defined accessiblity relations */ + /////////////////////////////////// Eina_Bool disabled : 1; Eina_Bool on_deletion : 1; diff --git a/src/lib/elm_widget_item.eo b/src/lib/elm_widget_item.eo index e466965..8dd77cf 100644 --- a/src/lib/elm_widget_item.eo +++ b/src/lib/elm_widget_item.eo @@ -531,6 +531,10 @@ class Elm.Widget_Item(Eo.Base, Elm_Interface_Atspi_Accessible, Eo.Base.destructor; Elm_Interface_Atspi_Accessible.state_set.get; Elm_Interface_Atspi_Accessible.parent.get; + //TIZEN_ONLY(20150709) : atspi relations api + Elm_Interface_Atspi_Accessible.relationship_append; + Elm_Interface_Atspi_Accessible.relationship_remove; + // Elm_Interface_Atspi_Component.extents.get; Elm_Interface_Atspi_Component.extents.set; Elm_Interface_Atspi_Component.alpha.get; diff --git a/src/tests/elm_test_atspi.c b/src/tests/elm_test_atspi.c index 23fbdbf..972dffd 100644 --- a/src/tests/elm_test_atspi.c +++ b/src/tests/elm_test_atspi.c @@ -9,7 +9,7 @@ #include "elm_priv.h" #include "elm_suite.h" -static Evas_Object *g_win, *g_btn, *g_bg; +static Evas_Object *g_win, *g_btn, *g_bg, *g_btn2, *g_btn3, *g_box, *g_lbl; void generate_app(void) { @@ -25,6 +25,34 @@ void generate_app(void) evas_object_show(g_win); } +void generate_app2(void) +{ + g_win = elm_win_add(NULL, "Title", ELM_WIN_BASIC); + evas_object_geometry_set(g_win, 100, 100, 100, 100); + + g_bg = elm_bg_add(g_win); + + g_box = elm_box_add(g_win); + + g_btn = elm_button_add(g_win); + g_btn2 = elm_button_add(g_win); + g_btn3 = elm_button_add(g_win); + g_lbl = elm_label_add(g_win); + + elm_box_pack_end(g_box, g_btn); + elm_box_pack_end(g_box, g_btn2); + elm_box_pack_end(g_box, g_btn3); + elm_box_pack_end(g_box, g_lbl); + + evas_object_show(g_btn); + evas_object_show(g_bg); + evas_object_show(g_win); + evas_object_show(g_box); + evas_object_show(g_btn2); + evas_object_show(g_btn3); + evas_object_show(g_lbl); +} + START_TEST (elm_atspi_app_obj_name_get) { elm_init(0, NULL); @@ -284,6 +312,7 @@ START_TEST (elm_atspi_children_and_parent2) } END_TEST +<<<<<<< HEAD /* Initial value of translation domain should be NULL */ START_TEST (elm_atspi_translation_domain_get) { @@ -327,19 +356,37 @@ START_TEST (elm_atspi_relationship_append) elm_init(0, NULL); generate_app(); +======= +START_TEST (elm_atspi_elm_widget_custom_relations) +{ +>>>>>>> 876f95b... atspi: add new APIs for setting atspi relationship. Elm_Atspi_Relation_Set set; Elm_Atspi_Relation *rel, *rel_to, *rel_from; Eina_List *l; +<<<<<<< HEAD eo_do(g_btn, elm_interface_atspi_accessible_relationship_append(ELM_ATSPI_RELATION_FLOWS_TO, g_bg)); eo_do(g_btn, elm_interface_atspi_accessible_relationship_append(ELM_ATSPI_RELATION_FLOWS_FROM, g_win)); eo_do(g_btn, set = elm_interface_atspi_accessible_relation_set_get()); +======= + elm_init(0, NULL); + generate_app2(); + + eo_do(g_btn, set = elm_interface_atspi_accessible_relation_set_get()); + ck_assert(set == NULL); + + eo_do(g_btn, elm_interface_atspi_accessible_relationship_append(ELM_ATSPI_RELATION_FLOWS_TO, g_lbl)); + eo_do(g_btn, elm_interface_atspi_accessible_relationship_append(ELM_ATSPI_RELATION_FLOWS_FROM, g_win)); + + eo_do(g_btn, set = elm_interface_atspi_accessible_relation_set_get()); +>>>>>>> 876f95b... atspi: add new APIs for setting atspi relationship. ck_assert(set != NULL); ck_assert(eina_list_count(set) >= 2); rel_to = rel_from = NULL; EINA_LIST_FOREACH(set, l, rel) +<<<<<<< HEAD { if (rel->type == ELM_ATSPI_RELATION_FLOWS_TO) rel_to = rel; @@ -400,11 +447,30 @@ START_TEST (elm_atspi_relationship_remove) eo_do(g_btn, elm_interface_atspi_accessible_relationship_remove(ELM_ATSPI_RELATION_FLOWS_TO, g_bg)); eo_do(g_btn, set = elm_interface_atspi_accessible_relation_set_get()); +======= + { + if (rel->type == ELM_ATSPI_RELATION_FLOWS_TO) + rel_to = rel; + if (rel->type == ELM_ATSPI_RELATION_FLOWS_FROM) + rel_from = rel; + } + + ck_assert(rel_to != NULL); + ck_assert(rel_from != NULL); + ck_assert(eina_list_data_find(rel_to->objects, g_lbl) != NULL); + ck_assert(eina_list_data_find(rel_from->objects, g_win) != NULL); + + elm_atspi_relation_set_free(&set); + + eo_do(g_btn, elm_interface_atspi_accessible_relationship_remove(ELM_ATSPI_RELATION_FLOWS_TO, g_lbl)); + eo_do(g_btn, set = elm_interface_atspi_accessible_relation_set_get()); +>>>>>>> 876f95b... atspi: add new APIs for setting atspi relationship. ck_assert(set != NULL); ck_assert(eina_list_count(set) >= 1); rel_to = rel_from = NULL; EINA_LIST_FOREACH(set, l, rel) +<<<<<<< HEAD { if (rel->type == ELM_ATSPI_RELATION_FLOWS_TO) rel_to = rel; @@ -488,6 +554,15 @@ START_TEST (elm_atspi_relationships_clear) } elm_atspi_relation_set_free(set); +======= + { + if (rel->type == ELM_ATSPI_RELATION_FLOWS_TO) + ck_assert(EINA_FALSE); + } + + elm_atspi_relation_set_free(&set); + +>>>>>>> 876f95b... atspi: add new APIs for setting atspi relationship. elm_shutdown(); } END_TEST @@ -505,9 +580,13 @@ void elm_test_atspi(TCase *tc) tcase_add_test(tc, elm_atspi_description_get); tcase_add_test(tc, elm_atspi_children_and_parent); tcase_add_test(tc, elm_atspi_children_and_parent2); +<<<<<<< HEAD tcase_add_test(tc, elm_atspi_translation_domain_get); tcase_add_test(tc, elm_atspi_translation_domain_set); tcase_add_test(tc, elm_atspi_relationship_append); tcase_add_test(tc, elm_atspi_relationship_remove); tcase_add_test(tc, elm_atspi_relationships_clear); +======= + tcase_add_test(tc, elm_atspi_elm_widget_custom_relations); +>>>>>>> 876f95b... atspi: add new APIs for setting atspi relationship. } -- 2.7.4