2017-11-15 02:55:04 -08:00
|
|
|
#include "eo_inherit.h"
|
|
|
|
|
2017-11-17 07:35:45 -08:00
|
|
|
Example_Rectangle *
|
2017-11-15 07:02:37 -08:00
|
|
|
_rectangle_create()
|
2017-11-15 02:55:04 -08:00
|
|
|
{
|
|
|
|
Example_Rectangle *rectangle;
|
|
|
|
|
|
|
|
rectangle = efl_add(EXAMPLE_RECTANGLE_CLASS, NULL,
|
|
|
|
efl_name_set(efl_added, "Rectangle"),
|
|
|
|
example_rectangle_width_set(efl_added, 5),
|
|
|
|
example_rectangle_height_set(efl_added, 10));
|
|
|
|
|
|
|
|
return rectangle;
|
|
|
|
}
|
|
|
|
|
2017-11-17 07:35:45 -08:00
|
|
|
Example_Rectangle *
|
2017-11-15 02:55:04 -08:00
|
|
|
_square_create()
|
|
|
|
{
|
|
|
|
Example_Square *square;
|
|
|
|
|
|
|
|
square = efl_add(EXAMPLE_SQUARE_CLASS, NULL,
|
|
|
|
efl_name_set(efl_added, "Square"),
|
2017-11-15 09:20:42 -08:00
|
|
|
example_rectangle_width_set(efl_added, 7));
|
2017-11-15 02:55:04 -08:00
|
|
|
|
|
|
|
return square;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-11-17 07:35:45 -08:00
|
|
|
_shape_print(Example_Rectangle *shape)
|
2017-11-15 02:55:04 -08:00
|
|
|
{
|
2017-11-17 07:35:45 -08:00
|
|
|
printf("Shape named %s has area %d\n", efl_name_get(shape), example_rectangle_area(shape));
|
2017-11-15 02:55:04 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI_MAIN void
|
|
|
|
efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Eo *shape;
|
|
|
|
|
2017-11-15 07:02:37 -08:00
|
|
|
shape = _rectangle_create();
|
2017-11-15 02:55:04 -08:00
|
|
|
_shape_print(shape);
|
2017-11-16 09:37:57 -08:00
|
|
|
efl_unref(shape);
|
2017-11-15 02:55:04 -08:00
|
|
|
|
|
|
|
shape = _square_create();
|
|
|
|
_shape_print(shape);
|
2017-11-16 09:37:57 -08:00
|
|
|
efl_unref(shape);
|
2017-11-15 02:55:04 -08:00
|
|
|
|
|
|
|
efl_exit(0);
|
|
|
|
}
|
|
|
|
EFL_MAIN()
|
|
|
|
|