summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorcnook <kimcinoo@gmail.com>2012-03-30 09:56:22 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-03-30 09:56:22 +0000
commitddf7cfaae2fdaf1cdef947b4287c34bcf4819aad (patch)
treed4c9b96f553e9b1d064486e55ce1cdfff7b461dd /src/bin
parenta33705b823f8557bfd4673a8fbddee3b4bc88cf7 (diff)
From: cnook <kimcinoo@gmail.com>
Subject: [E-devel] [patch][elementary] elc_popup, restack issue The elc_popup does not raise to the top of its layer even though evas_object_raise() is called with the popup object. Because the elm_widget_resize_object_set(); makes notify object which is internally used in the popup have a smart parent. Ultimately, the callback function for EVAS_CALLBACK_RESTACK of the notify is not called. So I removed elm_widget_resize_object_set(); from the popup and added some implementations to show the popup properly. Moreover, I have added test code also in the attached patch. Then, please review the patch and give any feedbacks. Thanks. SVN revision: 69790
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/test_popup.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/bin/test_popup.c b/src/bin/test_popup.c
index bff893dce..b4effe714 100644
--- a/src/bin/test_popup.c
+++ b/src/bin/test_popup.c
@@ -8,6 +8,8 @@ static void
8_response_cb(void *data, Evas_Object *obj __UNUSED__, 8_response_cb(void *data, Evas_Object *obj __UNUSED__,
9 void *event_info __UNUSED__) 9 void *event_info __UNUSED__)
10{ 10{
11 Evas_Object *popup_data = evas_object_data_get(data, "im");
12 if (popup_data) evas_object_del(popup_data);
11 evas_object_hide(data); 13 evas_object_hide(data);
12 evas_object_del(data); 14 evas_object_del(data);
13} 15}
@@ -17,6 +19,8 @@ _block_clicked_cb(void *data __UNUSED__, Evas_Object *obj,
17 void *event_info __UNUSED__) 19 void *event_info __UNUSED__)
18{ 20{
19 printf("\nblock,clicked callback\n"); 21 printf("\nblock,clicked callback\n");
22 Evas_Object *popup_data = evas_object_data_get(obj, "im");
23 if (popup_data) evas_object_del(popup_data);
20 evas_object_del(obj); 24 evas_object_del(obj);
21} 25}
22 26
@@ -214,6 +218,55 @@ _popup_center_title_item_3button_cb(void *data, Evas_Object *obj __UNUSED__,
214 evas_object_show(popup); 218 evas_object_show(popup);
215} 219}
216 220
221static void
222_restack_btn_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__)
223{
224 Evas_Object *im;
225 char buf[PATH_MAX];
226 void *popup_data;
227
228 popup_data = evas_object_data_get(data, "im");
229 if (popup_data) return;
230
231 im = evas_object_image_filled_add(evas_object_evas_get(obj));
232 snprintf(buf, sizeof(buf), "%s/images/%s",
233 elm_app_data_dir_get(), "twofish.jpg");
234 evas_object_image_file_set(im, buf, NULL);
235 evas_object_move(im, 40, 40);
236 evas_object_resize(im, 320, 320);
237 evas_object_show(im);
238 evas_object_data_set((Evas_Object *)data, "im", im);
239
240 evas_object_raise((Evas_Object *)data);
241}
242
243static void
244_popup_center_title_text_2button_restack_cb(void *data, Evas_Object *obj __UNUSED__,
245 void *event_info __UNUSED__)
246{
247 Evas_Object *popup;
248 Evas_Object *btn, *btn2;
249
250 popup = elm_popup_add(data);
251 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
252 elm_object_text_set(popup, "When you click the 'Restack' button, "
253 "an image will be located under this popup");
254 elm_object_part_text_set(popup, "title,text", "Title");
255 btn = elm_button_add(popup);
256 elm_object_text_set(btn, "Restack");
257 elm_object_part_content_set(popup, "button1", btn);
258 evas_object_smart_callback_add(btn, "clicked", _restack_btn_clicked, popup);
259 evas_object_smart_callback_add(popup, "block,clicked", _block_clicked_cb,
260 NULL);
261
262 btn2 = elm_button_add(popup);
263 elm_object_text_set(btn2, "Close");
264 elm_object_part_content_set(popup, "button2", btn2);
265 evas_object_smart_callback_add(btn2, "clicked", _response_cb, popup);
266
267 evas_object_show(popup);
268}
269
217void 270void
218test_popup(void *data __UNUSED__, Evas_Object *obj __UNUSED__, 271test_popup(void *data __UNUSED__, Evas_Object *obj __UNUSED__,
219 void *event_info __UNUSED__) 272 void *event_info __UNUSED__)
@@ -252,6 +305,8 @@ test_popup(void *data __UNUSED__, Evas_Object *obj __UNUSED__,
252 NULL, _popup_center_title_content_3button_cb, win); 305 NULL, _popup_center_title_content_3button_cb, win);
253 elm_list_item_append(list, "popup-center-title + items + 3 buttons", NULL, 306 elm_list_item_append(list, "popup-center-title + items + 3 buttons", NULL,
254 NULL, _popup_center_title_item_3button_cb, win); 307 NULL, _popup_center_title_item_3button_cb, win);
308 elm_list_item_append(list, "popup-center-title + text + 2 buttons (check restacking)", NULL, NULL,
309 _popup_center_title_text_2button_restack_cb, win);
255 elm_list_go(list); 310 elm_list_go(list);
256 evas_object_show(list); 311 evas_object_show(list);
257 evas_object_show(win); 312 evas_object_show(win);