summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinwoo Kim <kimcinoo.efl@gmail.com>2013-01-10 12:00:05 +0000
committerShinwoo Kim <kimcinoo.efl@gmail.com>2013-01-10 12:00:05 +0000
commitb70730ca6dcf2b77e6dcccd2fc0d1b746e0ad704 (patch)
treed076f5e4f7e0de77ac49fd869a8c43123b1d58b4
parent006e9a879ea23dc54c472dd027ac5f6ab6c01c20 (diff)
[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
-rw-r--r--src/lib/elm_access.c217
-rw-r--r--src/lib/elm_access.h53
-rw-r--r--src/lib/elm_gengrid.c7
-rw-r--r--src/lib/elm_genlist.c5
4 files changed, 157 insertions, 125 deletions
diff --git a/src/lib/elm_access.c b/src/lib/elm_access.c
index 73e8dae7c..d4d52ef38 100644
--- a/src/lib/elm_access.c
+++ b/src/lib/elm_access.c
@@ -419,7 +419,7 @@ _elm_access_object_get(const Evas_Object *obj)
419EAPI void 419EAPI void
420_elm_access_object_hilight(Evas_Object *obj) 420_elm_access_object_hilight(Evas_Object *obj)
421{ 421{
422 Evas_Object *o, *parent_obj; 422 Evas_Object *o;
423 Evas_Coord x, y, w, h; 423 Evas_Coord x, y, w, h;
424 424
425 o = evas_object_name_find(evas_object_evas_get(obj), "_elm_access_disp"); 425 o = evas_object_name_find(evas_object_evas_get(obj), "_elm_access_disp");
@@ -447,11 +447,7 @@ _elm_access_object_hilight(Evas_Object *obj)
447 } 447 }
448 evas_object_data_set(o, "_elm_access_target", obj); 448 evas_object_data_set(o, "_elm_access_target", obj);
449 449
450 parent_obj = obj; 450 elm_widget_theme_object_set(obj, o, "access", "base", "default");
451 if (!elm_widget_is(obj))
452 parent_obj = evas_object_data_get(obj, "_elm_access_parent");
453
454 elm_widget_theme_object_set(parent_obj, o, "access", "base", "default");
455 451
456 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, 452 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
457 _access_obj_hilight_del_cb, NULL); 453 _access_obj_hilight_del_cb, NULL);
@@ -518,109 +514,100 @@ _content_move(void *data, Evas *e __UNUSED__, Evas_Object *obj,
518 evas_object_move(accessobj, x, y); 514 evas_object_move(accessobj, x, y);
519} 515}
520 516
521static char * 517static Evas_Object *
522_part_access_info_cb(void *data, Evas_Object *obj) 518_access_object_register(Evas_Object *obj, Evas_Object *parent)
523{
524 Evas_Object *eobj = data;
525 if (!eobj) return NULL;
526
527 const char *part = evas_object_data_get(obj, "_elm_access_part");
528 const char *txt = edje_object_part_text_get(eobj, part);
529 if (txt) return strdup(txt);
530 return NULL;
531}
532
533static void
534_access_obj_del(void *data __UNUSED__, Evas *e __UNUSED__,
535 Evas_Object *obj, void *event_info __UNUSED__)
536{
537 char *part = evas_object_data_get(obj, "_elm_access_part");
538 evas_object_data_del(obj, "_elm_access_part");
539 if (part) free(part);
540}
541
542EAPI Evas_Object *
543_elm_access_edje_object_part_object_register(Evas_Object* obj,
544 const Evas_Object *eobj,
545 const char* part)
546{ 519{
547 Evas_Object *ao; 520 Evas_Object *ao;
548 Evas_Object *po = (Evas_Object *)edje_object_part_object_get(eobj, part);
549 Evas_Coord x, y, w, h;
550 Elm_Access_Info *ac; 521 Elm_Access_Info *ac;
522 Evas_Coord x, y, w, h;
551 523
552 if (!obj || !po) return NULL; 524 if (!obj) return NULL;
553 525
554 // check previous access object 526 /* create access object */
555 ao = evas_object_data_get(po, "_part_access_obj"); 527 ao = _elm_access_add(parent);
556 if (ao)
557 _elm_access_edje_object_part_object_unregister(obj, eobj, part);
558
559 // create access object
560 ao = _elm_access_add(obj);
561 if (!ao) return NULL; 528 if (!ao) return NULL;
562 529
563 evas_object_event_callback_add(po, EVAS_CALLBACK_RESIZE, 530 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
564 _content_resize, ao); 531 _content_resize, ao);
565 evas_object_event_callback_add(po, EVAS_CALLBACK_MOVE, 532 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
566 _content_move, ao); 533 _content_move, ao);
567 534
568 evas_object_geometry_get(po, &x, &y, &w, &h); 535 evas_object_geometry_get(obj, &x, &y, &w, &h);
569 evas_object_move(ao, x, y); 536 evas_object_move(ao, x, y);
570 evas_object_resize(ao, w, h); 537 evas_object_resize(ao, w, h);
571 evas_object_show(ao); 538 evas_object_show(ao);
572 539
573 // register access object 540 /* register access object */
574 _elm_access_object_register(ao, po); 541 _elm_access_object_register(ao, obj);
575 _elm_access_text_set(_elm_access_object_get(ao), 542
576 ELM_ACCESS_TYPE, evas_object_type_get(po)); 543 /* set access object */
577 evas_object_data_set(ao, "_elm_access_part", strdup(part)); 544 evas_object_data_set(obj, "_part_access_obj", ao);
578 evas_object_event_callback_add(ao, EVAS_CALLBACK_DEL,
579 _access_obj_del, NULL);
580 _elm_access_callback_set(_elm_access_object_get(ao),
581 ELM_ACCESS_INFO,
582 _part_access_info_cb, eobj);
583
584 // set access object
585 evas_object_data_set(po, "_part_access_obj", ao);
586 545
587 /* set owner part object */ 546 /* set owner part object */
588 ac = evas_object_data_get(ao, "_elm_access"); 547 ac = evas_object_data_get(ao, "_elm_access");
589 ac->part_object = po; 548 ac->part_object = obj;
590 549
591 return ao; 550 return ao;
592} 551}
593 552
594EAPI void 553static void
595_elm_access_edje_object_part_object_unregister(Evas_Object* obj, 554_access_object_unregister(Evas_Object *obj)
596 const Evas_Object *eobj,
597 const char* part)
598{ 555{
599 Evas_Object *ao; 556 Evas_Object *ao;
600 Evas_Object *po = (Evas_Object *)edje_object_part_object_get(eobj, part);
601 557
602 if (!obj || !po) return; 558 if (!obj) return;
603 559
604 ao = evas_object_data_get(po, "_part_access_obj"); 560 ao = evas_object_data_get(obj, "_part_access_obj");
605 if (!ao) return; 561 if (!ao) return;
606 562
607 evas_object_data_del(po, "_part_access_obj"); 563 evas_object_data_del(obj, "_part_access_obj");
608 564
609 // delete callbacks 565 /* delete callbacks */
610 evas_object_event_callback_del_full(po, EVAS_CALLBACK_RESIZE, 566 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
611 _content_resize, ao); 567 _content_resize, ao);
612 evas_object_event_callback_del_full(po, EVAS_CALLBACK_MOVE, 568 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
613 _content_move, ao); 569 _content_move, ao);
614 570
615 evas_object_event_callback_del_full(po, EVAS_CALLBACK_MOUSE_IN, 571 /* unregister access object */
616 _access_obj_mouse_in_cb, ao); 572 _elm_access_object_unregister(ao, obj);
617 evas_object_event_callback_del_full(po, EVAS_CALLBACK_MOUSE_OUT, 573
618 _access_obj_mouse_out_cb, ao);
619 evas_object_event_callback_del_full(po, EVAS_CALLBACK_DEL,
620 _access_obj_del_cb, ao);
621 evas_object_del(ao); 574 evas_object_del(ao);
622} 575}
623 576
577EAPI Evas_Object *
578_elm_access_edje_object_part_object_register(Evas_Object* obj,
579 const Evas_Object *eobj,
580 const char* part)
581{
582 Evas_Object *ao, *po;
583
584 po = (Evas_Object *)edje_object_part_object_get(eobj, part);
585 if (!obj || !po) return NULL;
586
587 /* check previous access object */
588 ao = evas_object_data_get(po, "_part_access_obj");
589 if (ao)
590 _elm_access_edje_object_part_object_unregister(obj, eobj, part);
591
592 ao = _access_object_register(po, obj);
593
594 return ao;
595}
596
597//FIXME: unused obj should be removed from here and each widget.
598EAPI void
599_elm_access_edje_object_part_object_unregister(Evas_Object* obj __UNUSED__,
600 const Evas_Object *eobj,
601 const char* part)
602{
603 Evas_Object *po;
604
605 po = (Evas_Object *)edje_object_part_object_get(eobj, part);
606 if (!po) return;
607
608 _access_object_unregister(po);
609}
610
624EAPI void 611EAPI void
625_elm_access_object_hilight_disable(Evas *e) 612_elm_access_object_hilight_disable(Evas *e)
626{ 613{
@@ -686,7 +673,7 @@ _elm_access_widget_item_register(Elm_Widget_Item *item)
686 Evas_Coord x, y, w, h; 673 Evas_Coord x, y, w, h;
687 Elm_Access_Info *ac; 674 Elm_Access_Info *ac;
688 675
689 if (!item) return; 676 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
690 677
691 /* check previous access object */ 678 /* check previous access object */
692 if (item->access_obj) 679 if (item->access_obj)
@@ -722,7 +709,9 @@ _elm_access_widget_item_unregister(Elm_Widget_Item *item)
722{ 709{
723 Evas_Object *ho; 710 Evas_Object *ho;
724 711
725 if (!item || !item->access_obj) return; 712 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
713
714 if (!item->access_obj) return;
726 715
727 ho = item->view; 716 ho = item->view;
728 evas_object_event_callback_del_full(ho, EVAS_CALLBACK_RESIZE, 717 evas_object_event_callback_del_full(ho, EVAS_CALLBACK_RESIZE,
@@ -805,59 +794,61 @@ static const Eo_Class_Description class_desc = {
805 NULL 794 NULL
806}; 795};
807 796
808EAPI void 797EAPI Evas_Object *
809elm_access_text_set(Evas_Object *obj, int type, const char *text) 798elm_access_object_item_register(Elm_Object_Item *item)
810{ 799{
811 _elm_access_text_set(_elm_access_object_get(obj), type, text); 800 Elm_Widget_Item *it;
812}
813 801
814EAPI char * 802 it = (Elm_Widget_Item *)item;
815elm_access_text_get(Evas_Object *obj, int type) 803
816{ 804 _elm_access_widget_item_register(it);
817 return _elm_access_text_get(_elm_access_object_get(obj), type, obj); 805
806 if (it) return it->access_obj;
807 return NULL;
818} 808}
819 809
820EAPI void 810EAPI void
821elm_access_object_register(Evas_Object *parent, Evas_Object *target) 811elm_access_object_item_unregister(Elm_Object_Item *item)
822{ 812{
823 Elm_Access_Info *ai; 813 _elm_access_widget_item_unregister((Elm_Widget_Item *)item);
814}
824 815
825 if (!parent || !target) return; 816EAPI Evas_Object *
817elm_access_object_item_access_get(Elm_Object_Item *item)
818{
819 if (!item) return NULL;
826 820
827 evas_object_event_callback_add(target, EVAS_CALLBACK_MOUSE_IN, 821 return ((Elm_Widget_Item *)item)->access_obj;
828 _access_obj_mouse_in_cb, target); 822}
829 evas_object_event_callback_add(target, EVAS_CALLBACK_MOUSE_OUT,
830 _access_obj_mouse_out_cb, target);
831 evas_object_event_callback_add(target, EVAS_CALLBACK_DEL,
832 _access_obj_del_cb, target);
833 ai = calloc(1, sizeof(Elm_Access_Info));
834 evas_object_data_set(target, "_elm_access", ai);
835 823
836 //TODO: evas_object_data_del(); parent should take care of children. 824EAPI Evas_Object *
837 evas_object_data_set(target, "_elm_access_parent", parent); 825elm_access_object_register(Evas_Object *obj, Evas_Object *parent)
826{
827 return _access_object_register(obj, parent);
838} 828}
839 829
840EAPI void 830EAPI void
841elm_access_object_unregister(Evas_Object *obj) 831elm_access_object_unregister(Evas_Object *obj)
842{ 832{
843 Elm_Access_Info *ac; 833 _access_object_unregister(obj);
834}
844 835
845 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOUSE_IN, 836EAPI Evas_Object *
846 _access_obj_mouse_in_cb, obj); 837elm_access_object_access_get(Evas_Object *obj)
847 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOUSE_OUT, 838{
848 _access_obj_mouse_out_cb, obj); 839 return evas_object_data_get(obj, "_part_access_obj");
849 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL, 840}
850 _access_obj_del_cb, obj);
851 841
852 ac = evas_object_data_get(obj, "_elm_access"); 842EAPI void
853 evas_object_data_del(obj, "_elm_access"); 843elm_access_text_set(Evas_Object *obj, int type, const char *text)
854 if (ac) 844{
855 { 845 _elm_access_text_set(_elm_access_object_get(obj), type, text);
856 _elm_access_clear(ac); 846}
857 free(ac);
858 }
859 847
860 evas_object_data_del(obj, "_elm_access_parent"); 848EAPI char *
849elm_access_text_get(Evas_Object *obj, int type)
850{
851 return _elm_access_text_get(_elm_access_object_get(obj), type, obj);
861} 852}
862 853
863EAPI void 854EAPI void
diff --git a/src/lib/elm_access.h b/src/lib/elm_access.h
index cef6162f3..000908729 100644
--- a/src/lib/elm_access.h
+++ b/src/lib/elm_access.h
@@ -22,25 +22,68 @@ typedef char *(*Elm_Access_Content_Cb)(void *data, Evas_Object *obj);
22typedef void (*Elm_Access_Activate_Cb)(void *data, Evas_Object *part_obj, Elm_Object_Item *item); 22typedef void (*Elm_Access_Activate_Cb)(void *data, Evas_Object *part_obj, Elm_Object_Item *item);
23 23
24/** 24/**
25 * @brief Register object item as an accessible object.
26 * @since 1.8
27 *
28 * @param item The elementary object item
29 *
30 * @ingroup Access
31 */
32EAPI Evas_Object * elm_access_object_item_register(Elm_Object_Item *item);
33
34/**
35 * @brief Unregister accessible object of the object item.
36 * @since 1.8
37 *
38 * @param item The elementary object item
39 *
40 * @ingroup Access
41 */
42EAPI void elm_access_object_item_unregister(Elm_Object_Item *item);
43
44/**
45 * @brief Get an accessible object of the object item.
46 * @since 1.8
47 *
48 * @param item The elementary object item
49 * @return Accessible object of the object item or NULL for any error
50 *
51 * @ingroup Access
52 */
53EAPI Evas_Object * elm_access_object_item_access_get(Elm_Object_Item *item);
54
55/**
25 * @brief Register evas object as an accessible object. 56 * @brief Register evas object as an accessible object.
26 * @since 1.8 57 * @since 1.8
27 * 58 *
28 * @param parent Accessibility parent object. this should be one of widget. 59 * @param obj The evas object to register as an accessible object.
29 * @param target Evas object to register as an accessible object. 60 * @param parent The elementary object which is used for creating
61 * accessible object.
30 * 62 *
31 * @ingroup Access 63 * @ingroup Access
32 */ 64 */
33EAPI void elm_access_object_register(Evas_Object *parent, Evas_Object *target); 65EAPI Evas_Object * elm_access_object_register(Evas_Object *obj, Evas_Object *parent);
34 66
35/** 67/**
36 * @brief Unregister accessible object. 68 * @brief Unregister accessible object.
37 * @since 1.8 69 * @since 1.8
38 * 70 *
39 * @param obj Accessible object. 71 * @param obj The Evas object to unregister accessible object.
72 *
73 * @ingroup Access
74 */
75EAPI void elm_access_object_unregister(Evas_Object *obj);
76
77/**
78 * @brief Get an accessible object of the evas object.
79 * @since 1.8
80 *
81 * @param obj The evas object.
82 * @return Accessible object of the evas object or NULL for any error
40 * 83 *
41 * @ingroup Access 84 * @ingroup Access
42 */ 85 */
43EAPI void elm_access_object_unregister(Evas_Object *target); 86EAPI Evas_Object * elm_access_object_access_get(Evas_Object *obj);
44 87
45/** 88/**
46 * @brief Set text to give information for specific type. 89 * @brief Set text to give information for specific type.
diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c
index e2439262e..8d1457cb2 100644
--- a/src/lib/elm_gengrid.c
+++ b/src/lib/elm_gengrid.c
@@ -735,6 +735,9 @@ _item_realize(Elm_Gen_Item *it)
735 evas_object_size_hint_min_set(it->spacer, 2 * elm_config_scale_get(), 1); 735 evas_object_size_hint_min_set(it->spacer, 2 * elm_config_scale_get(), 1);
736 edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer); 736 edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer);
737 737
738 /* access */
739 if (_elm_config->access_mode) _access_widget_item_register(it);
740
738 if (it->itc->func.text_get) 741 if (it->itc->func.text_get)
739 { 742 {
740 const Eina_List *l; 743 const Eina_List *l;
@@ -852,10 +855,6 @@ _item_realize(Elm_Gen_Item *it)
852 855
853 it->realized = EINA_TRUE; 856 it->realized = EINA_TRUE;
854 it->want_unrealize = EINA_FALSE; 857 it->want_unrealize = EINA_FALSE;
855
856 // ACCESS
857 if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
858 _access_widget_item_register(it);
859} 858}
860 859
861static Eina_Bool 860static Eina_Bool
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index 86fba90b1..176da806b 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -1380,9 +1380,8 @@ _item_realize(Elm_Gen_Item *it,
1380 (VIEW(it), elm_widget_mirrored_get(WIDGET(it))); 1380 (VIEW(it), elm_widget_mirrored_get(WIDGET(it)));
1381 } 1381 }
1382 1382
1383 // ACCESS 1383 /* access */
1384 if (_elm_config->access_mode == ELM_ACCESS_MODE_ON) 1384 if (_elm_config->access_mode) _access_widget_item_register(it);
1385 _access_widget_item_register(it);
1386 1385
1387 _item_order_update(EINA_INLIST_GET(it), in); 1386 _item_order_update(EINA_INLIST_GET(it), in);
1388 1387