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) - 1;
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, *bg, *layout, *icon;
46 win = elm_win_add(NULL, "layout", ELM_WIN_BASIC);
47 elm_win_title_set(win, "Layout");
48 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
49 elm_win_autodel_set(win, EINA_TRUE);
52 elm_bg_color_set(bg, 255, 255, 255);
53 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
54 elm_win_resize_object_add(win, bg);
57 // Adding layout and filling it with widgets
58 layout = elm_layout_add(win);
59 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
60 elm_win_resize_object_add(win, layout);
62 layout, "layout", "application", "content-back-next");
63 evas_object_show(layout);
65 icon = elm_icon_add(win);
66 elm_icon_standard_set(icon, images[app.current]);
67 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
68 elm_object_part_content_set(layout, "elm.swallow.content", icon);
70 elm_object_signal_callback_add(layout, "elm,action,back", "", _signal_cb, &app);
71 elm_object_signal_callback_add(layout, "elm,action,next", "", _signal_cb, &app);
73 evas_object_size_hint_min_set(bg, 160, 160);
74 evas_object_size_hint_max_set(bg, 640, 640);
75 evas_object_resize(win, 320, 320);
76 evas_object_show(win);