In this example we are going to pack two rectangles in a box, and have a separator in the middle.
So we start we the window, background, box and rectangle creation, all pretty normal stuff:
#include <Elementary.h>
EAPI_MAIN int
elm_main(int argc, char **argv)
{
Evas_Object *win, *bx, *rect, *separator;
elm_box_horizontal_set(bx, EINA_TRUE);
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(bx);
rect = evas_object_rectangle_add(evas_object_evas_get(win));
evas_object_color_set(rect, 0, 255, 0, 255);
evas_object_size_hint_min_set(rect, 90, 200);
evas_object_size_hint_weight_set(rect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(rect, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(rect);
elm_box_pack_end(bx, rect);
Once we have our first rectangle in the box we create and add our separator:
elm_separator_horizontal_set(separator, EINA_TRUE);
evas_object_show(separator);
elm_box_pack_end(bx, separator);
- Note
- Since our box is in horizontal mode it's a good idea to set the separator to be horizontal too.
And now we add our second rectangle and run the main loop:
rect = evas_object_rectangle_add(evas_object_evas_get(win));
evas_object_color_set(rect, 0, 0, 255, 255);
evas_object_size_hint_min_set(rect, 90, 200);
evas_object_size_hint_weight_set(rect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(rect, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(rect);
elm_box_pack_end(bx, rect);
evas_object_show(win);
return 0;
}
This example will look like this: