summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Juyung Seo <juyung.seo@samsung.com>2013-06-16 23:26:35 +0900
committerDaniel Juyung Seo <juyung.seo@samsung.com>2013-06-16 23:26:35 +0900
commitfbb97d576d588d80ec7f75c828eb15d84eb3095a (patch)
tree7556ec39f62c37fd9f78870d7a5e0763323210ad
parent6cc7805fd8269558bab7da154cc55cb65a65e1dc (diff)
source/3-final: copied ../sample/2-final to source directory.
-rw-r--r--source/3-final/Makefile50
-rw-r--r--source/3-final/data/edc/layout.edc161
-rw-r--r--source/3-final/data/images/0.jpgbin0 -> 14177 bytes
-rw-r--r--source/3-final/data/images/1.jpgbin0 -> 67424 bytes
-rw-r--r--source/3-final/data/images/10.jpgbin0 -> 464980 bytes
-rw-r--r--source/3-final/data/images/11.jpgbin0 -> 53748 bytes
-rw-r--r--source/3-final/data/images/12.jpgbin0 -> 360282 bytes
-rw-r--r--source/3-final/data/images/13.jpgbin0 -> 213600 bytes
-rw-r--r--source/3-final/data/images/14.jpgbin0 -> 76123 bytes
-rw-r--r--source/3-final/data/images/15.jpgbin0 -> 76072 bytes
-rw-r--r--source/3-final/data/images/16.jpgbin0 -> 21337 bytes
-rw-r--r--source/3-final/data/images/17.jpgbin0 -> 964427 bytes
-rw-r--r--source/3-final/data/images/2.jpgbin0 -> 323378 bytes
-rw-r--r--source/3-final/data/images/3.jpgbin0 -> 52815 bytes
-rw-r--r--source/3-final/data/images/4.jpgbin0 -> 152631 bytes
-rw-r--r--source/3-final/data/images/5.jpgbin0 -> 215426 bytes
-rw-r--r--source/3-final/data/images/6.jpgbin0 -> 47551 bytes
-rw-r--r--source/3-final/data/images/7.jpgbin0 -> 107635 bytes
-rw-r--r--source/3-final/data/images/8.jpgbin0 -> 339192 bytes
-rw-r--r--source/3-final/data/images/9.jpgbin0 -> 13522 bytes
-rw-r--r--source/3-final/data/images/bg.jpgbin0 -> 60117 bytes
-rw-r--r--source/3-final/data/images/icon_01.pngbin0 -> 11371 bytes
-rw-r--r--source/3-final/data/images/icon_02.pngbin0 -> 12432 bytes
-rw-r--r--source/3-final/data/images/icon_03.pngbin0 -> 15014 bytes
-rw-r--r--source/3-final/data/images/icon_04.pngbin0 -> 7912 bytes
-rw-r--r--source/3-final/data/images/icon_05.pngbin0 -> 1483 bytes
-rw-r--r--source/3-final/data/images/icon_left_arrow.pngbin0 -> 1716 bytes
-rw-r--r--source/3-final/data/images/icon_right_arrow.pngbin0 -> 1832 bytes
-rw-r--r--source/3-final/src/main.c210
29 files changed, 421 insertions, 0 deletions
diff --git a/source/3-final/Makefile b/source/3-final/Makefile
new file mode 100644
index 0000000..818bbb9
--- /dev/null
+++ b/source/3-final/Makefile
@@ -0,0 +1,50 @@
1SRCDIR=src
2EDJDIR=data/edc
3OBJECTS=$(SRCDIR)/main.o
4EDJS=$(EDJDIR)/layout.edj
5BINARY=sample
6DIRNAME=sample
7
8PREFIX=/usr/local
9BINDIR=$(PREFIX)/bin
10DATADIR=$(PREFIX)/share/sample
11
12CC = gcc
13
14CFLAGS = `pkg-config --cflags elementary evas`
15CFLAGS += -g -W -Wextra #-Wall
16LDFLAGS = `pkg-config --libs elementary evas`
17
18EDJE_CC = edje_cc
19EDJE_FLAGS = -id data/images
20
21all: $(OBJECTS) $(BINARY) $(EDJS)
22
23%.o : %.c
24 @echo " Compilation of $(@D)/$(<F)"
25 @$(CC) -c $(CFLAGS) $< -o $@
26
27$(BINARY): $(OBJECTS)
28 @echo " Linking $(@F)"
29 @$(CC) -o $(BINARY) $(OBJECTS) $(LDFLAGS)
30
31$(EDJDIR)/layout.edj: $(EDJDIR)/layout.edc
32 @echo " Compilation of $(@D)/$(<F)"
33 @$(EDJE_CC) $(EDJE_FLAGS) $(EDJDIR)/layout.edc $(EDJDIR)/layout.edj
34
35install: $(BINARY) $(EDJDIR)/layout.edj
36 @echo "installation of executables"
37 @mkdir -p $(BINDIR)
38 @install -m 0755 $(BINARY) $(BINDIR)
39 @echo "installation of data"
40 @mkdir -p $(DATADIR)/edj
41 @install $(EDJDIR)/layout.edj $(DATADIR)/edj
42 @mkdir -p $(DATADIR)/images
43 @install data/images/* $(DATADIR)/images
44
45uninstall:
46 rm -rf $(DATADIR)
47 rm -rf $(BINDIR)/$(BINARY)
48
49clean:
50 @rm -f *.o *.edj *~ $(BINARY)
diff --git a/source/3-final/data/edc/layout.edc b/source/3-final/data/edc/layout.edc
new file mode 100644
index 0000000..1a10add
--- /dev/null
+++ b/source/3-final/data/edc/layout.edc
@@ -0,0 +1,161 @@
1collections {
2 images {
3 image: "bg.jpg" COMP;
4 image: "icon_left_arrow.png" COMP;
5 image: "icon_right_arrow.png" COMP;
6 image: "icon_01.png" COMP;
7 image: "icon_02.png" COMP;
8 image: "icon_03.png" COMP;
9 image: "icon_04.png" COMP;
10 image: "icon_05.png" COMP;
11 }
12 group { name:"main";
13 parts {
14 part { name: "bg";
15 type: IMAGE;
16 description { state: "default" 0.0;
17 image.normal: "bg.jpg";
18 }
19 }
20 part { name: "elm.swallow.top";
21 type: SWALLOW;
22 description { state: "default" 0.0;
23 rel1.relative: 0.35 0.0;
24 rel2.relative: 0.65 0.15;
25 }
26 }
27 part { name: "elm.text.news";
28 type: TEXT;
29 scale: 1;
30 description { state: "default" 0.0;
31 rel1.relative: 0.05 0.1;
32 rel2.relative: 0.15 0.2;
33 align: 0 0;
34 color: 200 200 200 255;
35 text { font: "Sans:style=Bold";
36 size: 12;
37 min: 0 0;
38 text: "News";
39 }
40 }
41 }
42 part { name: "elm.swallow.middle";
43 type: SWALLOW;
44 description { state: "default" 0.0;
45 rel1.relative: 0.06 0.17;
46 rel2.relative: 0.94 0.85;
47 }
48 }
49 part { name: "elm.swallow.bottom";
50 type: SWALLOW;
51 description { state: "default" 0.0;
52 rel1.relative: 0.1 0.87;
53 rel2.relative: 0.9 1.0;
54 }
55 }
56 part { name: "elm.swallow.left_arrow";
57 type: SWALLOW;
58 scale: 1;
59 description { state: "default" 0.0;
60 rel1.relative: 0.0 0.5;
61 rel2.relative: 0.0 0.5;
62 min: 40 50;
63 fixed: 1 1;
64 align: 0.0 0.5;
65 }
66 description { state: "visible" 0.0;
67 inherit: "default" 0.0;
68 visible: 0;
69 }
70 }
71 part { name: "elm.swallow.right_arrow";
72 type: SWALLOW;
73 scale: 1;
74 description { state: "default" 0.0;
75 rel1.relative: 1.0 0.5;
76 rel2.relative: 1.0 0.5;
77 min: 40 50;
78 fixed: 1 1;
79 align: 1.0 0.5;
80 }
81 }
82 }
83 programs {
84 program { name: "hide-arrow-left";
85 signal: "elm,state,arrow,hide";
86 source: "elm";
87 action: STATE_SET "visible" 0.0;
88 target: "elm.swallow.left_arrow";
89 }
90 program { name: "show-arrow-left";
91 signal: "elm,state,arrow,show";
92 source: "elm";
93 action: STATE_SET "default" 0.0;
94 target: "elm.swallow.left_arrow";
95 }
96 }
97 }
98 group { name:"left_arrow";
99 parts {
100 part { name: "base";
101 description {
102 image.normal: "icon_left_arrow.png";
103 }
104 }
105 }
106 }
107 group { name:"right_arrow";
108 parts {
109 part { name: "base";
110 description {
111 image.normal: "icon_right_arrow.png";
112 }
113 }
114 }
115 }
116 group { name:"icon0";
117 parts {
118 part { name: "base";
119 description {
120 image.normal: "icon_01.png";
121 }
122 }
123 }
124 }
125 group { name:"icon1";
126 parts {
127 part { name: "base";
128 description {
129 image.normal: "icon_02.png";
130 }
131 }
132 }
133 }
134 group { name:"icon2";
135 parts {
136 part { name: "base";
137 description {
138 image.normal: "icon_03.png";
139 }
140 }
141 }
142 }
143 group { name:"icon3";
144 parts {
145 part { name: "base";
146 description {
147 image.normal: "icon_04.png";
148 }
149 }
150 }
151 }
152 group { name:"icon4";
153 parts {
154 part { name: "base";
155 description {
156 image.normal: "icon_05.png";
157 }
158 }
159 }
160 }
161}
diff --git a/source/3-final/data/images/0.jpg b/source/3-final/data/images/0.jpg
new file mode 100644
index 0000000..492c207
--- /dev/null
+++ b/source/3-final/data/images/0.jpg
Binary files differ
diff --git a/source/3-final/data/images/1.jpg b/source/3-final/data/images/1.jpg
new file mode 100644
index 0000000..9e91e1e
--- /dev/null
+++ b/source/3-final/data/images/1.jpg
Binary files differ
diff --git a/source/3-final/data/images/10.jpg b/source/3-final/data/images/10.jpg
new file mode 100644
index 0000000..b6d4ea3
--- /dev/null
+++ b/source/3-final/data/images/10.jpg
Binary files differ
diff --git a/source/3-final/data/images/11.jpg b/source/3-final/data/images/11.jpg
new file mode 100644
index 0000000..54ebab1
--- /dev/null
+++ b/source/3-final/data/images/11.jpg
Binary files differ
diff --git a/source/3-final/data/images/12.jpg b/source/3-final/data/images/12.jpg
new file mode 100644
index 0000000..e253987
--- /dev/null
+++ b/source/3-final/data/images/12.jpg
Binary files differ
diff --git a/source/3-final/data/images/13.jpg b/source/3-final/data/images/13.jpg
new file mode 100644
index 0000000..197da30
--- /dev/null
+++ b/source/3-final/data/images/13.jpg
Binary files differ
diff --git a/source/3-final/data/images/14.jpg b/source/3-final/data/images/14.jpg
new file mode 100644
index 0000000..a556002
--- /dev/null
+++ b/source/3-final/data/images/14.jpg
Binary files differ
diff --git a/source/3-final/data/images/15.jpg b/source/3-final/data/images/15.jpg
new file mode 100644
index 0000000..c70d897
--- /dev/null
+++ b/source/3-final/data/images/15.jpg
Binary files differ
diff --git a/source/3-final/data/images/16.jpg b/source/3-final/data/images/16.jpg
new file mode 100644
index 0000000..7b19daf
--- /dev/null
+++ b/source/3-final/data/images/16.jpg
Binary files differ
diff --git a/source/3-final/data/images/17.jpg b/source/3-final/data/images/17.jpg
new file mode 100644
index 0000000..3e1e7b8
--- /dev/null
+++ b/source/3-final/data/images/17.jpg
Binary files differ
diff --git a/source/3-final/data/images/2.jpg b/source/3-final/data/images/2.jpg
new file mode 100644
index 0000000..de9c600
--- /dev/null
+++ b/source/3-final/data/images/2.jpg
Binary files differ
diff --git a/source/3-final/data/images/3.jpg b/source/3-final/data/images/3.jpg
new file mode 100644
index 0000000..32cbdd9
--- /dev/null
+++ b/source/3-final/data/images/3.jpg
Binary files differ
diff --git a/source/3-final/data/images/4.jpg b/source/3-final/data/images/4.jpg
new file mode 100644
index 0000000..018cfe0
--- /dev/null
+++ b/source/3-final/data/images/4.jpg
Binary files differ
diff --git a/source/3-final/data/images/5.jpg b/source/3-final/data/images/5.jpg
new file mode 100644
index 0000000..a7852d0
--- /dev/null
+++ b/source/3-final/data/images/5.jpg
Binary files differ
diff --git a/source/3-final/data/images/6.jpg b/source/3-final/data/images/6.jpg
new file mode 100644
index 0000000..b00242d
--- /dev/null
+++ b/source/3-final/data/images/6.jpg
Binary files differ
diff --git a/source/3-final/data/images/7.jpg b/source/3-final/data/images/7.jpg
new file mode 100644
index 0000000..473bd04
--- /dev/null
+++ b/source/3-final/data/images/7.jpg
Binary files differ
diff --git a/source/3-final/data/images/8.jpg b/source/3-final/data/images/8.jpg
new file mode 100644
index 0000000..bfd21be
--- /dev/null
+++ b/source/3-final/data/images/8.jpg
Binary files differ
diff --git a/source/3-final/data/images/9.jpg b/source/3-final/data/images/9.jpg
new file mode 100644
index 0000000..8727f3a
--- /dev/null
+++ b/source/3-final/data/images/9.jpg
Binary files differ
diff --git a/source/3-final/data/images/bg.jpg b/source/3-final/data/images/bg.jpg
new file mode 100644
index 0000000..96b022b
--- /dev/null
+++ b/source/3-final/data/images/bg.jpg
Binary files differ
diff --git a/source/3-final/data/images/icon_01.png b/source/3-final/data/images/icon_01.png
new file mode 100644
index 0000000..faf524c
--- /dev/null
+++ b/source/3-final/data/images/icon_01.png
Binary files differ
diff --git a/source/3-final/data/images/icon_02.png b/source/3-final/data/images/icon_02.png
new file mode 100644
index 0000000..592cb5a
--- /dev/null
+++ b/source/3-final/data/images/icon_02.png
Binary files differ
diff --git a/source/3-final/data/images/icon_03.png b/source/3-final/data/images/icon_03.png
new file mode 100644
index 0000000..3d3063b
--- /dev/null
+++ b/source/3-final/data/images/icon_03.png
Binary files differ
diff --git a/source/3-final/data/images/icon_04.png b/source/3-final/data/images/icon_04.png
new file mode 100644
index 0000000..454bd62
--- /dev/null
+++ b/source/3-final/data/images/icon_04.png
Binary files differ
diff --git a/source/3-final/data/images/icon_05.png b/source/3-final/data/images/icon_05.png
new file mode 100644
index 0000000..bb81792
--- /dev/null
+++ b/source/3-final/data/images/icon_05.png
Binary files differ
diff --git a/source/3-final/data/images/icon_left_arrow.png b/source/3-final/data/images/icon_left_arrow.png
new file mode 100644
index 0000000..0ec3008
--- /dev/null
+++ b/source/3-final/data/images/icon_left_arrow.png
Binary files differ
diff --git a/source/3-final/data/images/icon_right_arrow.png b/source/3-final/data/images/icon_right_arrow.png
new file mode 100644
index 0000000..6bbb2c6
--- /dev/null
+++ b/source/3-final/data/images/icon_right_arrow.png
Binary files differ
diff --git a/source/3-final/src/main.c b/source/3-final/src/main.c
new file mode 100644
index 0000000..74f00fa
--- /dev/null
+++ b/source/3-final/src/main.c
@@ -0,0 +1,210 @@
1#include <Elementary.h>
2
3#define PACKAGE_BIN_DIR "/usr/local/bin"
4#define PACKAGE_DATA_DIR "/usr/local/share/sample"
5
6Evas_Object *
7create_button(Evas_Object *parent)
8{
9 Evas_Object *btn;
10 btn = elm_button_add(parent);
11 evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
12 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
13 evas_object_show(btn);
14
15 return btn;
16}
17
18Evas_Object *
19create_image(Evas_Object *parent, char *path, char *group)
20{
21 Evas_Object *img;
22 img = elm_image_add(parent);
23 elm_image_file_set(img, path, group);
24 evas_object_show(img);
25
26 return img;
27}
28
29void
30_btn_effect(Evas_Object *obj)
31{
32 evas_object_raise(obj);
33
34 Elm_Transit *transit = elm_transit_add();
35 elm_transit_object_add(transit, obj);
36 elm_transit_duration_set(transit, 0.25);
37 elm_transit_auto_reverse_set(transit, EINA_TRUE);
38 elm_transit_effect_zoom_add(transit, 1.0, 1.25);
39 //elm_transit_smooth_set(transit, EINA_FALSE); // EFL 1.8
40 elm_transit_go(transit);
41}
42
43void
44btn_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info)
45{
46 _btn_effect(obj);
47}
48
49void
50btn_clicked(void *data, Evas_Object *obj, void *event_info)
51{
52 _btn_effect(obj);
53}
54
55void
56toolbar_it_cb(void *data, Evas_Object *obj, void *event_info)
57{
58 Elm_Object_Item *it = event_info;
59 printf("%s\n", elm_object_item_text_get(it));
60 Evas_Object *layout = data;
61 if (!layout) return;
62 elm_layout_text_set(layout, "elm.text.news", elm_object_item_text_get(it));
63}
64
65void
66_left_arrow_clicked_cb(void *data, Evas_Object *obj, void *info)
67{
68 Evas_Object *layout = data;
69 if (!layout) return;
70 elm_layout_signal_emit(layout, "elm,state,arrow,hide" , "elm");
71}
72
73void
74_right_arrow_clicked_cb(void *data, Evas_Object *obj, void *info)
75{
76 Evas_Object *layout = data;
77 if (!layout) return;
78 elm_layout_signal_emit(layout, "elm,state,arrow,show" , "elm");
79}
80
81void
82init()
83{
84 Evas_Object *win, *layout, *table, *toolbar, *btn, *img, *label;
85 char buf[PATH_MAX], buf2[256];
86 int i, j;
87 Evas_Coord padding_size;
88
89 //Create a Window
90 //win = elm_win_util_standard_add(elm_app_name_get(), elm_app_name_get()); // EFL 1.8
91 win = elm_win_util_standard_add("sample", "Sample");
92 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
93 elm_win_autodel_set(win, EINA_TRUE);
94 evas_object_resize(win, 720, 400);
95 evas_object_show(win);
96
97 //Create a Layout
98 layout = elm_layout_add(win);
99 snprintf(buf, sizeof(buf), "%s/edj/layout.edj", elm_app_data_dir_get());
100 elm_layout_file_set(layout, buf, "main");
101 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
102 elm_win_resize_object_add(win, layout);
103 evas_object_show(layout);
104
105 //Create Top Contents
106 table = elm_table_add(layout);
107
108 for (i = 0; i < 5; i++)
109 {
110 btn = create_button(table);
111 snprintf(buf, sizeof(buf), "%s/edj/layout.edj", elm_app_data_dir_get());
112 snprintf(buf2, sizeof(buf2), "icon%d", i);
113 img = create_image(btn, buf, buf2);
114 elm_object_content_set(btn, img);
115
116 elm_table_pack(table, btn, i, 0, 1, 1);
117
118 label = elm_label_add(table);
119 snprintf(buf2, sizeof(buf2), "<color=#ffffff>item%d</color>", i);
120 elm_object_text_set(label, buf2);
121 evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
122 evas_object_size_hint_align_set(label, 0.5, 0.5);
123 evas_object_show(label);
124
125 elm_table_pack(table, label, i, 1, 1, 1);
126 }
127
128 elm_object_part_content_set(layout, "elm.swallow.top", table);
129 evas_object_show(table);
130
131 //Create Middle Contents
132 table = elm_table_add(layout);
133 padding_size = 7 * elm_config_scale_get();
134 elm_table_padding_set(table, padding_size, padding_size);
135
136 for (i = 0; i < 3; i++)
137 {
138 for (j = 0; j < 6; j++)
139 {
140 btn = create_button(table);
141
142 // elm_button "clicked" smart callback
143 //evas_object_smart_callback_add(btn, "clicked", btn_clicked, NULL);
144
145 // evas object mouse in callback
146 evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_IN, btn_mouse_in, NULL);
147 snprintf(buf, sizeof(buf), "%s/images/%d.jpg", elm_app_data_dir_get(), ((i * 6) + j));
148 img = create_image(btn, buf, NULL);
149 elm_object_content_set(btn, img);
150 elm_table_pack(table, btn, j, i, 1, 1);
151 }
152 }
153
154 elm_object_part_content_set(layout, "elm.swallow.middle", table);
155 evas_object_show(table);
156
157 //Create a Left arrow
158 btn = create_button(table);
159 snprintf(buf, sizeof(buf), "%s/edj/layout.edj", elm_app_data_dir_get());
160 img = create_image(btn, buf, "left_arrow");
161 elm_object_content_set(btn, img);
162 elm_object_part_content_set(layout, "elm.swallow.left_arrow", btn);
163 evas_object_show(btn);
164 evas_object_smart_callback_add(btn, "clicked", _left_arrow_clicked_cb, layout);
165
166 //Create a Right arrow
167 btn = create_button(table);
168 snprintf(buf, sizeof(buf), "%s/edj/layout.edj", elm_app_data_dir_get());
169 img = create_image(btn, buf, "right_arrow");
170 elm_object_content_set(btn, img);
171 elm_object_part_content_set(layout, "elm.swallow.right_arrow", btn);
172 evas_object_show(btn);
173 evas_object_smart_callback_add(btn, "clicked", _right_arrow_clicked_cb, layout);
174
175 //Create Bottom Contents
176 toolbar = elm_toolbar_add(layout);
177 elm_toolbar_select_mode_set(toolbar, ELM_OBJECT_SELECT_MODE_ALWAYS);
178 //elm_toolbar_transverse_expanded_set(toolbar, EINA_TRUE); // EFL 1.8
179 elm_toolbar_homogeneous_set(toolbar, EINA_TRUE);
180
181 elm_toolbar_item_append(toolbar, NULL, "Guide", toolbar_it_cb, layout);
182 elm_toolbar_item_append(toolbar, NULL, "Time Line View", toolbar_it_cb, layout);
183 elm_toolbar_item_append(toolbar, NULL, "Recorded TV", toolbar_it_cb, layout);
184 elm_toolbar_item_append(toolbar, NULL, "Downloads", toolbar_it_cb, layout);
185 elm_toolbar_item_append(toolbar, NULL, "Favorites", toolbar_it_cb, layout);
186 elm_toolbar_item_append(toolbar, NULL, "YouTube", toolbar_it_cb, layout);
187
188 elm_object_part_content_set(layout, "elm.swallow.bottom", toolbar);
189 evas_object_show(toolbar);
190}
191
192EAPI_MAIN int
193elm_main(int argc, char **argv)
194{
195 //Set App Directory
196 elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR);
197 elm_app_compile_data_dir_set(PACKAGE_DATA_DIR);
198 elm_app_info_set(elm_main, "sample", "images/bg.jpg");
199
200 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
201
202 init();
203
204 elm_run();
205
206 elm_shutdown();
207
208 return 0;
209}
210ELM_MAIN()