2 //gcc -g layout_example_02.c -o layout_example_02 `pkg-config --cflags --libs elementary`
4 #include <Elementary.h>
6 #define TABLE "example/table"
7 #define BOX "example/box"
8 #define TITLE "example/title"
9 #define SWALLOW "example/custom"
11 static const char *images[] = { "home", "close", "arrow_up", "arrow_down", NULL };
18 _signal_cb(void *data, Evas_Object *o, const char *emission, const char *source)
20 struct _App *app = data;
21 Evas_Object *icon = elm_object_part_content_get(o, "elm.swallow.content");
23 printf("signal received\n");
25 if (!strcmp("elm,action,back", emission))
27 else if (!strcmp("elm,action,next", emission))
31 app->current = (sizeof(images) / sizeof(images[0])) - 2;
32 else if (images[app->current] == NULL)
35 elm_icon_standard_set(icon, images[app->current]);
39 elm_main(int argc, char **argv)
41 Evas_Object *win, *layout, *icon;
46 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
48 win = elm_win_util_standard_add("layout", "Layout");
49 elm_win_autodel_set(win, EINA_TRUE);
51 // Adding layout and filling it with widgets
52 layout = elm_layout_add(win);
53 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
54 elm_win_resize_object_add(win, layout);
55 if (!elm_layout_theme_set(
56 layout, "layout", "application", "content-back-next"))
57 fprintf(stderr, "Failed to set layout");
58 evas_object_show(layout);
60 icon = elm_icon_add(win);
61 elm_icon_standard_set(icon, images[app.current]);
62 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
63 elm_object_part_content_set(layout, "elm.swallow.content", icon);
65 elm_object_signal_callback_add(layout, "elm,action,back", "elm", _signal_cb, &app);
66 elm_object_signal_callback_add(layout, "elm,action,next", "elm", _signal_cb, &app);
68 evas_object_resize(win, 320, 320);
69 evas_object_show(win);