summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2015-05-26 16:28:35 +0200
committerLukasz Stanislawski <l.stanislaws@samsung.com>2015-05-26 16:31:00 +0200
commit4d72cad449a41e792113762d3162badb8f16720d (patch)
tree0a3951ffa7ed22a7c82addc8376ffecb886c2efc
parent9719b3560c4a1d9e821a0dcc499bfeeaca5b09c8 (diff)
toolbar: implement Atspi_Selection interface
Allow to select and deselect toolbar items by Assistive Technology Clients through org.a11y.atspi.Selection dbus interface.
-rw-r--r--src/lib/elm_toolbar.c95
-rw-r--r--src/lib/elm_toolbar.eo10
2 files changed, 104 insertions, 1 deletions
diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c
index 609878d23..d62edad8a 100644
--- a/src/lib/elm_toolbar.c
+++ b/src/lib/elm_toolbar.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
@@ -3827,5 +3828,99 @@ _elm_toolbar_elm_interface_atspi_accessible_state_set_get(Eo *obj, Elm_Toolbar_D
3827 return ret; 3828 return ret;
3828} 3829}
3829 3830
3831EOLIAN int
3832_elm_toolbar_elm_interface_atspi_selection_selected_children_count_get(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *pd)
3833{
3834 return pd->selected_item ? 1 : 0;
3835}
3836
3837EOLIAN Eo*
3838_elm_toolbar_elm_interface_atspi_selection_selected_child_get(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *pd, int child_idx)
3839{
3840 if (child_idx != 0)
3841 return NULL;
3842
3843 return pd->selected_item;
3844}
3845
3846EOLIAN Eina_Bool
3847_elm_toolbar_elm_interface_atspi_selection_child_select(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *pd, int child_index)
3848{
3849 Elm_Toolbar_Item_Data *item;
3850 if (pd->select_mode != ELM_OBJECT_SELECT_MODE_NONE)
3851 {
3852 EINA_INLIST_FOREACH(pd->items, item)
3853 {
3854 if (child_index-- == 0)
3855 {
3856 elm_toolbar_item_selected_set(EO_OBJ(item), EINA_TRUE);
3857 return EINA_TRUE;
3858 }
3859 }
3860 }
3861 return EINA_FALSE;
3862}
3863
3864EOLIAN Eina_Bool
3865_elm_toolbar_elm_interface_atspi_selection_selected_child_deselect(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *pd, int child_index)
3866{
3867 if (child_index != 0)
3868 return EINA_FALSE;
3869
3870 if (!pd->selected_item)
3871 return EINA_FALSE;
3872
3873 elm_toolbar_item_selected_set(pd->selected_item, EINA_FALSE);
3874
3875 return EINA_TRUE;
3876}
3877
3878EOLIAN Eina_Bool
3879_elm_toolbar_elm_interface_atspi_selection_is_child_selected(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *pd, int child_index)
3880{
3881 Elm_Toolbar_Item_Data *item;
3882
3883 EINA_INLIST_FOREACH(pd->items, item)
3884 {
3885 if (child_index-- == 0)
3886 {
3887 return elm_toolbar_item_selected_get(EO_OBJ(item));
3888 }
3889 }
3890 return EINA_FALSE;
3891}
3892
3893EOLIAN Eina_Bool
3894_elm_toolbar_elm_interface_atspi_selection_all_children_select(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *pd EINA_UNUSED)
3895{
3896 return EINA_FALSE;
3897}
3898
3899EOLIAN Eina_Bool
3900_elm_toolbar_elm_interface_atspi_selection_clear(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *pd)
3901{
3902 if (pd->selected_item)
3903 elm_toolbar_item_selected_set(pd->selected_item, EINA_FALSE);
3904 return EINA_TRUE;
3905}
3906
3907EOLIAN Eina_Bool
3908_elm_toolbar_elm_interface_atspi_selection_child_deselect(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *pd, int child_index)
3909{
3910 Elm_Toolbar_Item_Data *item;
3911 if (pd->select_mode != ELM_OBJECT_SELECT_MODE_NONE)
3912 {
3913 EINA_INLIST_FOREACH(pd->items, item)
3914 {
3915 if (child_index-- == 0)
3916 {
3917 elm_toolbar_item_selected_set(EO_OBJ(item), EINA_FALSE);
3918 return EINA_TRUE;
3919 }
3920 }
3921 }
3922 return EINA_FALSE;
3923}
3924
3830#include "elm_toolbar.eo.c" 3925#include "elm_toolbar.eo.c"
3831#include "elm_toolbar_item.eo.c" 3926#include "elm_toolbar_item.eo.c"
diff --git a/src/lib/elm_toolbar.eo b/src/lib/elm_toolbar.eo
index 21c03ceef..a6d643115 100644
--- a/src/lib/elm_toolbar.eo
+++ b/src/lib/elm_toolbar.eo
@@ -28,7 +28,7 @@ enum Elm.Toolbar.Shrink_Mode
28} 28}
29 29
30class Elm.Toolbar (Elm.Widget, Elm_Interface_Scrollable, 30class Elm.Toolbar (Elm.Widget, Elm_Interface_Scrollable,
31 Elm_Interface_Atspi_Widget_Action) 31 Elm_Interface_Atspi_Widget_Action, Elm_Interface_Atspi_Selection)
32{ 32{
33 eo_prefix: elm_obj_toolbar; 33 eo_prefix: elm_obj_toolbar;
34 methods { 34 methods {
@@ -543,6 +543,14 @@ class Elm.Toolbar (Elm.Widget, Elm_Interface_Scrollable,
543 Elm_Interface_Atspi_Widget_Action.elm_actions.get; 543 Elm_Interface_Atspi_Widget_Action.elm_actions.get;
544 Elm_Interface_Atspi_Accessible.children.get; 544 Elm_Interface_Atspi_Accessible.children.get;
545 Elm_Interface_Atspi_Accessible.state_set.get; 545 Elm_Interface_Atspi_Accessible.state_set.get;
546 Elm_Interface_Atspi_Selection.selected_children_count.get;
547 Elm_Interface_Atspi_Selection.selected_child.get;
548 Elm_Interface_Atspi_Selection.selected_child_deselect;
549 Elm_Interface_Atspi_Selection.child_select;
550 Elm_Interface_Atspi_Selection.child_deselect;
551 Elm_Interface_Atspi_Selection.is_child_selected;
552 Elm_Interface_Atspi_Selection.all_children_select;
553 Elm_Interface_Atspi_Selection.clear;
546 } 554 }
547 events { 555 events {
548 scroll; 556 scroll;