summaryrefslogtreecommitdiff
path: root/legacy/elementary/src/lib/elm_access.c
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2012-11-26 06:32:53 +0000
committerDaniel Zaoui <daniel.zaoui@yahoo.com>2012-11-26 06:32:53 +0000
commit5c9834319878a3717b1d422a83e4930190eeab07 (patch)
tree3eb8b9e2d641e5385d1996ba68ea321f3563f612 /legacy/elementary/src/lib/elm_access.c
parent1388bbb3f34e9277c0174ad0ad21a34b3d1e9d0c (diff)
We have ported to Eo all the widgets of elementary. We didn't change the inheritance itself, only the mechanism, as done previously in Evas, Ecore and Edje. We removed totally the previous inheritance mechanism.
Signed-off-by: Yakov Goldberg <yakov.g@samsung.com> Signed-off-by: Daniel Zaoui <daniel.zaoui@samsung.com> SVN revision: 79668
Diffstat (limited to 'legacy/elementary/src/lib/elm_access.c')
-rw-r--r--legacy/elementary/src/lib/elm_access.c95
1 files changed, 62 insertions, 33 deletions
diff --git a/legacy/elementary/src/lib/elm_access.c b/legacy/elementary/src/lib/elm_access.c
index c6c8a91..0c418aa 100644
--- a/legacy/elementary/src/lib/elm_access.c
+++ b/legacy/elementary/src/lib/elm_access.c
@@ -1,57 +1,51 @@
1#include <Elementary.h> 1#include <Elementary.h>
2#include "elm_priv.h" 2#include "elm_priv.h"
3 3
4static const char ACCESS_SMART_NAME[] = "elm_access"; 4#include "Eo.h"
5 5
6ELM_INTERNAL_SMART_SUBCLASS_NEW 6const Eo_Class *elm_obj_access_class_get(void) EINA_CONST;
7 (ACCESS_SMART_NAME, _elm_access, Elm_Widget_Smart_Class, 7
8 Elm_Widget_Smart_Class, elm_widget_smart_class_get, NULL); 8#define ELM_OBJ_ACCESS_CLASS elm_obj_access_class_get()
9
10#define MY_CLASS ELM_OBJ_ACCESS_CLASS
11
12#define MY_CLASS_NAME "elm_access"
9 13
10static Evas_Object * _elm_access_add(Evas_Object *parent); 14static Evas_Object * _elm_access_add(Evas_Object *parent);
11 15
12static void 16static void
13_elm_access_smart_add(Evas_Object *obj) 17_elm_access_smart_add(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
14{ 18{
15 EVAS_SMART_DATA_ALLOC(obj, Elm_Widget_Smart_Data); 19 eo_do_super(obj, evas_obj_smart_add());
16 ELM_WIDGET_CLASS(_elm_access_parent_sc)->base.add(obj);
17 20
18 elm_widget_can_focus_set(obj, EINA_TRUE); 21 elm_widget_can_focus_set(obj, EINA_TRUE);
19} 22}
20 23
21static Eina_Bool 24static void
22_elm_access_smart_on_focus(Evas_Object *obj) 25_elm_access_smart_activate(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
23{ 26{
24 evas_object_focus_set(obj, elm_widget_focus_get(obj)); 27 Elm_Activate act = va_arg(*list, Elm_Activate);
28 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
29 if (ret) *ret = EINA_FALSE;
25 30
26 return EINA_TRUE; 31 if (act != ELM_ACTIVATE_DEFAULT) return;
27}
28
29static Eina_Bool
30_elm_access_smart_activate(Evas_Object *obj, Elm_Activate act)
31{
32 if (act != ELM_ACTIVATE_DEFAULT) return EINA_FALSE;
33 32
34 Elm_Access_Info *ac = evas_object_data_get(obj, "_elm_access"); 33 Elm_Access_Info *ac = evas_object_data_get(obj, "_elm_access");
35 if (!ac) return EINA_FALSE; 34 if (!ac) return;
36 35
37 if (ac->activate) 36 if (ac->activate)
38 ac->activate(ac->activate_data, ac->part_object, ac->widget_item); 37 ac->activate(ac->activate_data, ac->part_object, ac->widget_item);
39 38
40 return EINA_TRUE; 39 if (ret) *ret = EINA_TRUE;
41} 40}
42 41
43static void 42static void
44_elm_access_smart_set_user(Elm_Widget_Smart_Class *sc) 43_elm_access_smart_on_focus(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
45{ 44{
46 sc->base.add = _elm_access_smart_add; 45 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
47 46 evas_object_focus_set(obj, elm_widget_focus_get(obj));
48 /* not a 'focus chain manager' */
49 sc->focus_next = NULL;
50 sc->focus_direction = NULL;
51 sc->on_focus = _elm_access_smart_on_focus;
52 sc->activate = _elm_access_smart_activate;
53 47
54 return; 48 if (ret) *ret = EINA_TRUE;
55} 49}
56 50
57typedef struct _Mod_Api Mod_Api; 51typedef struct _Mod_Api Mod_Api;
@@ -820,15 +814,50 @@ _elm_access_2nd_click_timeout(Evas_Object *obj)
820static Evas_Object * 814static Evas_Object *
821_elm_access_add(Evas_Object *parent) 815_elm_access_add(Evas_Object *parent)
822{ 816{
823 Evas_Object *obj;
824
825 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); 817 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
818 Evas_Object *obj = eo_add(MY_CLASS, parent);
819 eo_unref(obj);
820 return obj;
821}
826 822
827 obj = elm_widget_add(_elm_access_smart_class_new(), parent); 823static void
828 if (!obj) return NULL; 824_constructor(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
825{
826 eo_do_super(obj, eo_constructor());
827 eo_do(obj,
828 evas_obj_type_set(MY_CLASS_NAME));
829 829
830 Evas_Object *parent = eo_parent_get(obj);
830 if (!elm_widget_sub_object_add(parent, obj)) 831 if (!elm_widget_sub_object_add(parent, obj))
831 ERR("could not add %p as sub object of %p", obj, parent); 832 ERR("could not add %p as sub object of %p", obj, parent);
833}
832 834
833 return obj; 835static void
836_class_constructor(Eo_Class *klass)
837{
838 const Eo_Op_Func_Description func_desc[] = {
839 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
840
841 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ADD), _elm_access_smart_add),
842
843 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ON_FOCUS), _elm_access_smart_on_focus),
844 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ACTIVATE), _elm_access_smart_activate),
845
846 EO_OP_FUNC_SENTINEL
847 };
848 eo_class_funcs_set(klass, func_desc);
834} 849}
850
851static const Eo_Class_Description class_desc = {
852 EO_VERSION,
853 MY_CLASS_NAME,
854 EO_CLASS_TYPE_REGULAR,
855 EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
856 NULL,
857 0,
858 _class_constructor,
859 NULL
860};
861
862EO_DEFINE_CLASS(elm_obj_access_class_get, &class_desc, ELM_OBJ_WIDGET_CLASS, NULL);
863