summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorChunEon Park <hermet@hermet.pe.kr>2012-04-02 01:48:25 +0000
committerChunEon Park <hermet@hermet.pe.kr>2012-04-02 01:48:25 +0000
commit8cf985d27a20292e971451d745169d5d2f0dc794 (patch)
tree484b2ff866e838cc3986708770d77d7ae47bb75d /src/bin
parent3fe38e7202f5058c3ea726cdfd4ced51d9cecafd (diff)
elementary/colorselector - updated for elm_colorselector_mode_set test
SVN revision: 69832
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/test_colorselector.c83
1 files changed, 74 insertions, 9 deletions
diff --git a/src/bin/test_colorselector.c b/src/bin/test_colorselector.c
index cd4be22be..a0a2051a0 100644
--- a/src/bin/test_colorselector.c
+++ b/src/bin/test_colorselector.c
@@ -5,7 +5,8 @@
5#ifndef ELM_LIB_QUICKLAUNCH 5#ifndef ELM_LIB_QUICKLAUNCH
6 6
7static void 7static void
8_colorselector_clicked_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__) 8_colorselector_clicked_cb(void *data, Evas_Object *obj,
9 void *event_info __UNUSED__)
9{ 10{
10 Evas_Object *re = data; 11 Evas_Object *re = data;
11 int r, g, b, a; 12 int r, g, b, a;
@@ -22,7 +23,8 @@ _colorselector_clicked_cb(void *data, Evas_Object *obj, void *event_info __UNUSE
22} 23}
23 24
24static void 25static void
25_colorpalette_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info) 26_colorpalette_clicked_cb(void *data, Evas_Object *obj __UNUSED__,
27 void *event_info)
26{ 28{
27 int r = 0, g = 0, b = 0 ,a = 0; 29 int r = 0, g = 0, b = 0 ,a = 0;
28 Elm_Object_Item *color_it = (Elm_Object_Item *) event_info; 30 Elm_Object_Item *color_it = (Elm_Object_Item *) event_info;
@@ -31,7 +33,8 @@ _colorpalette_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_in
31} 33}
32 34
33static void 35static void
34_colorpalette_longpressed_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) 36_colorpalette_longpressed_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__,
37 void *event_info)
35{ 38{
36 int r = 0,g = 0,b = 0 ,a = 0; 39 int r = 0,g = 0,b = 0 ,a = 0;
37 Elm_Object_Item *color_it = (Elm_Object_Item *) event_info; 40 Elm_Object_Item *color_it = (Elm_Object_Item *) event_info;
@@ -39,10 +42,40 @@ _colorpalette_longpressed_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__,
39 printf("\ncolor = %d-%d-%d-%d\n", r, g, b, a); 42 printf("\ncolor = %d-%d-%d-%d\n", r, g, b, a);
40} 43}
41 44
45static void
46_palette_cb(void *data, Evas_Object *obj __UNUSED__,
47 void *event_info __UNUSED__)
48{
49 Evas_Object *cs = data;
50 Evas_Object *win = evas_object_data_get(cs, "win");
51 elm_colorselector_mode_set(cs, ELM_COLORSELECTOR_PALETTE);
52 evas_object_resize(win, 320, 300);
53}
54
55static void
56_components_cb(void *data, Evas_Object *obj __UNUSED__,
57 void *event_info __UNUSED__)
58{
59 Evas_Object *cs = data;
60 Evas_Object *win = evas_object_data_get(cs, "win");
61 elm_colorselector_mode_set(cs, ELM_COLORSELECTOR_COMPONENTS);
62 evas_object_resize(win, 320, 350);
63}
64
65static void
66_both_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
67{
68 Evas_Object *cs = data;
69 Evas_Object *win = evas_object_data_get(cs, "win");
70 elm_colorselector_mode_set(cs, ELM_COLORSELECTOR_BOTH);
71 evas_object_resize(win, 320, 480);
72}
73
42void 74void
43test_colorselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 75test_colorselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__,
76 void *event_info __UNUSED__)
44{ 77{
45 Evas_Object *win, *bg, *bx, *cs, *fr, *re; 78 Evas_Object *win, *bg, *bx, *bx2, *cs, *fr, *re, *bt;
46 int r, g, b, a; 79 int r, g, b, a;
47 80
48 win = elm_win_add(NULL, "colorselector", ELM_WIN_BASIC); 81 win = elm_win_add(NULL, "colorselector", ELM_WIN_BASIC);
@@ -52,7 +85,6 @@ test_colorselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *eve
52 bg = elm_bg_add(win); 85 bg = elm_bg_add(win);
53 elm_win_resize_object_add(win, bg); 86 elm_win_resize_object_add(win, bg);
54 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 87 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
55 evas_object_color_set(bg, 255, 255, 255, 255);
56 evas_object_show(bg); 88 evas_object_show(bg);
57 89
58 bx = elm_box_add(win); 90 bx = elm_box_add(win);
@@ -61,19 +93,20 @@ test_colorselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *eve
61 evas_object_show(bx); 93 evas_object_show(bx);
62 94
63 fr = elm_frame_add(bx); 95 fr = elm_frame_add(bx);
64 evas_object_size_hint_weight_set(fr, 1.0, 0.5); 96 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0);
65 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); 97 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
66 elm_object_text_set(fr, "Color View"); 98 elm_object_text_set(fr, "Color View");
67 elm_box_pack_end(bx, fr); 99 elm_box_pack_end(bx, fr);
68 evas_object_show(fr); 100 evas_object_show(fr);
69 101
70 re = evas_object_rectangle_add(evas_object_evas_get(win)); 102 re = evas_object_rectangle_add(evas_object_evas_get(win));
103 evas_object_size_hint_min_set(re, 1, 100);
71 evas_object_show(re); 104 evas_object_show(re);
72 elm_object_content_set(fr, re); 105 elm_object_content_set(fr, re);
73 106
74 fr = elm_frame_add(bx); 107 fr = elm_frame_add(bx);
75 evas_object_size_hint_weight_set(fr, 1.0, 0); 108 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
76 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, 0); 109 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
77 elm_object_text_set(fr, "Color Selector"); 110 elm_object_text_set(fr, "Color Selector");
78 elm_box_pack_end(bx, fr); 111 elm_box_pack_end(bx, fr);
79 evas_object_show(fr); 112 evas_object_show(fr);
@@ -107,6 +140,7 @@ test_colorselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *eve
107 _colorpalette_clicked_cb, re); 140 _colorpalette_clicked_cb, re);
108 evas_object_smart_callback_add(cs, "color,item,longpressed", 141 evas_object_smart_callback_add(cs, "color,item,longpressed",
109 _colorpalette_longpressed_cb, re); 142 _colorpalette_longpressed_cb, re);
143 evas_object_data_set(cs, "win", win);
110 144
111 elm_colorselector_color_get(cs, &r, &g, &b, &a); 145 elm_colorselector_color_get(cs, &r, &g, &b, &a);
112 /* Fix Alpha pre multiplication by edje */ 146 /* Fix Alpha pre multiplication by edje */
@@ -115,6 +149,37 @@ test_colorselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *eve
115 b = (b * a) / 255; 149 b = (b * a) / 255;
116 evas_object_color_set(re, r, g, b, a); 150 evas_object_color_set(re, r, g, b, a);
117 151
152 bx2 = elm_box_add(bx);
153 elm_box_horizontal_set(bx2, EINA_TRUE);
154 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0);
155 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
156 evas_object_show(bx2);
157 elm_box_pack_end(bx, bx2);
158
159 bt = elm_button_add(bx2);
160 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
161 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
162 evas_object_smart_callback_add(bt, "clicked", _palette_cb, cs);
163 elm_object_text_set(bt, "Palette");
164 evas_object_show(bt);
165 elm_box_pack_end(bx2, bt);
166
167 bt = elm_button_add(bx2);
168 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
169 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
170 evas_object_smart_callback_add(bt, "clicked", _components_cb, cs);
171 elm_object_text_set(bt, "Components");
172 evas_object_show(bt);
173 elm_box_pack_end(bx2, bt);
174
175 bt = elm_button_add(bx2);
176 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
177 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
178 evas_object_smart_callback_add(bt, "clicked", _both_cb, cs);
179 elm_object_text_set(bt, "Both");
180 evas_object_show(bt);
181 elm_box_pack_end(bx2, bt);
182
118 evas_object_resize(win, 320, 480); 183 evas_object_resize(win, 320, 480);
119 evas_object_show(win); 184 evas_object_show(win);
120} 185}