2 //gcc -g `pkg-config --cflags --libs elementary` layout_example_02.c -o layout_example_02
4 #include <Elementary.h>
6 # include "elementary_config.h"
11 #define TABLE "example/table"
12 #define BOX "example/box"
13 #define TITLE "example/title"
14 #define SWALLOW "example/custom"
16 static const char *images[] = { "home", "close", "arrow_up", "arrow_down", NULL };
23 _signal_cb(void *data, Evas_Object *o, const char *emission, const char *source __UNUSED__)
25 struct _App *app = data;
26 Evas_Object *icon = elm_object_content_part_get(o, "elm.swallow.content");
28 printf("signal received\n");
30 if (!strcmp("elm,action,back", emission))
32 else if (!strcmp("elm,action,next", emission))
36 app->current = sizeof(images) - 1;
37 else if (images[app->current] == NULL)
40 elm_icon_standard_set(icon, images[app->current]);
44 elm_main(int argc __UNUSED__, char **argv __UNUSED__)
46 Evas_Object *win, *bg, *layout, *icon;
51 win = elm_win_add(NULL, "layout", ELM_WIN_BASIC);
52 elm_win_title_set(win, "Layout");
53 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
54 elm_win_autodel_set(win, EINA_TRUE);
57 elm_bg_color_set(bg, 255, 255, 255);
58 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
59 elm_win_resize_object_add(win, bg);
62 // Adding layout and filling it with widgets
63 layout = elm_layout_add(win);
64 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
65 elm_win_resize_object_add(win, layout);
67 layout, "layout", "application", "content-back-next");
68 evas_object_show(layout);
70 icon = elm_icon_add(win);
71 elm_icon_standard_set(icon, images[app.current]);
72 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
73 elm_object_content_part_set(layout, "elm.swallow.content", icon);
75 elm_object_signal_callback_add(layout, "elm,action,back", "", _signal_cb, &app);
76 elm_object_signal_callback_add(layout, "elm,action,next", "", _signal_cb, &app);
78 evas_object_size_hint_min_set(bg, 160, 160);
79 evas_object_size_hint_max_set(bg, 640, 640);
80 evas_object_resize(win, 320, 320);
81 evas_object_show(win);