From: Enlightenment S. <no-...@en...> - 2011-12-21 06:35:29
|
Log: From: cnook <kim...@gm...> 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! :-) Author: raster Date: 2011-12-20 22:35:22 -0800 (Tue, 20 Dec 2011) New Revision: 66415 Trac: http://trac.enlightenment.org/e/changeset/66415 Modified: trunk/elementary/src/bin/test_ctxpopup.c trunk/elementary/src/lib/elc_ctxpopup.c Modified: trunk/elementary/src/bin/test_ctxpopup.c =================================================================== --- trunk/elementary/src/bin/test_ctxpopup.c 2011-12-21 06:18:25 UTC (rev 66414) +++ trunk/elementary/src/bin/test_ctxpopup.c 2011-12-21 06:35:22 UTC (rev 66415) @@ -37,9 +37,45 @@ } } +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 -_ctxpopup_item_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +_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 , Evas_Object *obj __UNUSED__, void *event_info) +{ printf("ctxpopup item selected: %s\n", elm_object_item_text_get(event_info)); } @@ -204,6 +240,8 @@ evas_object_move(ctxpopup, x, y); evas_object_show(ctxpopup); _print_current_dir(ctxpopup); + + evas_object_smart_callback_add(btn, "clicked", _btn_clicked, ctxpopup); } Modified: trunk/elementary/src/lib/elc_ctxpopup.c =================================================================== --- trunk/elementary/src/lib/elc_ctxpopup.c 2011-12-21 06:18:25 UTC (rev 66414) +++ trunk/elementary/src/lib/elc_ctxpopup.c 2011-12-21 06:35:22 UTC (rev 66415) @@ -119,6 +119,7 @@ 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 @@ } 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 @@ 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); |