summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Juyung Seo <seojuyung2@gmail.com>2015-02-27 01:03:06 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2015-02-27 01:03:06 +0900
commit1d57640164fe2c058b2eaf8d5511954156e65520 (patch)
treea6b82d048c37fd547d7dbd0b4c46c5761519d813
parent26ed01c438e960f3f6b68449473ee6622fc73ae4 (diff)
elm: Add content_set_unset sample.
-rw-r--r--.gitignore1
-rw-r--r--elm/Makefile8
-rw-r--r--elm/content_set_unset.c67
-rw-r--r--elm/content_set_unset.edc13
4 files changed, 88 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index d365a30..a1590dc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,6 +22,7 @@ elm/elm_event
22elm/profile 22elm/profile
23elm/finger 23elm/finger
24elm/scale 24elm/scale
25elm/content_set_unset
25ecore/idler-null 26ecore/idler-null
26ecore/shutdown-timer 27ecore/shutdown-timer
27ecore/loop-iterate 28ecore/loop-iterate
diff --git a/elm/Makefile b/elm/Makefile
index c08c6a6..6a8a808 100644
--- a/elm/Makefile
+++ b/elm/Makefile
@@ -1,4 +1,4 @@
1all: entry-crash toolbar entry-scrollable weight-align box event scale focus no_win entry_del size image_gif slider utf elm_event profile scale finger disable 1all: entry-crash toolbar entry-scrollable weight-align box event scale focus no_win entry_del size image_gif slider utf elm_event profile scale finger disable content_set_unset content_set_unset.edj
2 2
3entry-scrollable: entry-scrollable.c 3entry-scrollable: entry-scrollable.c
4 gcc entry-scrollable.c -o entry-scrollable `pkg-config --cflags --libs elementary` -g 4 gcc entry-scrollable.c -o entry-scrollable `pkg-config --cflags --libs elementary` -g
@@ -53,3 +53,9 @@ finger: finger.c
53 53
54disable: disable.c 54disable: disable.c
55 gcc disable.c -o disable `pkg-config --cflags --libs elementary` -g 55 gcc disable.c -o disable `pkg-config --cflags --libs elementary` -g
56
57content_set_unset: content_set_unset.c
58 gcc content_set_unset.c -o content_set_unset `pkg-config --cflags --libs elementary` -g
59
60content_set_unset.edj: content_set_unset.edc
61 edje_cc content_set_unset.edc
diff --git a/elm/content_set_unset.c b/elm/content_set_unset.c
new file mode 100644
index 0000000..387b5e8
--- /dev/null
+++ b/elm/content_set_unset.c
@@ -0,0 +1,67 @@
1/*
2 * gcc content_set_unset.c -o content_set_unset `pkg-config --cflags --libs elementary` -g
3 */
4#include <Elementary.h>
5
6static Evas_Object *bg[3];
7
8static void
9_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
10{
11 printf("obj %s(%p) is deleted.\n", (char *)data, obj);
12}
13
14static Eina_Bool
15_timer_cb(void *data)
16{
17 static int num = 1;
18
19 elm_layout_content_unset(data, "content");
20 elm_layout_content_set(data, "content", bg[num]);
21
22 num = (num + 1) % 3;
23
24 return ECORE_CALLBACK_RENEW;
25}
26
27EAPI_MAIN int
28elm_main(int argc, char **argv)
29{
30 Evas_Object *win = NULL, *edje = NULL;
31 Evas_Coord x = 0, y = 0, w = 0, h = 0;
32
33 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
34
35 win = elm_win_util_standard_add("main", "Main");
36 elm_win_autodel_set(win, EINA_TRUE);
37 evas_object_resize(win, 300, 400);
38 evas_object_show(win);
39
40 edje = elm_layout_add(win);
41 elm_layout_file_set(edje, "content_set_unset.edj", "main");
42 evas_object_size_hint_weight_set(edje, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
43 elm_win_resize_object_add(win, edje);
44 evas_object_show(edje);
45
46 bg[0] = elm_bg_add(win);
47 elm_bg_color_set(bg[0], 255, 0, 0);
48 evas_object_event_callback_add(bg[0], EVAS_CALLBACK_DEL, _del_cb, "bg");
49
50 bg[1] = elm_bg_add(win);
51 elm_bg_color_set(bg[1], 0, 255, 0);
52 evas_object_event_callback_add(bg[1], EVAS_CALLBACK_DEL, _del_cb, "bg2");
53
54 bg[2] = elm_bg_add(win);
55 elm_bg_color_set(bg[2], 0, 0, 255);
56 evas_object_event_callback_add(bg[2], EVAS_CALLBACK_DEL, _del_cb, "bg3");
57
58 //swallow
59 elm_layout_content_set(edje, "content", bg[0]);
60
61 ecore_timer_add(0.5, _timer_cb, edje);
62
63 elm_run();
64
65 return 0;
66}
67ELM_MAIN()
diff --git a/elm/content_set_unset.edc b/elm/content_set_unset.edc
new file mode 100644
index 0000000..cf35833
--- /dev/null
+++ b/elm/content_set_unset.edc
@@ -0,0 +1,13 @@
1collections {
2 group { name: "main";
3 parts {
4 part { name: "content";
5 type: SWALLOW;
6 description { state: "default" 0.0;
7 rel1.relative: 0.25 0.25;
8 rel2.relative: 0.75 0.75;
9 color: 255 255 0 255;
10 }
11 }
12 }
13}