summaryrefslogtreecommitdiff
path: root/src/tests/eo/suite/eo_test_domain.c
blob: 45a1fe377fb2162e01674bc3df6ca3614f780768 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include "Eina.h"
#include "Eo.h"
#include "eo_test_domain.h"

#define MY_CLASS DOMAIN_CLASS

EAPI const Efl_Event_Description _EV_DOMAIN_A_CHANGED =
        EFL_EVENT_DESCRIPTION("domain,a,changed");

static void
_a_set(Eo *obj EINA_UNUSED, void *class_data, int a)
{
   Domain_Public_Data *pd = class_data;
   printf("Set Begin\n");
   pd->a = a;
   sleep(1);
   printf("Set End\n");
   printf("Call Events\n");
   efl_event_callback_legacy_call(obj, EV_DOMAIN_A_CHANGED, &pd->a);
   printf("Call Events End\n");
}

static int
_a_get(Eo *obj EINA_UNUSED, void *class_data)
{
   Domain_Public_Data *pd = class_data;
   printf("Get Begin\n");
   return pd->a;
}

//return obj = efl_add(DOMAIN_CLASS, NULL);

EFL_VOID_FUNC_BODYV(domain_recursive, EFL_FUNC_CALL(n), int n);

static void
_recursive(Eo *obj, void *class_data EINA_UNUSED, int n)
{
   static int count = 0;

   if (count < n)
     {
        count++;
        domain_recursive(obj, n);
     }
   else
     count = 0;
}

EFL_VOID_FUNC_BODYV(domain_a_set, EFL_FUNC_CALL(a), int a);
EFL_FUNC_BODY(domain_a_get, int, 0);
EFL_FUNC_BODY(domain_a_print, Eina_Bool, EINA_FALSE);
EFL_FUNC_BODY_CONST(domain_class_hi_print, Eina_Bool, EINA_FALSE);
EFL_VOID_FUNC_BODY(domain_pure_virtual);
EFL_VOID_FUNC_BODY(domain_no_implementation);

static Eina_Bool
_class_initializer(Efl_Class *klass)
{
   EFL_OPS_DEFINE(ops,
         EFL_OBJECT_OP_FUNC(domain_a_set, _a_set),
         EFL_OBJECT_OP_FUNC(domain_a_get, _a_get),
         EFL_OBJECT_OP_FUNC(domain_recursive, _recursive)
   );
   return efl_class_functions_set(klass, &ops, NULL);
}

static const Efl_Class_Description class_desc = {
     EO_VERSION,
     "Domain",
     EFL_CLASS_TYPE_REGULAR,
     sizeof(Domain_Public_Data),
     _class_initializer,
     NULL,
     NULL
};

EFL_DEFINE_CLASS(domain_class_get, &class_desc, EO_CLASS, NULL)