Eo: Removed "type" property from event/op descriptions.
[profile/ivi/eobj.git] / examples / evas / elw_box.c
1 #include <Elementary.h>
2
3 #include "Eo.h"
4 #include "evas_obj.h"
5 #include "elw_box.h"
6
7 #include "config.h"
8
9 EAPI Eo_Op ELW_BOX_BASE_ID = 0;
10
11 typedef struct
12 {
13    Evas_Object *bx;
14 } Widget_Data;
15
16 #define MY_CLASS ELW_BOX_CLASS
17
18 static void
19 _pack_end(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
20 {
21    Widget_Data *wd = class_data;
22    Eo *child_obj;
23    child_obj = va_arg(*list, Eo *);
24    /* FIXME: Ref and the later uref child_obj here... */
25    elm_box_pack_end(wd->bx, eo_evas_object_get(child_obj));
26 }
27
28 static void
29 _constructor(Eo *obj, void *class_data)
30 {
31    eo_constructor_super(obj);
32
33    Widget_Data *wd = class_data;
34
35    /* FIXME: An hack, because our tree is not yet only Eo */
36    wd->bx = elm_box_add(eo_evas_object_get(eo_parent_get(obj)));
37    evas_object_size_hint_align_set(wd->bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
38    evas_object_size_hint_weight_set(wd->bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
39
40    eo_evas_object_set(obj, wd->bx);
41 }
42
43 static void
44 _class_constructor(Eo_Class *klass)
45 {
46    const Eo_Op_Func_Description func_desc[] = {
47         EO_OP_FUNC(ELW_BOX_ID(ELW_BOX_SUB_ID_PACK_END), _pack_end),
48         EO_OP_FUNC_SENTINEL
49    };
50
51    eo_class_funcs_set(klass, func_desc);
52 }
53
54 static const Eo_Op_Description op_desc[] = {
55      EO_OP_DESCRIPTION(ELW_BOX_SUB_ID_PACK_END, "Pack obj at the end of box."),
56      EO_OP_DESCRIPTION_SENTINEL
57 };
58
59 static const Eo_Class_Description class_desc = {
60      "Elw Box",
61      EO_CLASS_TYPE_REGULAR,
62      EO_CLASS_DESCRIPTION_OPS(&ELW_BOX_BASE_ID, op_desc, ELW_BOX_SUB_ID_LAST),
63      NULL,
64      sizeof(Widget_Data),
65      _constructor,
66      NULL,
67      _class_constructor,
68      NULL
69 };
70
71 EO_DEFINE_CLASS(elw_box_class_get, &class_desc, EVAS_OBJ_CLASS, NULL)
72