Eo: Removed "type" property from event/op descriptions.
[profile/ivi/eobj.git] / examples / evas / test.c
1 #include <Elementary.h>
2
3 #include "evas_obj.h"
4 #include "elw_button.h"
5 #include "elw_box.h"
6 #include "elw_boxedbutton.h"
7 #include "elw_win.h"
8
9 Eina_Bool
10 _btn_clicked_cb(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info)
11 {
12    (void) obj;
13    (void) event_info;
14    const Eo_Class *klass = eo_class_get(obj);
15    printf("%s obj-type:'%s' data:'%s'\n", desc->name, eo_class_name_get(klass), (const char *) data);
16
17    return EO_CALLBACK_CONTINUE;
18 }
19
20 int
21 main(int argc, char *argv[])
22 {
23    Evas_Coord winw, winh;
24      {
25         winw = 400;
26         winh = 400;
27      }
28
29    elm_init(argc, argv);
30    eo_init();
31
32    Eo *win = eo_add(ELW_WIN_CLASS, NULL);
33    eo_do(win, evas_obj_size_set(winw, winh), evas_obj_visibility_set(EINA_TRUE));
34
35    Eo *bt = eo_add(ELW_BUTTON_CLASS, win);
36    eo_do(bt, evas_obj_position_set(25, 25),
37          evas_obj_size_set(50, 50),
38          evas_obj_color_set(255, 0, 0, 255),
39          elw_button_text_set("Click"),
40          evas_obj_visibility_set(EINA_TRUE));
41    eo_do(bt, eo_event_callback_add(EV_CLICKED, _btn_clicked_cb, "btn"));
42
43    int r, g, b, a;
44    eo_do(bt, evas_obj_color_get(&r, &g, &b, &a));
45    printf("RGBa(%d, %d, %d, %d)\n", r, g, b, a);
46
47    Eo *bx = eo_add(ELW_BOXEDBUTTON_CLASS, win);
48    eo_do(bx, evas_obj_position_set(100, 100),
49          evas_obj_size_set(70, 70),
50          evas_obj_color_set(0, 0, 255, 255),
51          elw_button_text_set("Click2"),
52          evas_obj_visibility_set(EINA_TRUE));
53    eo_do(bx, eo_event_callback_add(EV_CLICKED, _btn_clicked_cb, "bxedbtn"));
54
55    elm_run();
56
57    eo_unref(bx);
58    eo_unref(bt);
59    eo_unref(win);
60    eo_shutdown();
61    elm_shutdown();
62    return 0;
63 }
64