seoz pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=937a77dfd2c36e5fa0baddd9638eafef1d99ed71

commit 937a77dfd2c36e5fa0baddd9638eafef1d99ed71
Author: Daniel Juyung Seo <juyung....@samsung.com>
Date:   Mon Nov 25 14:05:17 2013 +0900

    test_popup.c: added popup example which has a rectangle as its parent.
    
    This shows how the popup and its block event area size are decided.
---
 src/bin/test_popup.c | 39 +++++++++++++++++++++++++++++++++++++--
 1 file changed, 37 insertions(+), 2 deletions(-)

diff --git a/src/bin/test_popup.c b/src/bin/test_popup.c
index 40a0267..4c5de28 100644
--- a/src/bin/test_popup.c
+++ b/src/bin/test_popup.c
@@ -48,9 +48,10 @@ _restack_popup_close_cb(void *data, Evas_Object *obj 
EINA_UNUSED,
 }
 
 static void
-_block_clicked_cb(void *data EINA_UNUSED, Evas_Object *obj,
-                  void *event_info EINA_UNUSED)
+_block_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
 {
+   if (data)
+     evas_object_del(data);
    evas_object_del(obj);
 }
 
@@ -159,6 +160,36 @@ _popup_center_title_text_block_clicked_event_cb(void *data,
 }
 
 static void
+_popup_center_title_text_block_clicked_event_with_parent_cb(void *data,
+                                                            Evas_Object *obj 
EINA_UNUSED,
+                                                            void *event_info 
EINA_UNUSED)
+{
+   Evas_Object *bg, *popup;
+
+   bg = elm_bg_add(data);
+   elm_bg_color_set(bg, 255, 0, 0);
+   evas_object_resize(bg, 350, 200);
+   evas_object_move(bg, 100, 100);
+   evas_object_show(bg);
+
+   popup = elm_popup_add(bg);
+   evas_object_smart_callback_add(popup, "block,clicked",
+                                  _block_clicked_cb, bg);
+
+   // popup text
+   elm_object_text_set(popup, "This Popup has title area and content area. "
+                       "Its blocked event region is a small rectangle. "
+                       "When clicked on blocked event region, popup gets "
+                       "deleted");
+   // popup title
+   elm_object_part_text_set(popup, "title,text", "Title");
+
+   // popup show should be called after adding all the contents and the buttons
+   // of popup to set the focus into popup's contents correctly.
+   evas_object_show(popup);
+}
+
+static void
 _popup_bottom_title_text_3button_cb(void *data, Evas_Object *obj EINA_UNUSED,
                                     void *event_info EINA_UNUSED)
 {
@@ -529,6 +560,10 @@ test_popup(void *data EINA_UNUSED, Evas_Object *obj 
EINA_UNUSED,
                         "popup-center-title + text (block,clicked handling)",
                         NULL, NULL,
                         _popup_center_title_text_block_clicked_event_cb, win);
+   elm_list_item_append(list,
+                        "popup-center-title + text (block,clicked handling 
with parent)",
+                        NULL, NULL,
+                        
_popup_center_title_text_block_clicked_event_with_parent_cb, win);
    elm_list_item_append(list, "popup-bottom-title + text + 3 buttons", NULL,
                         NULL, _popup_bottom_title_text_3button_cb, win);
    elm_list_item_append(list, "popup-center-title + content + 3 buttons", NULL,

-- 


Reply via email to