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_object_table_padding_set(table, 0, 0);
void evas_object_show(Evas_Object *eo_obj)
Makes the given Evas object visible.
Definition: evas_object_main.c:1814
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_Object * evas_object_table_add(Evas *evas)
Create a new table.
Definition: evas_object_table.c:972
@ EVAS_OBJECT_TABLE_HOMOGENEOUS_NONE
No mode specified.
Definition: evas_table_eo.h:24
evas_object_table_pack(table, rect, 1, 1, 2, 1);
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
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_Object * evas_object_rectangle_add(Evas *e)
Adds a rectangle to the given evas.
Definition: evas_object_rectangle.c:78
evas_object_table_pack(table, rect, 1, 2, 1, 2);
evas_object_table_pack(table, rect, 2, 2, 1, 1);
evas_object_table_pack(table, rect, 2, 3, 1, 1);
#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;
};
static struct test_data d = {0};
static void
{
}
static void
_canvas_resize_cb(Ecore_Evas *ee)
{
int w, h;
}
int
main(void)
{
return EXIT_FAILURE;
if (!d.ee)
goto error;
evas_object_table_padding_set(table, 0, 0);
evas_object_table_pack(table, rect, 1, 1, 2, 1);
evas_object_table_pack(table, rect, 1, 2, 1, 2);
evas_object_table_pack(table, rect, 2, 2, 1, 1);
evas_object_table_pack(table, rect, 2, 3, 1, 1);
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:606
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:1211
EAPI void ecore_evas_show(Ecore_Evas *ee)
Shows an Ecore_Evas' window.
Definition: ecore_evas.c:1506
EAPI Evas * ecore_evas_get(const Ecore_Evas *ee)
Gets an Ecore_Evas's Evas.
Definition: ecore_evas.c:1326
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:1388
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:1166
EAPI int ecore_evas_shutdown(void)
Shuts down the Ecore_Evas system.
Definition: ecore_evas.c:674
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:1065
EAPI void ecore_evas_free(Ecore_Evas *ee)
Frees an Ecore_Evas.
Definition: ecore_evas.c:1109
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:1300
void ecore_main_loop_begin(void)
Runs the application main loop.
Definition: ecore_main.c:1290
#define EINA_UNUSED
Used to indicate that a function parameter is purposely unused.
Definition: eina_types.h:339
Eo Evas
An opaque handle to an Evas canvas.
Definition: Evas_Common.h:158
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
Efl_Canvas_Object Evas_Object
An Evas Object handle.
Definition: Evas_Common.h:180