From: cnook <kimcinoo@gmail.com>
authorcnook <kimcinoo@gmail.com>
Wed, 21 Dec 2011 06:35:22 +0000 (06:35 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Wed, 21 Dec 2011 06:35:22 +0000 (06:35 +0000)
Subject: [E-devel] [Patch] elc_ctxpopup, add restacking feature

I have attached two files, one is the patch(*.diff) for adding
restacking feature to the ctxpopup.
The other is test example(*.TEST_EXAMPLE). You can test on the
elementary_test > ctxpopup > "Ctxpopup with user content"
And click the button which is labeled "Enlightenment". Then label will
overlap the ctxpopup.. The ctxpopup will raise in a little time.
Please review the patch and if there is no problem, please throw the
test example away! :-)

SVN revision: 66415

src/bin/test_ctxpopup.c
src/lib/elc_ctxpopup.c

index 01189b5..20ae019 100644 (file)
@@ -37,8 +37,44 @@ _print_current_dir(Evas_Object *obj)
      }
 }
 
+static Eina_Bool
+_ctxpopup_raise_timer_cb(void *data)
+{
+   printf("Timer Called\n");
+   Evas_Object *ctxpopup = (Evas_Object *) data;
+   evas_object_raise(ctxpopup);
+   return EINA_FALSE;
+}
+
+static void
+_btn_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+   printf("Button Clicked\n");
+   Evas_Object *ctxpopup = (Evas_Object *) data;
+   Evas_Object *lb = elm_label_add(ctxpopup);
+   elm_label_line_wrap_set(lb, ELM_WRAP_CHAR);
+   elm_object_text_set(lb,
+                       "<b>"
+                       "This is more text designed to line-wrap here as "
+                       "This object is resized horizontally. As it is "
+                       "resized vertically though, nothing should change. "
+                       "The amount of space allocated vertically should "
+                       "change as horizontal size changes."
+                       "This is more text designed to line-wrap here as "
+                       "This object is resized horizontally. As it is "
+                       "resized vertically though, nothing should change. "
+                       "The amount of space allocated vertically should "
+                       "change as horizontal size changes."
+                       "</b>"
+                       );
+   evas_object_resize(lb, 200, 400);
+   evas_object_show(lb);
+
+   ecore_timer_add(1.5, _ctxpopup_raise_timer_cb, ctxpopup);
+}
+
 static void
-_ctxpopup_item_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+_ctxpopup_item_cb(void *data , Evas_Object *obj __UNUSED__, void *event_info)
 {
    printf("ctxpopup item selected: %s\n",
    elm_object_item_text_get(event_info));
@@ -204,6 +240,8 @@ _list_item_cb5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
    evas_object_move(ctxpopup, x, y);
    evas_object_show(ctxpopup);
    _print_current_dir(ctxpopup);
+
+   evas_object_smart_callback_add(btn, "clicked", _btn_clicked, ctxpopup);
 }
 
 
index a24c155..b6e4a81 100644 (file)
@@ -119,6 +119,7 @@ static void _ctxpopup_move(void *data,
                            Evas *e,
                            Evas_Object *obj,
                            void *event_info);
+static void _restack(void *data, Evas *e, Evas_Object *obj, void *event_info);
 static void _item_select_cb(void *data, Evas_Object *obj,
                             const char *emission,
                             const char *source);
@@ -1103,6 +1104,17 @@ _ctxpopup_move(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
 }
 
 static void
+_restack(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   evas_object_layer_set(wd->bg,
+                         evas_object_layer_get(obj));
+   evas_object_layer_set(wd->base,
+                         evas_object_layer_get(obj));
+}
+
+static void
 _item_select_cb(void *data, Evas_Object *obj __UNUSED__,
                 const char *emission __UNUSED__, const char *source __UNUSED__)
 {
@@ -1272,6 +1284,7 @@ elm_ctxpopup_add(Evas_Object *parent)
                                   NULL);
    evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _ctxpopup_move,
                                   NULL);
+   evas_object_event_callback_add(obj, EVAS_CALLBACK_RESTACK, _restack, obj);
    evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
    evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
    evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);