forked from enlightenment/efl
[access] export some APIs which would improve application side flexibility.
+ elm_access_object_item_register(); + elm_access_object_item_unregister(); + elm_access_object_item_access_get(); SVN revision: 82561
This commit is contained in:
parent
d9179d33d7
commit
44363b8f19
|
@ -419,7 +419,7 @@ _elm_access_object_get(const Evas_Object *obj)
|
||||||
EAPI void
|
EAPI void
|
||||||
_elm_access_object_hilight(Evas_Object *obj)
|
_elm_access_object_hilight(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
Evas_Object *o, *parent_obj;
|
Evas_Object *o;
|
||||||
Evas_Coord x, y, w, h;
|
Evas_Coord x, y, w, h;
|
||||||
|
|
||||||
o = evas_object_name_find(evas_object_evas_get(obj), "_elm_access_disp");
|
o = evas_object_name_find(evas_object_evas_get(obj), "_elm_access_disp");
|
||||||
|
@ -447,11 +447,7 @@ _elm_access_object_hilight(Evas_Object *obj)
|
||||||
}
|
}
|
||||||
evas_object_data_set(o, "_elm_access_target", obj);
|
evas_object_data_set(o, "_elm_access_target", obj);
|
||||||
|
|
||||||
parent_obj = obj;
|
elm_widget_theme_object_set(obj, o, "access", "base", "default");
|
||||||
if (!elm_widget_is(obj))
|
|
||||||
parent_obj = evas_object_data_get(obj, "_elm_access_parent");
|
|
||||||
|
|
||||||
elm_widget_theme_object_set(parent_obj, o, "access", "base", "default");
|
|
||||||
|
|
||||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
|
||||||
_access_obj_hilight_del_cb, NULL);
|
_access_obj_hilight_del_cb, NULL);
|
||||||
|
@ -518,25 +514,64 @@ _content_move(void *data, Evas *e __UNUSED__, Evas_Object *obj,
|
||||||
evas_object_move(accessobj, x, y);
|
evas_object_move(accessobj, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static Evas_Object *
|
||||||
_part_access_info_cb(void *data, Evas_Object *obj)
|
_access_object_register(Evas_Object *obj, Evas_Object *parent)
|
||||||
{
|
{
|
||||||
Evas_Object *eobj = data;
|
Evas_Object *ao;
|
||||||
if (!eobj) return NULL;
|
Elm_Access_Info *ac;
|
||||||
|
Evas_Coord x, y, w, h;
|
||||||
|
|
||||||
const char *part = evas_object_data_get(obj, "_elm_access_part");
|
if (!obj) return NULL;
|
||||||
const char *txt = edje_object_part_text_get(eobj, part);
|
|
||||||
if (txt) return strdup(txt);
|
/* create access object */
|
||||||
return NULL;
|
ao = _elm_access_add(parent);
|
||||||
|
if (!ao) return NULL;
|
||||||
|
|
||||||
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
|
||||||
|
_content_resize, ao);
|
||||||
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
|
||||||
|
_content_move, ao);
|
||||||
|
|
||||||
|
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
||||||
|
evas_object_move(ao, x, y);
|
||||||
|
evas_object_resize(ao, w, h);
|
||||||
|
evas_object_show(ao);
|
||||||
|
|
||||||
|
/* register access object */
|
||||||
|
_elm_access_object_register(ao, obj);
|
||||||
|
|
||||||
|
/* set access object */
|
||||||
|
evas_object_data_set(obj, "_part_access_obj", ao);
|
||||||
|
|
||||||
|
/* set owner part object */
|
||||||
|
ac = evas_object_data_get(ao, "_elm_access");
|
||||||
|
ac->part_object = obj;
|
||||||
|
|
||||||
|
return ao;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_access_obj_del(void *data __UNUSED__, Evas *e __UNUSED__,
|
_access_object_unregister(Evas_Object *obj)
|
||||||
Evas_Object *obj, void *event_info __UNUSED__)
|
|
||||||
{
|
{
|
||||||
char *part = evas_object_data_get(obj, "_elm_access_part");
|
Evas_Object *ao;
|
||||||
evas_object_data_del(obj, "_elm_access_part");
|
|
||||||
if (part) free(part);
|
if (!obj) return;
|
||||||
|
|
||||||
|
ao = evas_object_data_get(obj, "_part_access_obj");
|
||||||
|
if (!ao) return;
|
||||||
|
|
||||||
|
evas_object_data_del(obj, "_part_access_obj");
|
||||||
|
|
||||||
|
/* delete callbacks */
|
||||||
|
evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
|
||||||
|
_content_resize, ao);
|
||||||
|
evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
|
||||||
|
_content_move, ao);
|
||||||
|
|
||||||
|
/* unregister access object */
|
||||||
|
_elm_access_object_unregister(ao, obj);
|
||||||
|
|
||||||
|
evas_object_del(ao);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Evas_Object *
|
EAPI Evas_Object *
|
||||||
|
@ -544,81 +579,33 @@ _elm_access_edje_object_part_object_register(Evas_Object* obj,
|
||||||
const Evas_Object *eobj,
|
const Evas_Object *eobj,
|
||||||
const char* part)
|
const char* part)
|
||||||
{
|
{
|
||||||
Evas_Object *ao;
|
Evas_Object *ao, *po;
|
||||||
Evas_Object *po = (Evas_Object *)edje_object_part_object_get(eobj, part);
|
|
||||||
Evas_Coord x, y, w, h;
|
|
||||||
Elm_Access_Info *ac;
|
|
||||||
|
|
||||||
|
po = (Evas_Object *)edje_object_part_object_get(eobj, part);
|
||||||
if (!obj || !po) return NULL;
|
if (!obj || !po) return NULL;
|
||||||
|
|
||||||
// check previous access object
|
/* check previous access object */
|
||||||
ao = evas_object_data_get(po, "_part_access_obj");
|
ao = evas_object_data_get(po, "_part_access_obj");
|
||||||
if (ao)
|
if (ao)
|
||||||
_elm_access_edje_object_part_object_unregister(obj, eobj, part);
|
_elm_access_edje_object_part_object_unregister(obj, eobj, part);
|
||||||
|
|
||||||
// create access object
|
ao = _access_object_register(po, obj);
|
||||||
ao = _elm_access_add(obj);
|
|
||||||
if (!ao) return NULL;
|
|
||||||
|
|
||||||
evas_object_event_callback_add(po, EVAS_CALLBACK_RESIZE,
|
|
||||||
_content_resize, ao);
|
|
||||||
evas_object_event_callback_add(po, EVAS_CALLBACK_MOVE,
|
|
||||||
_content_move, ao);
|
|
||||||
|
|
||||||
evas_object_geometry_get(po, &x, &y, &w, &h);
|
|
||||||
evas_object_move(ao, x, y);
|
|
||||||
evas_object_resize(ao, w, h);
|
|
||||||
evas_object_show(ao);
|
|
||||||
|
|
||||||
// register access object
|
|
||||||
_elm_access_object_register(ao, po);
|
|
||||||
_elm_access_text_set(_elm_access_object_get(ao),
|
|
||||||
ELM_ACCESS_TYPE, evas_object_type_get(po));
|
|
||||||
evas_object_data_set(ao, "_elm_access_part", strdup(part));
|
|
||||||
evas_object_event_callback_add(ao, EVAS_CALLBACK_DEL,
|
|
||||||
_access_obj_del, NULL);
|
|
||||||
_elm_access_callback_set(_elm_access_object_get(ao),
|
|
||||||
ELM_ACCESS_INFO,
|
|
||||||
_part_access_info_cb, eobj);
|
|
||||||
|
|
||||||
// set access object
|
|
||||||
evas_object_data_set(po, "_part_access_obj", ao);
|
|
||||||
|
|
||||||
/* set owner part object */
|
|
||||||
ac = evas_object_data_get(ao, "_elm_access");
|
|
||||||
ac->part_object = po;
|
|
||||||
|
|
||||||
return ao;
|
return ao;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//FIXME: unused obj should be removed from here and each widget.
|
||||||
EAPI void
|
EAPI void
|
||||||
_elm_access_edje_object_part_object_unregister(Evas_Object* obj,
|
_elm_access_edje_object_part_object_unregister(Evas_Object* obj __UNUSED__,
|
||||||
const Evas_Object *eobj,
|
const Evas_Object *eobj,
|
||||||
const char* part)
|
const char* part)
|
||||||
{
|
{
|
||||||
Evas_Object *ao;
|
Evas_Object *po;
|
||||||
Evas_Object *po = (Evas_Object *)edje_object_part_object_get(eobj, part);
|
|
||||||
|
|
||||||
if (!obj || !po) return;
|
po = (Evas_Object *)edje_object_part_object_get(eobj, part);
|
||||||
|
if (!po) return;
|
||||||
|
|
||||||
ao = evas_object_data_get(po, "_part_access_obj");
|
_access_object_unregister(po);
|
||||||
if (!ao) return;
|
|
||||||
|
|
||||||
evas_object_data_del(po, "_part_access_obj");
|
|
||||||
|
|
||||||
// delete callbacks
|
|
||||||
evas_object_event_callback_del_full(po, EVAS_CALLBACK_RESIZE,
|
|
||||||
_content_resize, ao);
|
|
||||||
evas_object_event_callback_del_full(po, EVAS_CALLBACK_MOVE,
|
|
||||||
_content_move, ao);
|
|
||||||
|
|
||||||
evas_object_event_callback_del_full(po, EVAS_CALLBACK_MOUSE_IN,
|
|
||||||
_access_obj_mouse_in_cb, ao);
|
|
||||||
evas_object_event_callback_del_full(po, EVAS_CALLBACK_MOUSE_OUT,
|
|
||||||
_access_obj_mouse_out_cb, ao);
|
|
||||||
evas_object_event_callback_del_full(po, EVAS_CALLBACK_DEL,
|
|
||||||
_access_obj_del_cb, ao);
|
|
||||||
evas_object_del(ao);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
@ -686,7 +673,7 @@ _elm_access_widget_item_register(Elm_Widget_Item *item)
|
||||||
Evas_Coord x, y, w, h;
|
Evas_Coord x, y, w, h;
|
||||||
Elm_Access_Info *ac;
|
Elm_Access_Info *ac;
|
||||||
|
|
||||||
if (!item) return;
|
ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
|
||||||
|
|
||||||
/* check previous access object */
|
/* check previous access object */
|
||||||
if (item->access_obj)
|
if (item->access_obj)
|
||||||
|
@ -722,7 +709,9 @@ _elm_access_widget_item_unregister(Elm_Widget_Item *item)
|
||||||
{
|
{
|
||||||
Evas_Object *ho;
|
Evas_Object *ho;
|
||||||
|
|
||||||
if (!item || !item->access_obj) return;
|
ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
|
||||||
|
|
||||||
|
if (!item->access_obj) return;
|
||||||
|
|
||||||
ho = item->view;
|
ho = item->view;
|
||||||
evas_object_event_callback_del_full(ho, EVAS_CALLBACK_RESIZE,
|
evas_object_event_callback_del_full(ho, EVAS_CALLBACK_RESIZE,
|
||||||
|
@ -805,6 +794,51 @@ static const Eo_Class_Description class_desc = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
EAPI Evas_Object *
|
||||||
|
elm_access_object_item_register(Elm_Object_Item *item)
|
||||||
|
{
|
||||||
|
Elm_Widget_Item *it;
|
||||||
|
|
||||||
|
it = (Elm_Widget_Item *)item;
|
||||||
|
|
||||||
|
_elm_access_widget_item_register(it);
|
||||||
|
|
||||||
|
if (it) return it->access_obj;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
elm_access_object_item_unregister(Elm_Object_Item *item)
|
||||||
|
{
|
||||||
|
_elm_access_widget_item_unregister((Elm_Widget_Item *)item);
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Evas_Object *
|
||||||
|
elm_access_object_item_access_get(Elm_Object_Item *item)
|
||||||
|
{
|
||||||
|
if (!item) return NULL;
|
||||||
|
|
||||||
|
return ((Elm_Widget_Item *)item)->access_obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Evas_Object *
|
||||||
|
elm_access_object_register(Evas_Object *obj, Evas_Object *parent)
|
||||||
|
{
|
||||||
|
return _access_object_register(obj, parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
elm_access_object_unregister(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
_access_object_unregister(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Evas_Object *
|
||||||
|
elm_access_object_access_get(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
return evas_object_data_get(obj, "_part_access_obj");
|
||||||
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
elm_access_text_set(Evas_Object *obj, int type, const char *text)
|
elm_access_text_set(Evas_Object *obj, int type, const char *text)
|
||||||
{
|
{
|
||||||
|
@ -817,49 +851,6 @@ elm_access_text_get(Evas_Object *obj, int type)
|
||||||
return _elm_access_text_get(_elm_access_object_get(obj), type, obj);
|
return _elm_access_text_get(_elm_access_object_get(obj), type, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
|
||||||
elm_access_object_register(Evas_Object *parent, Evas_Object *target)
|
|
||||||
{
|
|
||||||
Elm_Access_Info *ai;
|
|
||||||
|
|
||||||
if (!parent || !target) return;
|
|
||||||
|
|
||||||
evas_object_event_callback_add(target, EVAS_CALLBACK_MOUSE_IN,
|
|
||||||
_access_obj_mouse_in_cb, target);
|
|
||||||
evas_object_event_callback_add(target, EVAS_CALLBACK_MOUSE_OUT,
|
|
||||||
_access_obj_mouse_out_cb, target);
|
|
||||||
evas_object_event_callback_add(target, EVAS_CALLBACK_DEL,
|
|
||||||
_access_obj_del_cb, target);
|
|
||||||
ai = calloc(1, sizeof(Elm_Access_Info));
|
|
||||||
evas_object_data_set(target, "_elm_access", ai);
|
|
||||||
|
|
||||||
//TODO: evas_object_data_del(); parent should take care of children.
|
|
||||||
evas_object_data_set(target, "_elm_access_parent", parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
elm_access_object_unregister(Evas_Object *obj)
|
|
||||||
{
|
|
||||||
Elm_Access_Info *ac;
|
|
||||||
|
|
||||||
evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOUSE_IN,
|
|
||||||
_access_obj_mouse_in_cb, obj);
|
|
||||||
evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOUSE_OUT,
|
|
||||||
_access_obj_mouse_out_cb, obj);
|
|
||||||
evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
|
|
||||||
_access_obj_del_cb, obj);
|
|
||||||
|
|
||||||
ac = evas_object_data_get(obj, "_elm_access");
|
|
||||||
evas_object_data_del(obj, "_elm_access");
|
|
||||||
if (ac)
|
|
||||||
{
|
|
||||||
_elm_access_clear(ac);
|
|
||||||
free(ac);
|
|
||||||
}
|
|
||||||
|
|
||||||
evas_object_data_del(obj, "_elm_access_parent");
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
elm_access_content_cb_set(Evas_Object *obj, int type,
|
elm_access_content_cb_set(Evas_Object *obj, int type,
|
||||||
Elm_Access_Content_Cb func, const void *data)
|
Elm_Access_Content_Cb func, const void *data)
|
||||||
|
|
|
@ -22,25 +22,68 @@ typedef char *(*Elm_Access_Content_Cb)(void *data, Evas_Object *obj);
|
||||||
typedef void (*Elm_Access_Activate_Cb)(void *data, Evas_Object *part_obj, Elm_Object_Item *item);
|
typedef void (*Elm_Access_Activate_Cb)(void *data, Evas_Object *part_obj, Elm_Object_Item *item);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Register evas object as an accessible object.
|
* @brief Register object item as an accessible object.
|
||||||
* @since 1.8
|
* @since 1.8
|
||||||
*
|
*
|
||||||
* @param parent Accessibility parent object. this should be one of widget.
|
* @param item The elementary object item
|
||||||
* @param target Evas object to register as an accessible object.
|
|
||||||
*
|
*
|
||||||
* @ingroup Access
|
* @ingroup Access
|
||||||
*/
|
*/
|
||||||
EAPI void elm_access_object_register(Evas_Object *parent, Evas_Object *target);
|
EAPI Evas_Object * elm_access_object_item_register(Elm_Object_Item *item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Unregister accessible object of the object item.
|
||||||
|
* @since 1.8
|
||||||
|
*
|
||||||
|
* @param item The elementary object item
|
||||||
|
*
|
||||||
|
* @ingroup Access
|
||||||
|
*/
|
||||||
|
EAPI void elm_access_object_item_unregister(Elm_Object_Item *item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get an accessible object of the object item.
|
||||||
|
* @since 1.8
|
||||||
|
*
|
||||||
|
* @param item The elementary object item
|
||||||
|
* @return Accessible object of the object item or NULL for any error
|
||||||
|
*
|
||||||
|
* @ingroup Access
|
||||||
|
*/
|
||||||
|
EAPI Evas_Object * elm_access_object_item_access_get(Elm_Object_Item *item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Register evas object as an accessible object.
|
||||||
|
* @since 1.8
|
||||||
|
*
|
||||||
|
* @param obj The evas object to register as an accessible object.
|
||||||
|
* @param parent The elementary object which is used for creating
|
||||||
|
* accessible object.
|
||||||
|
*
|
||||||
|
* @ingroup Access
|
||||||
|
*/
|
||||||
|
EAPI Evas_Object * elm_access_object_register(Evas_Object *obj, Evas_Object *parent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Unregister accessible object.
|
* @brief Unregister accessible object.
|
||||||
* @since 1.8
|
* @since 1.8
|
||||||
*
|
*
|
||||||
* @param obj Accessible object.
|
* @param obj The Evas object to unregister accessible object.
|
||||||
*
|
*
|
||||||
* @ingroup Access
|
* @ingroup Access
|
||||||
*/
|
*/
|
||||||
EAPI void elm_access_object_unregister(Evas_Object *target);
|
EAPI void elm_access_object_unregister(Evas_Object *obj);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get an accessible object of the evas object.
|
||||||
|
* @since 1.8
|
||||||
|
*
|
||||||
|
* @param obj The evas object.
|
||||||
|
* @return Accessible object of the evas object or NULL for any error
|
||||||
|
*
|
||||||
|
* @ingroup Access
|
||||||
|
*/
|
||||||
|
EAPI Evas_Object * elm_access_object_access_get(Evas_Object *obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set text to give information for specific type.
|
* @brief Set text to give information for specific type.
|
||||||
|
|
|
@ -735,6 +735,9 @@ _item_realize(Elm_Gen_Item *it)
|
||||||
evas_object_size_hint_min_set(it->spacer, 2 * elm_config_scale_get(), 1);
|
evas_object_size_hint_min_set(it->spacer, 2 * elm_config_scale_get(), 1);
|
||||||
edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer);
|
edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer);
|
||||||
|
|
||||||
|
/* access */
|
||||||
|
if (_elm_config->access_mode) _access_widget_item_register(it);
|
||||||
|
|
||||||
if (it->itc->func.text_get)
|
if (it->itc->func.text_get)
|
||||||
{
|
{
|
||||||
const Eina_List *l;
|
const Eina_List *l;
|
||||||
|
@ -852,10 +855,6 @@ _item_realize(Elm_Gen_Item *it)
|
||||||
|
|
||||||
it->realized = EINA_TRUE;
|
it->realized = EINA_TRUE;
|
||||||
it->want_unrealize = EINA_FALSE;
|
it->want_unrealize = EINA_FALSE;
|
||||||
|
|
||||||
// ACCESS
|
|
||||||
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
|
||||||
_access_widget_item_register(it);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
|
|
|
@ -1380,9 +1380,8 @@ _item_realize(Elm_Gen_Item *it,
|
||||||
(VIEW(it), elm_widget_mirrored_get(WIDGET(it)));
|
(VIEW(it), elm_widget_mirrored_get(WIDGET(it)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ACCESS
|
/* access */
|
||||||
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
if (_elm_config->access_mode) _access_widget_item_register(it);
|
||||||
_access_widget_item_register(it);
|
|
||||||
|
|
||||||
_item_order_update(EINA_INLIST_GET(it), in);
|
_item_order_update(EINA_INLIST_GET(it), in);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue