32
#ifndef PACKAGE_DATA_DIR
33
#define PACKAGE_DATA_DIR "."
36
#include "codegen_example_generated.h"
39
#include <Ecore_Evas.h>
46
_on_delete(Ecore_Evas *ee EINA_UNUSED)
48
ecore_main_loop_quit();
52
_columns_rows_print(Evas_Object *edje_obj)
56
if (codegen_example_part_four_col_row_size_get(edje_obj, &cols, &rows))
57
printf("Number of columns: %d\nNumber of rows: %d\n", cols, rows);
59
fprintf(stderr, "Cannot get the number of columns and rows\n");
63
_on_mouse_over(void *data EINA_UNUSED, Evas_Object *obj, const char *emission,
69
printf("Mouse over, source: %s - emission: %s\n",
73
rect = codegen_example_part_three_remove_at(obj, 0);
74
codegen_example_part_three_append(obj, rect);
78
rect = codegen_example_part_two_get(obj);
79
evas_object_color_set(rect, 0, 255, 0, 255);
80
codegen_example_part_below_over_callback_del_full(obj,_on_mouse_over,
82
codegen_example_part_four_clear(obj, EINA_TRUE);
83
_columns_rows_print(obj);
84
codegen_example_part_three_remove_all(obj, EINA_TRUE);
89
_rect_create(Evas *e, unsigned char r, unsigned char g, unsigned char b)
93
o = evas_object_rectangle_add(e);
94
evas_object_color_set(o, r, g, b, 255);
95
evas_object_size_hint_weight_set(o, 1.0, 1.0);
96
evas_object_size_hint_min_set(o, 100, 100);
103
main(int argc EINA_UNUSED, char *argv[] EINA_UNUSED)
105
const char *edje_file = PACKAGE_DATA_DIR"/codegen.edj";
109
Evas_Object *edje_obj;
110
Evas_Object *red_rect, *yellow_rect, *blue_rect, *rects[4];
112
if (!ecore_evas_init())
116
goto shutdown_ecore_evas;
120
ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
121
if (!ee) goto shutdown_edje;
123
ecore_evas_callback_delete_request_set(ee, _on_delete);
124
ecore_evas_title_set(ee, "Edje Codegen Example");
126
evas = ecore_evas_get(ee);
128
bg = _rect_create(evas, 255, 255, 255);
129
evas_object_move(bg, 0, 0);
130
evas_object_resize(bg, WIDTH, HEIGHT);
131
ecore_evas_object_associate(ee, bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE);
133
edje_obj = codegen_example_object_add(evas, edje_file);
134
evas_object_resize(edje_obj, WIDTH, HEIGHT);
135
evas_object_show(edje_obj);
137
codegen_example_part_one_set(edje_obj, "CODEGEN_EXAMPLE");
138
codegen_example_part_below_over_callback_add(edje_obj, _on_mouse_over, NULL);
140
red_rect = _rect_create(evas, 255, 0, 0);
141
codegen_example_part_two_set(edje_obj, red_rect);
143
blue_rect = _rect_create(evas, 0, 0, 255);
144
codegen_example_part_three_append(edje_obj, blue_rect);
146
yellow_rect = _rect_create(evas, 255, 255, 0);
147
codegen_example_part_three_prepend(edje_obj, yellow_rect);
150
rects[0] = _rect_create(evas, 0, 0, 255);
151
rects[1] = _rect_create(evas, 0, 255, 0);
152
rects[2] = _rect_create(evas, 255, 0, 0);
153
rects[3] = _rect_create(evas, 125, 140, 80);
155
if (!codegen_example_part_four_pack(edje_obj, rects[0], 0, 0, 1, 2))
156
fprintf(stderr, "Cannot add the rectangle 1 to table\n");
158
if (!codegen_example_part_four_pack(edje_obj, rects[1], 0, 1, 1, 1))
159
fprintf(stderr, "Cannot add the rectangle 2 to table\n");
161
if (!codegen_example_part_four_pack(edje_obj, rects[2], 1, 0, 1, 1))
162
fprintf(stderr, "Cannot add the rectangle 3 to table\n");
164
if (!codegen_example_part_four_pack(edje_obj, rects[3], 1, 1, 1, 1))
165
fprintf(stderr, "Cannot add the rectangle 4 to table\n");
167
_columns_rows_print(edje_obj);
170
ecore_main_loop_begin();
173
ecore_evas_shutdown();
181
ecore_evas_shutdown();