summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Juyung Seo <juyung.seo@samsung.com>2014-11-19 21:47:18 +0900
committerDaniel Juyung Seo <juyung.seo@samsung.com>2014-11-19 21:47:18 +0900
commited7dc043d625c8f9633cca6997d5532823acb985 (patch)
treee057a443eea3ad5dd4f24ad630b3bc4d25ef51bb
parentb84402a0ee846d27eac4ed4c6325c17943a8d552 (diff)
edje: Add part swallow geometry sample.
-rw-r--r--.gitignore1
-rw-r--r--edje/Makefile7
-rw-r--r--edje/part_swallow_geometry.c68
-rw-r--r--edje/part_swallow_geometry.edc31
4 files changed, 106 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 92395b0..55bcc90 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,6 +37,7 @@ ecore/win_key_grab
37edje/propagate-event 37edje/propagate-event
38edje/onhold 38edje/onhold
39edje/toolbar_min_calc 39edje/toolbar_min_calc
40edje/part_swallow_geometry
40evas/premultiplied-color 41evas/premultiplied-color
41evas/preload 42evas/preload
42evas/smart-member 43evas/smart-member
diff --git a/edje/Makefile b/edje/Makefile
index 0e9f009..823372d 100644
--- a/edje/Makefile
+++ b/edje/Makefile
@@ -1,4 +1,4 @@
1all: propagate-event propagate-event.edj onhold onhold.edj border.edj toolbar-min-calc center-align.edj 1all: propagate-event propagate-event.edj onhold onhold.edj border.edj toolbar-min-calc center-align.edj part_swallow_geometry part_swallow_geometry.edj
2 2
3propagate-event: propagate-event.c 3propagate-event: propagate-event.c
4 gcc propagate-event.c -o propagate-event `pkg-config --cflags --libs elementary` -g 4 gcc propagate-event.c -o propagate-event `pkg-config --cflags --libs elementary` -g
@@ -20,3 +20,8 @@ toolbar-min-calc: toolbar-min-calc.c
20 20
21center-align.edj: center-align.edc 21center-align.edj: center-align.edc
22 edje_cc center-align.edc -id ../images 22 edje_cc center-align.edc -id ../images
23
24part_swallow_geometry: part_swallow_geometry.c
25 gcc part_swallow_geometry.c -o part_swallow_geometry `pkg-config --cflags --libs elementary` -g
26
27part_swallow_geometry.edj: part_swallow_geometry.edc
diff --git a/edje/part_swallow_geometry.c b/edje/part_swallow_geometry.c
new file mode 100644
index 0000000..4d726e9
--- /dev/null
+++ b/edje/part_swallow_geometry.c
@@ -0,0 +1,68 @@
1/*
2 * gcc part_swallow_geometry.c -o part_swallow_geometry `pkg-config --cflags --libs elementary` -g
3 */
4#include <Elementary.h>
5
6static void
7_bg_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
8{
9 Evas_Coord x = 0, y = 0, w = 0, h = 0;
10 evas_object_geometry_get(obj, &x, &y, &w, &h);
11 printf("[%f] resize: %d,%d %dx%d\n", ecore_loop_time_get(), x, y, w, h);
12}
13
14EAPI_MAIN int
15elm_main(int argc, char **argv)
16{
17 Evas_Object *win = NULL, *edje = NULL, *bg = NULL;
18 Evas_Coord x = 0, y = 0, w = 0, h = 0;
19
20 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
21
22 win = elm_win_util_standard_add("main", "Main");
23 elm_win_autodel_set(win, EINA_TRUE);
24 evas_object_resize(win, 300, 400);
25 evas_object_show(win);
26
27 edje = edje_object_add(evas_object_evas_get(win));
28 edje_object_file_set(edje, "part_swallow_geometry.edj", "main");
29 evas_object_size_hint_weight_set(edje, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
30 elm_win_resize_object_add(win, edje);
31 evas_object_show(edje);
32
33 bg = elm_bg_add(win);
34 elm_bg_color_set(bg, 255, 0, 0);
35 evas_object_event_callback_add(bg, EVAS_CALLBACK_RESIZE, _bg_resize_cb, NULL);
36
37 //before swallow
38 evas_object_geometry_get(bg, &x, &y, &w, &h);
39 printf("[%f] before swallow: %d,%d %dx%d\n", ecore_loop_time_get(), x, y, w, h);
40
41 //swallow
42 edje_object_part_swallow(edje, "content", bg);
43
44 //after swallow
45 evas_object_geometry_get(bg, &x, &y, &w, &h);
46 printf("[%f] before swallow: %d,%d %dx%d\n", ecore_loop_time_get(), x, y, w, h);
47
48 edje_object_part_geometry_get(edje, "content", &x, &y, &w, &h);
49 printf("[%f] edje part geometry: %d,%d %dx%d\n", ecore_loop_time_get(), x, y, w, h);
50
51 //text set
52 edje_object_part_text_set(edje, "text", "Size Test");
53 evas_object_geometry_get(bg, &x, &y, &w, &h);
54 printf("[%f] after text set: %d,%d %dx%d\n", ecore_loop_time_get(), x, y, w, h);
55
56 //text get
57 edje_object_part_text_get(edje, "text");
58 evas_object_geometry_get(bg, &x, &y, &w, &h);
59 printf("[%f] after text get: %d,%d %dx%d\n", ecore_loop_time_get(), x, y, w, h);
60
61 edje_object_part_geometry_get(edje, "text", &x, &y, &w, &h);
62 printf("[%f] edje text part geometry: %d,%d %dx%d\n", ecore_loop_time_get(), x, y, w, h);
63
64 elm_run();
65
66 return 0;
67}
68ELM_MAIN()
diff --git a/edje/part_swallow_geometry.edc b/edje/part_swallow_geometry.edc
new file mode 100644
index 0000000..c20c4cf
--- /dev/null
+++ b/edje/part_swallow_geometry.edc
@@ -0,0 +1,31 @@
1collections {
2 group { name: "main";
3 parts {
4 part { name: "text";
5 type: TEXT;
6 scale: 1;
7 effect: FAR_SOFT_SHADOW;
8 description { state: "default" 0.0;
9 rel1.relative: 0.0 0.0;
10 rel2.relative: 0.5 1.0;
11 color: 0 136 170 255;
12 color2: 0 136 170 50;
13 color3: 0 136 170 25;
14 text {
15 size: 25;
16 font: "Sans";
17 text: "Enventor";
18 align: 0.5 0.5;
19 }
20 }
21 }
22 part { name: "content";
23 type: SWALLOW;
24 description { state: "default" 0.0;
25 rel1.relative: 0.5 0.5;
26 rel2.relative: 1.0 1.0;
27 color: 255 255 0 255;
28 }
29 }
30 }
31} \ No newline at end of file