summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShilpa Singh <shilpa.singh@samsung.com>2017-06-03 17:28:30 +0900
committerShinwoo Kim <cinoo.kim@samsung.com>2017-06-03 17:28:30 +0900
commite53b77d6ce9848bdb274b428c33e6848c8620443 (patch)
tree4d8530090088240815e42ce1d26b76dd90d4642b
parentbc13f96ae8b944fd3277a1d8ee86fc061842762a (diff)
elm_colorselector: Improve ATSPI support
Summary: Item: state_set_get, name, actions api added Widget: children_get api added. Test Plan: In Accessibility mode, on item tap, color name should be read out, and if the color is a selected color, state also should be read out. Reviewers: kimcinoo Subscribers: cedric, jpeg, govi, rajeshps Differential Revision: https://phab.enlightenment.org/D4934
-rw-r--r--src/lib/elementary/elm_color_item.eo5
-rw-r--r--src/lib/elementary/elm_colorselector.c103
-rw-r--r--src/lib/elementary/elm_colorselector.eo1
3 files changed, 108 insertions, 1 deletions
diff --git a/src/lib/elementary/elm_color_item.eo b/src/lib/elementary/elm_color_item.eo
index 6f6b7e4a9f..860527c4f6 100644
--- a/src/lib/elementary/elm_color_item.eo
+++ b/src/lib/elementary/elm_color_item.eo
@@ -1,4 +1,4 @@
1class Elm.Color.Item(Elm.Widget.Item) 1class Elm.Color.Item(Elm.Widget.Item, Elm.Interface.Atspi_Widget_Action)
2{ 2{
3 [[Elementary color item class]] 3 [[Elementary color item class]]
4 legacy_prefix: elm_color_item; 4 legacy_prefix: elm_color_item;
@@ -42,5 +42,8 @@ class Elm.Color.Item(Elm.Widget.Item)
42 Elm.Widget.Item.access_register; 42 Elm.Widget.Item.access_register;
43 Elm.Widget.Item.signal_emit; 43 Elm.Widget.Item.signal_emit;
44 Elm.Widget.Item.focus { get; set; } 44 Elm.Widget.Item.focus { get; set; }
45 Elm.Interface.Atspi_Accessible.state_set { get; }
46 Elm.Interface.Atspi_Accessible.name { get; }
47 Elm.Interface.Atspi_Widget_Action.elm_actions { get; }
45 } 48 }
46} 49}
diff --git a/src/lib/elementary/elm_colorselector.c b/src/lib/elementary/elm_colorselector.c
index 94a288a035..d3750552b6 100644
--- a/src/lib/elementary/elm_colorselector.c
+++ b/src/lib/elementary/elm_colorselector.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_COMPONENT_PROTECTED
6#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED 7#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
7 8
8#include <Elementary.h> 9#include <Elementary.h>
@@ -1702,6 +1703,39 @@ _elm_color_item_elm_widget_item_signal_emit(Eo *eo_it EINA_UNUSED,
1702 elm_object_signal_emit(VIEW(it), emission, source); 1703 elm_object_signal_emit(VIEW(it), emission, source);
1703} 1704}
1704 1705
1706static Eina_Bool
1707_item_action_activate(Evas_Object *obj, const char *params EINA_UNUSED)
1708{
1709 Eina_List *l;
1710 ELM_COLOR_ITEM_DATA_GET(obj, item);
1711 ELM_COLORSELECTOR_DATA_GET(WIDGET(item), sd);
1712
1713 elm_object_signal_emit(VIEW(item), "elm,state,selected", "elm");
1714 elm_interface_atspi_accessible_state_changed_signal_emit(obj,
1715 ELM_ATSPI_STATE_CHECKED,
1716 EINA_TRUE);
1717 elm_colorselector_color_set(WIDGET(item), item->color->r, item->color->g,
1718 item->color->b, item->color->a);
1719 evas_object_smart_callback_call(WIDGET(item), SIG_COLOR_ITEM_SELECTED,
1720 EO_OBJ(item));
1721
1722 Eo *eo_temp_item = eina_list_data_get(sd->selected);
1723 if (eo_temp_item && (eo_temp_item != EO_OBJ(item)))
1724 {
1725 ELM_COLOR_ITEM_DATA_GET(eo_temp_item, temp_item);
1726 elm_object_signal_emit(VIEW(temp_item), "elm,state,unselected", "elm");
1727 }
1728
1729 EINA_LIST_FOREACH(sd->items, l, eo_temp_item)
1730 {
1731 ELM_COLOR_ITEM_DATA_GET(eo_temp_item, temp_item);
1732 if (item == temp_item) sd->selected = l;
1733 }
1734 sd->focused = ELM_COLORSELECTOR_PALETTE;
1735
1736 return EINA_TRUE;
1737}
1738
1705EOLIAN static Eo * 1739EOLIAN static Eo *
1706_elm_color_item_efl_object_constructor(Eo *eo_item, Elm_Color_Item_Data *item) 1740_elm_color_item_efl_object_constructor(Eo *eo_item, Elm_Color_Item_Data *item)
1707{ 1741{
@@ -1744,6 +1778,8 @@ _elm_color_item_efl_object_constructor(Eo *eo_item, Elm_Color_Item_Data *item)
1744 if (_elm_config->access_mode == ELM_ACCESS_MODE_ON) 1778 if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
1745 elm_wdg_item_access_register(eo_item); 1779 elm_wdg_item_access_register(eo_item);
1746 1780
1781 elm_interface_atspi_accessible_role_set(eo_item, ELM_ATSPI_ROLE_RADIO_BUTTON);
1782
1747 return eo_item; 1783 return eo_item;
1748} 1784}
1749 1785
@@ -2586,6 +2622,36 @@ _elm_colorselector_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EIN
2586 return &atspi_actions[0]; 2622 return &atspi_actions[0];
2587} 2623}
2588 2624
2625EOLIAN static Eina_List*
2626_elm_colorselector_elm_interface_atspi_accessible_children_get(Eo *obj EINA_UNUSED, Elm_Colorselector_Data *sd)
2627{
2628 Eina_List *ret = NULL;
2629
2630 ret = elm_interface_atspi_accessible_children_get(efl_super(obj, ELM_COLORSELECTOR_CLASS));
2631 // filter - out box contiainer
2632 ret = eina_list_remove(ret, sd->palette_box);
2633 // append items as colorselector children
2634 ret = eina_list_merge(ret, eina_list_clone(sd->items));
2635
2636 return ret;
2637}
2638
2639EOLIAN static Elm_Atspi_State_Set
2640_elm_color_item_elm_interface_atspi_accessible_state_set_get(Eo *obj, Elm_Color_Item_Data *sd EINA_UNUSED)
2641{
2642 Elm_Atspi_State_Set ret;
2643 Eina_Bool sel;
2644
2645 ret = elm_interface_atspi_accessible_state_set_get(efl_super(obj, ELM_COLOR_ITEM_CLASS));
2646
2647 sel = elm_obj_color_item_selected_get(obj);
2648
2649 if (sel)
2650 STATE_TYPE_SET(ret, ELM_ATSPI_STATE_CHECKED);
2651
2652 return ret;
2653}
2654
2589EOLIAN static void 2655EOLIAN static void
2590_elm_color_item_elm_widget_item_focus_set(Eo *eo_it, Elm_Color_Item_Data *it, Eina_Bool focused) 2656_elm_color_item_elm_widget_item_focus_set(Eo *eo_it, Elm_Color_Item_Data *it, Eina_Bool focused)
2591{ 2657{
@@ -2623,6 +2689,43 @@ _elm_color_item_elm_widget_item_focus_get(Eo *eo_it, Elm_Color_Item_Data *it)
2623 return EINA_FALSE; 2689 return EINA_FALSE;
2624} 2690}
2625 2691
2692EOLIAN static const Elm_Atspi_Action*
2693_elm_color_item_elm_interface_atspi_widget_action_elm_actions_get(Eo *eo_it EINA_UNUSED, Elm_Color_Item_Data *it EINA_UNUSED)
2694{
2695 static Elm_Atspi_Action atspi_actions[] = {
2696 { "activate", "activate", NULL, _item_action_activate},
2697 { NULL, NULL, NULL, NULL }
2698 };
2699 return &atspi_actions[0];
2700}
2701
2702EOLIAN static const char*
2703_elm_color_item_elm_interface_atspi_accessible_name_get(Eo *eo_it, Elm_Color_Item_Data *it)
2704{
2705 Eina_Strbuf *buf;
2706 const char *color_name = NULL;
2707 const char *name;
2708 char *accessible_name;
2709
2710 name = elm_interface_atspi_accessible_name_get(efl_super(eo_it, ELM_COLOR_ITEM_CLASS));
2711 if (name) return name;
2712
2713 buf = eina_strbuf_new();
2714 color_name = _get_color_name(it->color->r, it->color->g, it->color->b, it->color->a);
2715 if (color_name)
2716 eina_strbuf_append_printf(buf, "%s", color_name);
2717 else
2718 eina_strbuf_append_printf(buf, "red %d, green %d, blue %d, alpha %d",
2719 it->color->r, it->color->g, it->color->b, it->color->a);
2720 accessible_name = eina_strbuf_string_steal(buf);
2721 eina_strbuf_free(buf);
2722
2723 eina_stringshare_del(it->base->accessible_name);
2724 it->base->accessible_name = eina_stringshare_add(accessible_name);
2725 free(accessible_name);
2726 return it->base->accessible_name;
2727}
2728
2626/* Internal EO APIs and hidden overrides */ 2729/* Internal EO APIs and hidden overrides */
2627 2730
2628#define ELM_COLORSELECTOR_EXTRA_OPS \ 2731#define ELM_COLORSELECTOR_EXTRA_OPS \
diff --git a/src/lib/elementary/elm_colorselector.eo b/src/lib/elementary/elm_colorselector.eo
index 023c1b79c5..9371384a66 100644
--- a/src/lib/elementary/elm_colorselector.eo
+++ b/src/lib/elementary/elm_colorselector.eo
@@ -117,6 +117,7 @@ class Elm.Colorselector (Elm.Layout, Elm.Interface.Atspi_Widget_Action,
117 Elm.Widget.widget_event; 117 Elm.Widget.widget_event;
118 Elm.Layout.sizing_eval; 118 Elm.Layout.sizing_eval;
119 Elm.Interface.Atspi_Widget_Action.elm_actions { get; } 119 Elm.Interface.Atspi_Widget_Action.elm_actions { get; }
120 Elm.Interface.Atspi_Accessible.children { get; }
120 } 121 }
121 events { 122 events {
122 color,item,selected; [[Called when color item was selected]] 123 color,item,selected; [[Called when color item was selected]]