summaryrefslogtreecommitdiff
path: root/legacy/elementary/src/lib/elm_access.c
diff options
context:
space:
mode:
authorShinwoo Kim <kimcinoo.efl@gmail.com>2012-12-23 14:50:56 +0000
committerShinwoo Kim <kimcinoo.efl@gmail.com>2012-12-23 14:50:56 +0000
commitf10fb3e115872332a2d54e399ef1a1e108e26379 (patch)
tree757841c914a01bbe2cc26fde332d0dd9c664603e /legacy/elementary/src/lib/elm_access.c
parent56de89a84d264543e8c9bbb55c8d8ec7735de8e5 (diff)
[access] export some APIs,and remove unnecessary lines.
+ elm_access_object_register(); + elm_access_object_unregister(); + elm_access_text_set(); + elm_access_text_get(); + elm_access_cb_set(); These APIs are to use edje part, evas object as an accessible object. and do not create access object, because access object would be created at run time. This is different with internal API _elm_access_object_register(); SVN revision: 81659
Diffstat (limited to 'legacy/elementary/src/lib/elm_access.c')
-rw-r--r--legacy/elementary/src/lib/elm_access.c100
1 files changed, 84 insertions, 16 deletions
diff --git a/legacy/elementary/src/lib/elm_access.c b/legacy/elementary/src/lib/elm_access.c
index 1b23224..d8659ff 100644
--- a/legacy/elementary/src/lib/elm_access.c
+++ b/legacy/elementary/src/lib/elm_access.c
@@ -111,12 +111,12 @@ _access_obj_over_timeout_cb(void *data)
111 { 111 {
112 if (ac->on_highlight) ac->on_highlight(ac->on_highlight_data); 112 if (ac->on_highlight) ac->on_highlight(ac->on_highlight_data);
113 _elm_access_object_hilight(data); 113 _elm_access_object_hilight(data);
114 _elm_access_read(ac, ELM_ACCESS_CANCEL, data, NULL); 114 _elm_access_read(ac, ELM_ACCESS_CANCEL, data);
115 _elm_access_read(ac, ELM_ACCESS_TYPE, data, NULL); 115 _elm_access_read(ac, ELM_ACCESS_TYPE, data);
116 _elm_access_read(ac, ELM_ACCESS_INFO, data, NULL); 116 _elm_access_read(ac, ELM_ACCESS_INFO, data);
117 _elm_access_read(ac, ELM_ACCESS_STATE, data, NULL); 117 _elm_access_read(ac, ELM_ACCESS_STATE, data);
118 _elm_access_read(ac, ELM_ACCESS_EXTERNAL_INFO, data, NULL); 118 _elm_access_read(ac, ELM_ACCESS_CONTEXT_INFO, data);
119 _elm_access_read(ac, ELM_ACCESS_DONE, data, NULL); 119 _elm_access_read(ac, ELM_ACCESS_DONE, data);
120 } 120 }
121 ac->delay_timer = NULL; 121 ac->delay_timer = NULL;
122 return EINA_FALSE; 122 return EINA_FALSE;
@@ -331,7 +331,7 @@ _elm_access_highlight_cycle(Evas_Object *obj, Elm_Focus_Direction dir)
331} 331}
332 332
333EAPI char * 333EAPI char *
334_elm_access_text_get(const Elm_Access_Info *ac, int type, Evas_Object *obj, Elm_Widget_Item *item) 334_elm_access_text_get(const Elm_Access_Info *ac, int type, Evas_Object *obj)
335{ 335{
336 Elm_Access_Item *ai; 336 Elm_Access_Item *ai;
337 Eina_List *l; 337 Eina_List *l;
@@ -341,7 +341,7 @@ _elm_access_text_get(const Elm_Access_Info *ac, int type, Evas_Object *obj, Elm_
341 { 341 {
342 if (ai->type == type) 342 if (ai->type == type)
343 { 343 {
344 if (ai->func) return ai->func((void *)(ai->data), obj, item); 344 if (ai->func) return ai->func((void *)(ai->data), obj);
345 else if (ai->data) return strdup(ai->data); 345 else if (ai->data) return strdup(ai->data);
346 return NULL; 346 return NULL;
347 } 347 }
@@ -350,9 +350,9 @@ _elm_access_text_get(const Elm_Access_Info *ac, int type, Evas_Object *obj, Elm_
350} 350}
351 351
352EAPI void 352EAPI void
353_elm_access_read(Elm_Access_Info *ac, int type, Evas_Object *obj, Elm_Widget_Item *item) 353_elm_access_read(Elm_Access_Info *ac, int type, Evas_Object *obj)
354{ 354{
355 char *txt = _elm_access_text_get(ac, type, obj, item); 355 char *txt = _elm_access_text_get(ac, type, obj);
356 356
357 _access_init(); 357 _access_init();
358 if (mapi) 358 if (mapi)
@@ -406,7 +406,7 @@ _elm_access_object_get(const Evas_Object *obj)
406EAPI void 406EAPI void
407_elm_access_object_hilight(Evas_Object *obj) 407_elm_access_object_hilight(Evas_Object *obj)
408{ 408{
409 Evas_Object *o; 409 Evas_Object *o, *parent_obj;
410 Evas_Coord x, y, w, h; 410 Evas_Coord x, y, w, h;
411 411
412 o = evas_object_name_find(evas_object_evas_get(obj), "_elm_access_disp"); 412 o = evas_object_name_find(evas_object_evas_get(obj), "_elm_access_disp");
@@ -433,7 +433,13 @@ _elm_access_object_hilight(Evas_Object *obj)
433 } 433 }
434 } 434 }
435 evas_object_data_set(o, "_elm_access_target", obj); 435 evas_object_data_set(o, "_elm_access_target", obj);
436 elm_widget_theme_object_set(obj, o, "access", "base", "default"); 436
437 parent_obj = obj;
438 if (!elm_widget_is(obj))
439 parent_obj = evas_object_data_get(obj, "_elm_access_parent");
440
441 elm_widget_theme_object_set(parent_obj, o, "access", "base", "default");
442
437 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, 443 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
438 _access_obj_hilight_del_cb, NULL); 444 _access_obj_hilight_del_cb, NULL);
439 evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, 445 evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE,
@@ -500,8 +506,7 @@ _content_move(void *data, Evas *e __UNUSED__, Evas_Object *obj,
500} 506}
501 507
502static char * 508static char *
503_part_access_info_cb(void *data, Evas_Object *obj, 509_part_access_info_cb(void *data, Evas_Object *obj)
504 Elm_Widget_Item *item __UNUSED__)
505{ 510{
506 Evas_Object *eobj = data; 511 Evas_Object *eobj = data;
507 if (!eobj) return NULL; 512 if (!eobj) return NULL;
@@ -784,10 +789,73 @@ static const Eo_Class_Description class_desc = {
784}; 789};
785 790
786EAPI void 791EAPI void
792elm_access_text_set(Evas_Object *obj, int type, const char *text)
793{
794 _elm_access_text_set(_elm_access_object_get(obj), type, text);
795}
796
797EAPI char *
798elm_access_text_get(Evas_Object *obj, int type)
799{
800 return _elm_access_text_get(_elm_access_object_get(obj), type, obj);
801}
802
803EAPI void
804elm_access_cb_set(Evas_Object *obj, int type,
805 Elm_Access_Content_Cb func, const void *data)
806{
807 _elm_access_callback_set(_elm_access_object_get(obj), type, func, data);
808}
809
810
811EAPI void
812elm_access_object_register(Evas_Object *parent, Evas_Object *target)
813{
814 Elm_Access_Info *ai;
815
816 if (!parent || !target) return;
817
818 evas_object_event_callback_add(target, EVAS_CALLBACK_MOUSE_IN,
819 _access_obj_mouse_in_cb, target);
820 evas_object_event_callback_add(target, EVAS_CALLBACK_MOUSE_OUT,
821 _access_obj_mouse_out_cb, target);
822 evas_object_event_callback_add(target, EVAS_CALLBACK_DEL,
823 _access_obj_del_cb, target);
824 ai = calloc(1, sizeof(Elm_Access_Info));
825 evas_object_data_set(target, "_elm_access", ai);
826
827 //TODO: evas_object_data_del(); parent should take care of children.
828 evas_object_data_set(target, "_elm_access_parent", parent);
829}
830
831EAPI void
832elm_access_object_unregister(Evas_Object *obj)
833{
834 Elm_Access_Info *ac;
835
836 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOUSE_IN,
837 _access_obj_mouse_in_cb, obj);
838 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOUSE_OUT,
839 _access_obj_mouse_out_cb, obj);
840 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
841 _access_obj_del_cb, obj);
842
843 ac = evas_object_data_get(obj, "_elm_access");
844 evas_object_data_del(obj, "_elm_access");
845 if (ac)
846 {
847 _elm_access_clear(ac);
848 free(ac);
849 }
850
851 evas_object_data_del(obj, "_elm_access_parent");
852}
853
854EAPI void
787elm_access_external_info_set(Evas_Object *obj, const char *text) 855elm_access_external_info_set(Evas_Object *obj, const char *text)
788{ 856{
789 _elm_access_text_set 857 _elm_access_text_set
790 (_elm_access_object_get(obj), ELM_ACCESS_EXTERNAL_INFO, text); 858 (_elm_access_object_get(obj), ELM_ACCESS_CONTEXT_INFO, text);
791} 859}
792 860
793EAPI char * 861EAPI char *
@@ -796,7 +864,7 @@ elm_access_external_info_get(const Evas_Object *obj)
796 Elm_Access_Info *ac; 864 Elm_Access_Info *ac;
797 865
798 ac = _elm_access_object_get(obj); 866 ac = _elm_access_object_get(obj);
799 return _elm_access_text_get(ac, ELM_ACCESS_EXTERNAL_INFO, obj, NULL); 867 return _elm_access_text_get(ac, ELM_ACCESS_CONTEXT_INFO, (Evas_Object *)obj);
800} 868}
801 869
802EO_DEFINE_CLASS(elm_obj_access_class_get, &class_desc, ELM_OBJ_WIDGET_CLASS, NULL); 870EO_DEFINE_CLASS(elm_obj_access_class_get, &class_desc, ELM_OBJ_WIDGET_CLASS, NULL);