This example will arrange rectangles of different sizes(and colors) in a table.
While it's possible to create the same layout we are doing here by positioning each rectangle independently, using a table makes it a lot easier, since the table will control layout of all the objects, allowing you to move, resize or hide the entire table.
We'll start with creating the table, setting it to EVAS_OBJECT_TABLE_HOMOGENEOUS_NONE to have maximum flexibility and setting its padding to 0:
EVAS_API void evas_object_show(Evas_Object *eo_obj)
Makes the given Evas object visible.
Definition evas_object_main.c:1814
EVAS_API void evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
Changes the size of the given Evas object.
Definition evas_object_main.c:1236
EVAS_API Evas_Object * evas_object_table_add(Evas *evas)
Create a new table.
Definition evas_object_table.c:969
EVAS_API void evas_object_table_homogeneous_set(Evas_Table *obj, Evas_Object_Table_Homogeneous_Mode homogeneous)
Set how this table should layout children.
Definition evas_table_eo.legacy.c:3
EVAS_API void evas_object_table_padding_set(Evas_Table *obj, int horizontal, int vertical)
Control the padding between cells.
Definition evas_table_eo.legacy.c:27
@ EVAS_OBJECT_TABLE_HOMOGENEOUS_NONE
No mode specified.
Definition evas_table_eo.h:24
EVAS_API void evas_object_color_set(Evas_Object *obj, int r, int g, int b, int a)
Sets the general/main color of the given Evas object to the given one.
Definition evas_object_main.c:2024
EVAS_API void evas_object_size_hint_min_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
Sets the hints for an object's minimum size.
Definition evas_object_main.c:2611
EVAS_API Evas_Object * evas_object_rectangle_add(Evas *e)
Adds a rectangle to the given evas.
Definition evas_object_rectangle.c:78
EVAS_API Eina_Bool evas_object_table_pack(Evas_Table *obj, Efl_Canvas_Object *child, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan)
Add a new child to a table object or set its current packing.
Definition evas_table_eo.legacy.c:87
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <Ecore.h>
#include <stdlib.h>
#define WIDTH 100
#define HEIGHT 150
struct test_data
{
Ecore_Evas *ee;
Evas *evas;
Evas_Object *bg;
};
static struct test_data d = {0};
static void
{
}
static void
_canvas_resize_cb(Ecore_Evas *ee)
{
int w, h;
}
int
main(void)
{
Evas_Object *table, *rect;
return EXIT_FAILURE;
if (!d.ee)
goto error;
return 0;
error:
fprintf(stderr, "error: Requires at least one Evas engine built and linked"
" to ecore-evas for this example to run properly.\n");
return -1;
}
EAPI int ecore_evas_init(void)
Inits the Ecore_Evas system.
Definition ecore_evas.c:608
EAPI void ecore_evas_callback_destroy_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
Sets a callback for Ecore_Evas destroy events.
Definition ecore_evas.c:1199
EAPI void ecore_evas_show(Ecore_Evas *ee)
Shows an Ecore_Evas' window.
Definition ecore_evas.c:1494
EAPI Evas * ecore_evas_get(const Ecore_Evas *ee)
Gets an Ecore_Evas's Evas.
Definition ecore_evas.c:1314
EAPI void ecore_evas_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h)
Gets the geometry of an Ecore_Evas.
Definition ecore_evas.c:1376
EAPI Ecore_Evas * ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char *extra_options)
Creates a new Ecore_Evas based on engine name and common parameters.
Definition ecore_evas.c:1053
EAPI void ecore_evas_callback_resize_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
Sets a callback for Ecore_Evas resize events.
Definition ecore_evas.c:1154
EAPI int ecore_evas_shutdown(void)
Shuts down the Ecore_Evas system.
Definition ecore_evas.c:672
EAPI void ecore_evas_free(Ecore_Evas *ee)
Frees an Ecore_Evas.
Definition ecore_evas.c:1097
void ecore_main_loop_quit(void)
Quits the main loop once all the events currently on the queue have been processed.
Definition ecore_main.c:1321
void ecore_main_loop_begin(void)
Runs the application main loop.
Definition ecore_main.c:1311
#define EINA_UNUSED
Used to indicate that a function parameter is purposely unused.
Definition eina_types.h:339
EVAS_API void evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
Move the given Evas object to the given location inside its canvas' viewport.
Definition evas_object_main.c:1171