forked from enlightenment/efl
atspi:AtspiSelection interface added
Reviewers: stanluk, m.jagiello, raster Differential Revision: https://phab.enlightenment.org/D810
This commit is contained in:
parent
4d334ffdd8
commit
546b0f6634
|
@ -454,6 +454,7 @@ elm_interface_atspi_action.c \
|
||||||
elm_interface_atspi_component.c \
|
elm_interface_atspi_component.c \
|
||||||
elm_interface_atspi_image.c \
|
elm_interface_atspi_image.c \
|
||||||
elm_interface_atspi_value.c \
|
elm_interface_atspi_value.c \
|
||||||
|
elm_interface_atspi_selection.c \
|
||||||
elm_interface_atspi_widget.c \
|
elm_interface_atspi_widget.c \
|
||||||
elm_interface_atspi_widget_action.c \
|
elm_interface_atspi_widget_action.c \
|
||||||
elm_interface_atspi_window.c \
|
elm_interface_atspi_window.c \
|
||||||
|
@ -667,6 +668,8 @@ BUILT_SOURCES = \
|
||||||
elm_interface_atspi_widget.eo.h \
|
elm_interface_atspi_widget.eo.h \
|
||||||
elm_interface_atspi_widget_action.eo.c \
|
elm_interface_atspi_widget_action.eo.c \
|
||||||
elm_interface_atspi_widget_action.eo.h \
|
elm_interface_atspi_widget_action.eo.h \
|
||||||
|
elm_interface_atspi_selection.eo.c \
|
||||||
|
elm_interface_atspi_selection.eo.h \
|
||||||
elm_interface_atspi_window.eo.c \
|
elm_interface_atspi_window.eo.c \
|
||||||
elm_interface_atspi_window.eo.h \
|
elm_interface_atspi_window.eo.h \
|
||||||
elm_interface_fileselector.eo.c \
|
elm_interface_fileselector.eo.c \
|
||||||
|
@ -794,6 +797,7 @@ elementaryeolianfiles_DATA = \
|
||||||
elm_interface_atspi_component.eo \
|
elm_interface_atspi_component.eo \
|
||||||
elm_interface_atspi_image.eo \
|
elm_interface_atspi_image.eo \
|
||||||
elm_interface_atspi_value.eo \
|
elm_interface_atspi_value.eo \
|
||||||
|
elm_interface_atspi_selection.eo \
|
||||||
elm_interface_atspi_widget.eo \
|
elm_interface_atspi_widget.eo \
|
||||||
elm_interface_atspi_widget_action.eo \
|
elm_interface_atspi_widget_action.eo \
|
||||||
elm_interface_atspi_window.eo \
|
elm_interface_atspi_window.eo \
|
||||||
|
@ -887,6 +891,7 @@ nodist_includesunstable_HEADERS = \
|
||||||
elm_interface_atspi_component.eo.h \
|
elm_interface_atspi_component.eo.h \
|
||||||
elm_interface_atspi_image.eo.h \
|
elm_interface_atspi_image.eo.h \
|
||||||
elm_interface_atspi_value.eo.h \
|
elm_interface_atspi_value.eo.h \
|
||||||
|
elm_interface_atspi_selection.eo.h \
|
||||||
elm_interface_atspi_widget.eo.h \
|
elm_interface_atspi_widget.eo.h \
|
||||||
elm_interface_atspi_widget_action.eo.h \
|
elm_interface_atspi_widget_action.eo.h \
|
||||||
elm_interface_atspi_window.eo.h \
|
elm_interface_atspi_window.eo.h \
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#define ELM_INTERFACE_ATSPI_ACTION_PROTECTED
|
#define ELM_INTERFACE_ATSPI_ACTION_PROTECTED
|
||||||
#define ELM_INTERFACE_ATSPI_VALUE_PROTECTED
|
#define ELM_INTERFACE_ATSPI_VALUE_PROTECTED
|
||||||
#define ELM_INTERFACE_ATSPI_IMAGE_PROTECTED
|
#define ELM_INTERFACE_ATSPI_IMAGE_PROTECTED
|
||||||
|
#define ELM_INTERFACE_ATSPI_SELECTION_PROTECTED
|
||||||
#include "atspi/atspi-constants.h"
|
#include "atspi/atspi-constants.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@ -21,6 +22,7 @@
|
||||||
#include "elm_interface_atspi_action.eo.h"
|
#include "elm_interface_atspi_action.eo.h"
|
||||||
#include "elm_interface_atspi_value.eo.h"
|
#include "elm_interface_atspi_value.eo.h"
|
||||||
#include "elm_interface_atspi_image.eo.h"
|
#include "elm_interface_atspi_image.eo.h"
|
||||||
|
#include "elm_interface_atspi_selection.eo.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Accessibility Bus info not defined in atspi-constants.h
|
* Accessibility Bus info not defined in atspi-constants.h
|
||||||
|
@ -58,6 +60,7 @@ static Eina_Bool _state_changed_signal_send(void *data, Eo *obj, const Eo_Event_
|
||||||
static Eina_Bool _property_changed_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info);
|
static Eina_Bool _property_changed_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info);
|
||||||
static Eina_Bool _children_changed_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info);
|
static Eina_Bool _children_changed_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info);
|
||||||
static Eina_Bool _window_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
|
static Eina_Bool _window_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
|
||||||
|
static Eina_Bool _selection_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
|
||||||
static Eo * _access_object_from_path(const char *path);
|
static Eo * _access_object_from_path(const char *path);
|
||||||
static char * _path_from_access_object(Eo *eo);
|
static char * _path_from_access_object(Eo *eo);
|
||||||
static void _object_append_reference(Eldbus_Message_Iter *iter, Eo *obj);
|
static void _object_append_reference(Eldbus_Message_Iter *iter, Eo *obj);
|
||||||
|
@ -79,6 +82,10 @@ EO_CALLBACKS_ARRAY_DEFINE(_window_cb,
|
||||||
{ ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DEACTIVATED, _window_signal_send}
|
{ ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DEACTIVATED, _window_signal_send}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
EO_CALLBACKS_ARRAY_DEFINE(_selection_cb,
|
||||||
|
{ ELM_INTERFACE_ATSPI_SELECTION_EVENT_SELECTION_CHANGED, _selection_signal_send}
|
||||||
|
);
|
||||||
|
|
||||||
enum _Atspi_Object_Child_Event_Type
|
enum _Atspi_Object_Child_Event_Type
|
||||||
{
|
{
|
||||||
ATSPI_OBJECT_CHILD_ADDED = 0,
|
ATSPI_OBJECT_CHILD_ADDED = 0,
|
||||||
|
@ -583,6 +590,160 @@ static const Eldbus_Method accessible_methods[] = {
|
||||||
{ NULL, NULL, NULL, NULL, 0 }
|
{ NULL, NULL, NULL, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static Eldbus_Message *
|
||||||
|
_selection_selected_child_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
|
||||||
|
{
|
||||||
|
const char *obj_path = eldbus_service_object_path_get(iface);
|
||||||
|
Eo *obj = _access_object_from_path(obj_path);
|
||||||
|
Eo *child = NULL;
|
||||||
|
|
||||||
|
int idx;
|
||||||
|
Eldbus_Message *ret;
|
||||||
|
Eldbus_Message_Iter *iter;
|
||||||
|
|
||||||
|
if (!eldbus_message_arguments_get(msg, "i", &idx))
|
||||||
|
return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type.");
|
||||||
|
|
||||||
|
ret = eldbus_message_method_return_new(msg);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
|
||||||
|
|
||||||
|
iter = eldbus_message_iter_get(ret);
|
||||||
|
eo_do(obj, child = elm_interface_atspi_selection_selected_child_get(idx));
|
||||||
|
|
||||||
|
_object_append_reference(iter, child);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eldbus_Message *
|
||||||
|
_selection_child_select(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
|
||||||
|
{
|
||||||
|
const char *obj_path = eldbus_service_object_path_get(iface);
|
||||||
|
Eo *obj = _access_object_from_path(obj_path);
|
||||||
|
int idx;
|
||||||
|
Eldbus_Message *ret;
|
||||||
|
Eina_Bool result;
|
||||||
|
|
||||||
|
if (!eldbus_message_arguments_get(msg, "i", &idx))
|
||||||
|
return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type.");
|
||||||
|
|
||||||
|
ret = eldbus_message_method_return_new(msg);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
|
||||||
|
|
||||||
|
eo_do(obj, result = elm_interface_atspi_selection_child_select(idx));
|
||||||
|
eldbus_message_arguments_append(ret, "b", result);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eldbus_Message *
|
||||||
|
_selection_selected_child_deselect(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
|
||||||
|
{
|
||||||
|
const char *obj_path = eldbus_service_object_path_get(iface);
|
||||||
|
Eo *obj = _access_object_from_path(obj_path);
|
||||||
|
int idx;
|
||||||
|
Eldbus_Message *ret;
|
||||||
|
Eina_Bool result;
|
||||||
|
|
||||||
|
if (!eldbus_message_arguments_get(msg, "i", &idx))
|
||||||
|
return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type.");
|
||||||
|
|
||||||
|
ret = eldbus_message_method_return_new(msg);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
|
||||||
|
|
||||||
|
eo_do(obj, result = elm_interface_atspi_selection_selected_child_deselect(idx));
|
||||||
|
eldbus_message_arguments_append(ret, "b", result);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eldbus_Message *
|
||||||
|
_selection_is_child_selected(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
|
||||||
|
{
|
||||||
|
const char *obj_path = eldbus_service_object_path_get(iface);
|
||||||
|
Eo *obj = _access_object_from_path(obj_path);
|
||||||
|
int idx;
|
||||||
|
Eldbus_Message *ret;
|
||||||
|
Eina_Bool result;
|
||||||
|
|
||||||
|
if (!eldbus_message_arguments_get(msg, "i", &idx))
|
||||||
|
return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type.");
|
||||||
|
|
||||||
|
ret = eldbus_message_method_return_new(msg);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
|
||||||
|
|
||||||
|
eo_do(obj, result = elm_interface_atspi_selection_is_child_selected(idx));
|
||||||
|
eldbus_message_arguments_append(ret, "b", result);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eldbus_Message *
|
||||||
|
_selection_all_children_select(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
|
||||||
|
{
|
||||||
|
const char *obj_path = eldbus_service_object_path_get(iface);
|
||||||
|
Eo *obj = _access_object_from_path(obj_path);
|
||||||
|
Eldbus_Message *ret;
|
||||||
|
Eina_Bool result;
|
||||||
|
|
||||||
|
ret = eldbus_message_method_return_new(msg);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
|
||||||
|
|
||||||
|
eo_do(obj, result = elm_interface_atspi_selection_all_children_select());
|
||||||
|
eldbus_message_arguments_append(ret, "b", result);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eldbus_Message *
|
||||||
|
_selection_clear(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
|
||||||
|
{
|
||||||
|
const char *obj_path = eldbus_service_object_path_get(iface);
|
||||||
|
Eo *obj = _access_object_from_path(obj_path);
|
||||||
|
Eldbus_Message *ret;
|
||||||
|
Eina_Bool result;
|
||||||
|
|
||||||
|
ret = eldbus_message_method_return_new(msg);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
|
||||||
|
|
||||||
|
eo_do(obj, result = elm_interface_atspi_selection_clear());
|
||||||
|
eldbus_message_arguments_append(ret, "b", result);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eldbus_Message *
|
||||||
|
_selection_child_deselect(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
|
||||||
|
{
|
||||||
|
const char *obj_path = eldbus_service_object_path_get(iface);
|
||||||
|
Eo *obj = _access_object_from_path(obj_path);
|
||||||
|
int idx;
|
||||||
|
Eldbus_Message *ret;
|
||||||
|
Eina_Bool result;
|
||||||
|
|
||||||
|
if (!eldbus_message_arguments_get(msg, "i", &idx))
|
||||||
|
return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type.");
|
||||||
|
|
||||||
|
ret = eldbus_message_method_return_new(msg);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
|
||||||
|
|
||||||
|
eo_do(obj, result = elm_interface_atspi_selection_child_deselect(idx));
|
||||||
|
eldbus_message_arguments_append(ret, "b", result);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const Eldbus_Method selection_methods[] = {
|
||||||
|
{ "GetSelectedChild", ELDBUS_ARGS({"i", "selectedChildIndex"}), ELDBUS_ARGS({"(so)", "Accessible"}), _selection_selected_child_get, 0 },
|
||||||
|
{ "SelectChild", ELDBUS_ARGS({"i", "childIndex"}), ELDBUS_ARGS({"b", "result"}), _selection_child_select, 0 },
|
||||||
|
{ "DeselectSelectedChild", ELDBUS_ARGS({"i", "selectedChildIndex"}), ELDBUS_ARGS({"b", "result"}), _selection_selected_child_deselect, 0 },
|
||||||
|
{ "IsChildSelected", ELDBUS_ARGS({"i", "childIndex"}), ELDBUS_ARGS({"b", "result"}), _selection_is_child_selected, 0 },
|
||||||
|
{ "SelectAll", NULL, ELDBUS_ARGS({"b", "result"}), _selection_all_children_select, 0},
|
||||||
|
{ "ClearSelection", NULL, ELDBUS_ARGS({"b", "result"}), _selection_clear, 0},
|
||||||
|
{ "DeselectChild", ELDBUS_ARGS({"i", "childIndex"}), ELDBUS_ARGS({"b", "result"}), _selection_child_deselect, 0 },
|
||||||
|
{ NULL, NULL, NULL, NULL, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
static Eldbus_Message *
|
static Eldbus_Message *
|
||||||
_action_description_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
|
_action_description_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
|
||||||
{
|
{
|
||||||
|
@ -892,6 +1053,26 @@ _accessible_property_get(const Eldbus_Service_Interface *interface, const char *
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_selection_property_get(const Eldbus_Service_Interface *interface, const char *property,
|
||||||
|
Eldbus_Message_Iter *iter, const Eldbus_Message *request_msg EINA_UNUSED,
|
||||||
|
Eldbus_Message **error EINA_UNUSED)
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
const char *obj_path = eldbus_service_object_path_get(interface);
|
||||||
|
Eo *obj = _access_object_from_path(obj_path);
|
||||||
|
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
|
||||||
|
|
||||||
|
if (!strcmp(property, "NSelectedChildren"))
|
||||||
|
{
|
||||||
|
eo_do(obj, n = elm_interface_atspi_selection_selected_children_count_get());
|
||||||
|
eldbus_message_iter_basic_append(iter, 'i', n);
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_action_property_get(const Eldbus_Service_Interface *interface, const char *property,
|
_action_property_get(const Eldbus_Service_Interface *interface, const char *property,
|
||||||
Eldbus_Message_Iter *iter, const Eldbus_Message *request_msg EINA_UNUSED,
|
Eldbus_Message_Iter *iter, const Eldbus_Message *request_msg EINA_UNUSED,
|
||||||
|
@ -1033,6 +1214,11 @@ static const Eldbus_Property image_properties[] = {
|
||||||
{ NULL, NULL, NULL, NULL, 0 }
|
{ NULL, NULL, NULL, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const Eldbus_Property selection_properties[] = {
|
||||||
|
{ "NSelectedChildren", "i", _selection_property_get, NULL, 0 },
|
||||||
|
{ NULL, NULL, NULL, NULL, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
static const Eldbus_Service_Interface_Desc accessible_iface_desc = {
|
static const Eldbus_Service_Interface_Desc accessible_iface_desc = {
|
||||||
ATSPI_DBUS_INTERFACE_ACCESSIBLE, accessible_methods, NULL, accessible_properties, _accessible_property_get, NULL
|
ATSPI_DBUS_INTERFACE_ACCESSIBLE, accessible_methods, NULL, accessible_properties, _accessible_property_get, NULL
|
||||||
};
|
};
|
||||||
|
@ -1057,6 +1243,10 @@ static const Eldbus_Service_Interface_Desc image_iface_desc = {
|
||||||
ATSPI_DBUS_INTERFACE_IMAGE, image_methods, NULL, image_properties, _image_properties_get, NULL
|
ATSPI_DBUS_INTERFACE_IMAGE, image_methods, NULL, image_properties, _image_properties_get, NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const Eldbus_Service_Interface_Desc selection_iface_desc = {
|
||||||
|
ATSPI_DBUS_INTERFACE_SELECTION, selection_methods, NULL, selection_properties, NULL, NULL
|
||||||
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_object_append_reference(Eldbus_Message_Iter *iter, Eo *obj)
|
_object_append_reference(Eldbus_Message_Iter *iter, Eo *obj)
|
||||||
{
|
{
|
||||||
|
@ -1914,6 +2104,50 @@ _window_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc, void
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_selection_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
const char *event_desc;
|
||||||
|
Eldbus_Message *msg;
|
||||||
|
Eldbus_Message_Iter *iter, *viter;
|
||||||
|
Eldbus_Service_Interface *selection = data;
|
||||||
|
|
||||||
|
enum _Atspi_Object_Signals type;
|
||||||
|
if (desc == ELM_INTERFACE_ATSPI_SELECTION_EVENT_SELECTION_CHANGED)
|
||||||
|
{
|
||||||
|
event_desc = "SelectionChanged";
|
||||||
|
type = ATSPI_OBJECT_EVENT_SELECTION_CHANGED;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WRN("ATSPI Selection event not handled");
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!selection || !_a11y_bus)
|
||||||
|
{
|
||||||
|
ERR("A11Y connection closed. Unable to send ATSPI event.");
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
msg = eldbus_service_signal_new(selection, type);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(msg, EINA_FALSE);
|
||||||
|
|
||||||
|
iter = eldbus_message_iter_get(msg);
|
||||||
|
eldbus_message_iter_arguments_append(iter, "sii", event_desc, 0, 0);
|
||||||
|
|
||||||
|
viter = eldbus_message_iter_container_new(iter, 'v', "i");
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(viter, EINA_FALSE);
|
||||||
|
|
||||||
|
eldbus_message_iter_arguments_append(viter, "i", 0);
|
||||||
|
eldbus_message_iter_container_close(iter, viter);
|
||||||
|
|
||||||
|
_object_append_reference(iter, obj);
|
||||||
|
|
||||||
|
eldbus_service_signal_send(selection, msg);
|
||||||
|
DBG("signal sent Selection:%s", event_desc);
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
static void
|
static void
|
||||||
_event_handlers_register(void)
|
_event_handlers_register(void)
|
||||||
{
|
{
|
||||||
|
@ -2032,6 +2266,13 @@ static void _object_register(Eo *obj, char *path)
|
||||||
eldbus_service_interface_register(_a11y_bus, path, &value_iface_desc);
|
eldbus_service_interface_register(_a11y_bus, path, &value_iface_desc);
|
||||||
if (eo_isa(obj, ELM_INTERFACE_ATSPI_IMAGE_CLASS))
|
if (eo_isa(obj, ELM_INTERFACE_ATSPI_IMAGE_CLASS))
|
||||||
eldbus_service_interface_register(_a11y_bus, path, &image_iface_desc);
|
eldbus_service_interface_register(_a11y_bus, path, &image_iface_desc);
|
||||||
|
if (eo_isa(obj, ELM_INTERFACE_ATSPI_SELECTION_CLASS))
|
||||||
|
{
|
||||||
|
infc = eldbus_service_interface_register(_a11y_bus, path, &selection_iface_desc);
|
||||||
|
eo_do(obj, eo_key_data_set("selection_interface", infc, NULL));
|
||||||
|
eo_do(obj, eo_event_callback_array_add(_selection_cb(), infc));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2056,6 +2297,11 @@ static void _object_unregister(void *obj)
|
||||||
eo_do(obj, infc = eo_key_data_get("window_interface"));
|
eo_do(obj, infc = eo_key_data_get("window_interface"));
|
||||||
eo_do(obj, eo_event_callback_array_del(_window_cb(), infc));
|
eo_do(obj, eo_event_callback_array_del(_window_cb(), infc));
|
||||||
}
|
}
|
||||||
|
if (eo_isa(obj, ELM_INTERFACE_ATSPI_SELECTION_CLASS))
|
||||||
|
{
|
||||||
|
eo_do(obj, infc = eo_key_data_get("selection_interface"));
|
||||||
|
eo_do(obj, eo_event_callback_array_del(_selection_cb(), infc));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "elementary_config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <Elementary.h>
|
||||||
|
#include "elm_widget.h"
|
||||||
|
#include "elm_priv.h"
|
||||||
|
|
||||||
|
#define ELM_INTERFACE_ATSPI_VALUE_PROTECTED
|
||||||
|
|
||||||
|
#include "elm_interface_atspi_selection.eo.h"
|
||||||
|
#include "elm_interface_atspi_selection.eo.c"
|
|
@ -0,0 +1,74 @@
|
||||||
|
interface Elm_Interface_Atspi_Selection ()
|
||||||
|
{
|
||||||
|
legacy_prefix: null;
|
||||||
|
eo_prefix: elm_interface_atspi_selection;
|
||||||
|
data: null;
|
||||||
|
properties {
|
||||||
|
protected selected_children_count {
|
||||||
|
get {
|
||||||
|
/* Gets the number of currently selected children */
|
||||||
|
return int;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected selected_child {
|
||||||
|
/* Gets child for given child index */
|
||||||
|
get {
|
||||||
|
return Eo*;
|
||||||
|
}
|
||||||
|
keys {
|
||||||
|
int selected_child_index; /*@ index of selected child */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
methods {
|
||||||
|
protected child_select {
|
||||||
|
/* Adds selection for given child index */
|
||||||
|
params {
|
||||||
|
@in int child_index;
|
||||||
|
}
|
||||||
|
return Eina_Bool;
|
||||||
|
}
|
||||||
|
protected selected_child_deselect {
|
||||||
|
/* Removes selection for given child index */
|
||||||
|
params {
|
||||||
|
@in int child_index;
|
||||||
|
}
|
||||||
|
return Eina_Bool;
|
||||||
|
}
|
||||||
|
protected is_child_selected {
|
||||||
|
/* Determines if child specified by index is selected */
|
||||||
|
params {
|
||||||
|
@in int child_index;
|
||||||
|
}
|
||||||
|
return Eina_Bool;
|
||||||
|
}
|
||||||
|
protected all_children_select {
|
||||||
|
/* Adds selection for all children */
|
||||||
|
return Eina_Bool;
|
||||||
|
}
|
||||||
|
protected clear {
|
||||||
|
/* Clears the current selection */
|
||||||
|
return Eina_Bool;
|
||||||
|
}
|
||||||
|
protected child_deselect {
|
||||||
|
/* Removes selection for given child index */
|
||||||
|
params {
|
||||||
|
@in int child_index;
|
||||||
|
}
|
||||||
|
return Eina_Bool;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
events {
|
||||||
|
selection,changed; /*@ Called when selection has been changed. */
|
||||||
|
}
|
||||||
|
implements {
|
||||||
|
virtual::selected_children_count::get;
|
||||||
|
virtual::selected_child::get;
|
||||||
|
virtual::child_select;
|
||||||
|
virtual::selected_child_deselect;
|
||||||
|
virtual::is_child_selected;
|
||||||
|
virtual::all_children_select;
|
||||||
|
virtual::clear;
|
||||||
|
virtual::child_deselect;
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,6 +11,7 @@ elm_suite_SOURCES = \
|
||||||
elm_test_colorselector.c \
|
elm_test_colorselector.c \
|
||||||
elm_test_entry.c \
|
elm_test_entry.c \
|
||||||
elm_test_init.c
|
elm_test_init.c
|
||||||
|
elm_test_list.c
|
||||||
|
|
||||||
elm_suite_CPPFLAGS = \
|
elm_suite_CPPFLAGS = \
|
||||||
-DTESTS_BUILD_DIR=\"${top_builddir}/src/tests\" \
|
-DTESTS_BUILD_DIR=\"${top_builddir}/src/tests\" \
|
||||||
|
|
|
@ -0,0 +1,195 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "elementary_config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <Elementary.h>
|
||||||
|
#include "elm_suite.h"
|
||||||
|
|
||||||
|
#define ELM_INTERFACE_ATSPI_TEXT_PROTECTED
|
||||||
|
#include "elm_interface_atspi_selection.h"
|
||||||
|
#include "elm_interface_atspi_selection.eo.h"
|
||||||
|
|
||||||
|
|
||||||
|
START_TEST (elm_list_atspi_selection_selected_children_count_get)
|
||||||
|
{
|
||||||
|
Evas_Object *win, *list;
|
||||||
|
Elm_Object_Item *item;
|
||||||
|
int val;
|
||||||
|
|
||||||
|
elm_init(1, NULL);
|
||||||
|
win = elm_win_add(NULL, "genlist", ELM_WIN_BASIC);
|
||||||
|
|
||||||
|
list = elm_list_add(win);
|
||||||
|
item = elm_list_item_append(list, "First Element", NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
eo_do(list, val = elm_interface_atspi_selection_selected_children_count_get());
|
||||||
|
ck_assert(val == 0);
|
||||||
|
|
||||||
|
elm_list_item_selected_set(item, EINA_TRUE);
|
||||||
|
eo_do(list, val = elm_interface_atspi_selection_selected_children_count_get());
|
||||||
|
ck_assert(val == 1);
|
||||||
|
|
||||||
|
elm_list_item_selected_set(item, EINA_FALSE);
|
||||||
|
eo_do(list, val = elm_interface_atspi_selection_selected_children_count_get());
|
||||||
|
ck_assert(val == 0);
|
||||||
|
|
||||||
|
elm_shutdown();
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST (elm_list_atspi_selection_child_select)
|
||||||
|
{
|
||||||
|
Evas_Object *win, *list;
|
||||||
|
Elm_Object_Item *item;
|
||||||
|
Eina_Bool val;
|
||||||
|
|
||||||
|
elm_init(1, NULL);
|
||||||
|
win = elm_win_add(NULL, "genlist", ELM_WIN_BASIC);
|
||||||
|
|
||||||
|
list = elm_list_add(win);
|
||||||
|
item = elm_list_item_append(list, "First Element", NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
eo_do(list, val = elm_interface_atspi_selection_child_select(0));
|
||||||
|
ck_assert(val == EINA_TRUE);
|
||||||
|
ck_assert(EINA_TRUE == elm_list_item_selected_get(item));
|
||||||
|
|
||||||
|
elm_shutdown();
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST (elm_list_atspi_selection_selected_child_deselect)
|
||||||
|
{
|
||||||
|
Evas_Object *win, *list;
|
||||||
|
Elm_Object_Item *item1, *item2;
|
||||||
|
Eina_Bool val;
|
||||||
|
|
||||||
|
elm_init(1, NULL);
|
||||||
|
win = elm_win_add(NULL, "genlist", ELM_WIN_BASIC);
|
||||||
|
|
||||||
|
list = elm_list_add(win);
|
||||||
|
elm_list_multi_select_set(list, EINA_TRUE);
|
||||||
|
item1 = elm_list_item_append(list, "First Element", NULL, NULL, NULL, NULL);
|
||||||
|
item2 = elm_list_item_append(list, "Second Element", NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
elm_list_item_selected_set(item2, EINA_TRUE);
|
||||||
|
eo_do(list, val = elm_interface_atspi_selection_selected_child_deselect(0));
|
||||||
|
ck_assert(val == EINA_TRUE);
|
||||||
|
ck_assert(EINA_FALSE == elm_list_item_selected_get(item2));
|
||||||
|
|
||||||
|
elm_shutdown();
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST (elm_list_atspi_selection_is_child_selected)
|
||||||
|
{
|
||||||
|
Evas_Object *win, *list;
|
||||||
|
Elm_Object_Item *item;
|
||||||
|
Eina_Bool val;
|
||||||
|
|
||||||
|
elm_init(1, NULL);
|
||||||
|
win = elm_win_add(NULL, "genlist", ELM_WIN_BASIC);
|
||||||
|
Eina_Bool val;
|
||||||
|
|
||||||
|
list = elm_list_add(win);
|
||||||
|
item = elm_list_item_append(list, "First Element", NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
eo_do(list, val = elm_interface_atspi_selection_is_child_selected(0));
|
||||||
|
ck_assert(val == EINA_FALSE);
|
||||||
|
|
||||||
|
elm_list_item_selected_set(item, EINA_TRUE);
|
||||||
|
eo_do(list, val = elm_interface_atspi_selection_is_child_selected(0));
|
||||||
|
ck_assert(val == EINA_TRUE);
|
||||||
|
|
||||||
|
elm_shutdown();
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST (elm_list_atspi_selection_all_children_select)
|
||||||
|
{
|
||||||
|
Evas_Object *win, *list;
|
||||||
|
Elm_Object_Item *item1, *item2;
|
||||||
|
Eina_Bool val;
|
||||||
|
|
||||||
|
elm_init(1, NULL);
|
||||||
|
win = elm_win_add(NULL, "genlist", ELM_WIN_BASIC);
|
||||||
|
Eina_Bool val;
|
||||||
|
|
||||||
|
list = elm_list_add(win);
|
||||||
|
|
||||||
|
item1 = elm_list_item_append(list, "First Element", NULL, NULL, NULL, NULL);
|
||||||
|
item2 = elm_list_item_append(list, "Second Element", NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
eo_do(list, val = elm_interface_atspi_selection_all_children_select(0));
|
||||||
|
ck_assert(val == EINA_FALSE);
|
||||||
|
|
||||||
|
elm_list_multi_select_set(list, EINA_TRUE);
|
||||||
|
eo_do(list, val = elm_interface_atspi_selection_all_children_select(0));
|
||||||
|
ck_assert(val == EINA_TRUE);
|
||||||
|
ck_assert(EINA_TRUE == elm_list_item_selected_get(item1));
|
||||||
|
ck_assert(EINA_TRUE == elm_list_item_selected_get(item2));
|
||||||
|
|
||||||
|
elm_shutdown();
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
|
||||||
|
START_TEST (elm_list_atspi_selection_child_clear)
|
||||||
|
{
|
||||||
|
Evas_Object *win, *list;
|
||||||
|
Elm_Object_Item *item1, *item2;
|
||||||
|
Eina_Bool val;
|
||||||
|
|
||||||
|
elm_init(1, NULL);
|
||||||
|
win = elm_win_add(NULL, "genlist", ELM_WIN_BASIC);
|
||||||
|
Eina_Bool val;
|
||||||
|
|
||||||
|
list = elm_list_add(win);
|
||||||
|
elm_list_multi_select_set(list, EINA_TRUE);
|
||||||
|
item1 = elm_list_item_append(list, "First Element", NULL, NULL, NULL, NULL);
|
||||||
|
item2 = elm_list_item_append(list, "Second Element", NULL, NULL, NULL, NULL);
|
||||||
|
elm_list_item_selected_set(item1, EINA_TRUE);
|
||||||
|
elm_list_item_selected_set(item2, EINA_TRUE);
|
||||||
|
|
||||||
|
|
||||||
|
eo_do(list, val = elm_interface_atspi_selection_child_clear(0));
|
||||||
|
ck_assert(val == EINA_TRUE);
|
||||||
|
ck_assert(EINA_FALSE == elm_list_item_selected_get(item1));
|
||||||
|
ck_assert(EINA_FALSE == elm_list_item_selected_get(item2));
|
||||||
|
|
||||||
|
elm_shutdown();
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST (elm_list_atspi_selection_child_deselect)
|
||||||
|
{
|
||||||
|
Evas_Object *win, *list;
|
||||||
|
Elm_Object_Item *item1, *item2;
|
||||||
|
Eina_Bool val;
|
||||||
|
|
||||||
|
elm_init(1, NULL);
|
||||||
|
win = elm_win_add(NULL, "genlist", ELM_WIN_BASIC);
|
||||||
|
|
||||||
|
list = elm_list_add(win);
|
||||||
|
elm_list_multi_select_set(list, EINA_TRUE);
|
||||||
|
item1 = elm_list_item_append(list, "First Element", NULL, NULL, NULL, NULL);
|
||||||
|
item2 = elm_list_item_append(list, "Second Element", NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
elm_list_item_selected_set(item2, EINA_TRUE);
|
||||||
|
eo_do(list, val = elm_interface_atspi_selection_selected_child_deselect(1));
|
||||||
|
ck_assert(val == EINA_TRUE);
|
||||||
|
ck_assert(EINA_FALSE == elm_list_item_selected_get(item2));
|
||||||
|
|
||||||
|
elm_shutdown();
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
void elm_test_list(TCase *tc)
|
||||||
|
{
|
||||||
|
tcase_add_test(tc, elm_list_atspi_selection_selected_children_count_get);
|
||||||
|
tcase_add_test(tc, elm_list_atspi_selection_child_select);
|
||||||
|
tcase_add_test(tc, elm_list_atspi_selection_selected_child_deselect);
|
||||||
|
tcase_add_test(tc, elm_list_atspi_selection_is_child_selected);
|
||||||
|
tcase_add_test(tc, elm_list_atspi_selection_all_children_select);
|
||||||
|
tcase_add_test(tc, elm_list_atspi_selection_clear);
|
||||||
|
tcase_add_test(tc, elm_list_atspi_selection_child_deselect);
|
||||||
|
}
|
Loading…
Reference in New Issue