diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/ecore/src/examples/ecore_evas_object_example.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/libraries/ecore/src/examples/ecore_evas_object_example.c b/libraries/ecore/src/examples/ecore_evas_object_example.c new file mode 100644 index 0000000..33da234 --- /dev/null +++ b/libraries/ecore/src/examples/ecore_evas_object_example.c | |||
@@ -0,0 +1,52 @@ | |||
1 | /** | ||
2 | * Ecore example illustrating ecore evas object usage. | ||
3 | * | ||
4 | * You'll need at least one Evas engine built for it (excluding the | ||
5 | * buffer one). See stdout/stderr for output. | ||
6 | * | ||
7 | * @verbatim | ||
8 | * gcc -o ecore_evas_object_example ecore_evas_object_example.c `pkg-config --libs --cflags ecore-evas` | ||
9 | * @endverbatim | ||
10 | */ | ||
11 | |||
12 | #include <Ecore.h> | ||
13 | #include <Ecore_Evas.h> | ||
14 | |||
15 | int | ||
16 | main(void) | ||
17 | { | ||
18 | Ecore_Evas *ee; | ||
19 | Evas_Object *bg, *cursor, *obj; | ||
20 | int layer, x, y; | ||
21 | |||
22 | ecore_evas_init(); | ||
23 | |||
24 | ee = ecore_evas_new(NULL, 0, 0, 200, 200, NULL); | ||
25 | ecore_evas_title_set(ee, "Ecore Evas Object Example"); | ||
26 | ecore_evas_show(ee); | ||
27 | |||
28 | bg = evas_object_rectangle_add(ecore_evas_get(ee)); | ||
29 | evas_object_color_set(bg, 0, 0, 255, 255); | ||
30 | evas_object_resize(bg, 200, 200); | ||
31 | evas_object_show(bg); | ||
32 | ecore_evas_object_associate(ee, bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE); | ||
33 | |||
34 | if(bg == ecore_evas_object_associate_get(ee)) | ||
35 | printf("Association worked!\n"); | ||
36 | |||
37 | cursor = evas_object_rectangle_add(ecore_evas_get(ee)); | ||
38 | evas_object_color_set(cursor, 0, 255, 0, 255); | ||
39 | evas_object_resize(cursor, 5, 10); | ||
40 | ecore_evas_object_cursor_set(ee, cursor, 0, 1, 1); | ||
41 | |||
42 | ecore_evas_cursor_get(ee, &obj, &layer, &x, &y); | ||
43 | if(obj == cursor && layer == 0 && x == 1 && y == 1) | ||
44 | printf("Set cursor worked!\n"); | ||
45 | |||
46 | ecore_main_loop_begin(); | ||
47 | |||
48 | ecore_evas_free(ee); | ||
49 | ecore_evas_shutdown(); | ||
50 | |||
51 | return 0; | ||
52 | } | ||