summaryrefslogtreecommitdiff
path: root/src/lib/elm_toolbar.c
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 /src/lib/elm_toolbar.c
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.
Diffstat (limited to 'src/lib/elm_toolbar.c')
-rw-r--r--src/lib/elm_toolbar.c95
1 files changed, 95 insertions, 0 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"