From: raster Date: Thu, 2 Jun 2011 06:35:20 +0000 (+0000) Subject: From: cnook X-Git-Tag: REL_F_I9500_20120323_1~17^2~2644 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5356a169983d935701e1621ffbf8c515e7f5f5e6;p=framework%2Fuifw%2Felementary.git From: cnook Subject: [E-devel] [Patch][CtxPopup] Add Arrow on the drag-able area of Base If CtxPopup has elm_slider for content, the elm_slider indicator is covered by CtxPopup arrow. So, I have made a patch for resolving this issue. As the title the arrow will be swallowed in the base. Even though user uses his/her own style, the attached patch will work properly. Sincerely, Shinwoo Kim. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@59890 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/data/themes/default.edc b/data/themes/default.edc index 1bb7827..d2cc8c2 100644 --- a/data/themes/default.edc +++ b/data/themes/default.edc @@ -7912,6 +7912,158 @@ collections { image: "bt_shine.png" COMP; } parts { + part { name: "arrow_area_left"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + min: 40 0; + fixed: 1 1; + align: 1 0.5; + rel1 { + to_y: "base"; + } + rel2 { + relative:0 1; + to:"base"; + } + } + } + part { name: "arrow_area_right"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + min: 40 0; + fixed: 1 1; + align: 0 0.5; + rel1 { + relative: 1 0; + to:"base"; + } + rel2 { + to_y: "base"; + } + } + } + part { name: "arrow_area_up"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + min: 0 40; + fixed: 1 1; + align: 0.5 1; + rel1 { + to_x: "base"; + } + rel2 { + relative: 1 0; + to:"base"; + } + } + } + part { name: "arrow_area_down"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + min: 0 40; + fixed: 1 1; + align: 0.5 0; + rel1 { + relative: 0 1; + to:"base"; + } + rel2 { + to_x: "base"; + } + } + } + part { name: "elm.swallow.arrowUp"; + type: SWALLOW; + mouse_events: 0; + scale: 1; + dragable { + x: 1 1 0; + y: 1 1 0; + confine: "arrow_area_up"; + } + description { + state: "default" 0.0; + min: 40 40; + fixed: 1 1; + visible: 1; + align: 0.5 1; + rel2 { + relative: 1 0; + to: "arrow_area_up"; + } + } + } + part { name: "elm.swallow.arrowDown"; + type: SWALLOW; + mouse_events: 0; + scale: 1; + dragable { + x: 1 1 0; + y: 1 1 0; + confine: "arrow_area_down"; + } + description { + state: "default" 0.0; + min: 40 40; + fixed: 1 1; + visible: 1; + align: 0.5 0; + rel1 { + relative: 1 1; + to: "arrow_area_down"; + } + } + } + part { name: "elm.swallow.arrowLeft"; + type: SWALLOW; + mouse_events: 0; + scale: 1; + dragable { + x: 1 1 0; + y: 1 1 0; + confine: "arrow_area_left"; + } + description { + state: "default" 0.0; + min: 40 40; + fixed: 1 1; + visible: 1; + align: 1 0.5; + rel2 { + relative: 0 1; + to: "arrow_area_left"; + } + } + } + part { name: "elm.swallow.arrowRight"; + type: SWALLOW; + mouse_events: 0; + scale: 1; + dragable { + x: 1 1 0; + y: 1 1 0; + confine: "arrow_area_right"; + } + description { + state: "default" 0.0; + min: 40 40; + fixed: 1 1; + visible: 1; + align: 0 0.5; + rel1 { + relative: 1 0; + to: "arrow_area_right"; + } + } + } part { name: "base"; scale: 1; description { state: "default" 0.0; diff --git a/src/lib/elc_ctxpopup.c b/src/lib/elc_ctxpopup.c index 42a41db..14b4f7c 100644 --- a/src/lib/elc_ctxpopup.c +++ b/src/lib/elc_ctxpopup.c @@ -468,6 +468,7 @@ _update_arrow(Evas_Object *obj, Elm_Ctxpopup_Direction dir) { Evas_Coord x, y; Evas_Coord_Rectangle arrow_size; + Evas_Coord_Rectangle base_size; Widget_Data *wd; wd = elm_widget_data_get(obj); @@ -476,33 +477,85 @@ _update_arrow(Evas_Object *obj, Elm_Ctxpopup_Direction dir) evas_object_geometry_get(obj, &x, &y, NULL, NULL); evas_object_geometry_get(wd->arrow, NULL, NULL, &arrow_size.w, &arrow_size.h); + evas_object_geometry_get(wd->base, &base_size.x, &base_size.y, + &base_size.w, &base_size.h); switch (dir) { case ELM_CTXPOPUP_DIRECTION_LEFT: edje_object_signal_emit(wd->arrow, "elm,state,left", "elm"); + + // if user does not use dragable part arrow_size.y = (y - (arrow_size.h * 0.5)); arrow_size.x = x; + + edje_object_part_swallow(wd->base, "elm.swallow.arrowLeft", wd->arrow); + if (base_size.h > 0) + { + if (y - base_size.y < 0) y = 0; + else if (y > base_size.y + base_size.h) y = base_size.h; + else y = y - base_size.y; + edje_object_part_drag_value_set(wd->base, "elm.swallow.arrowLeft", 0.5, + (double) (y) / (double) (base_size.h)); + } break; case ELM_CTXPOPUP_DIRECTION_RIGHT: edje_object_signal_emit(wd->arrow, "elm,state,right", "elm"); + + // if user does not use dragable part arrow_size.y = (y - (arrow_size.h * 0.5)); arrow_size.x = (x - arrow_size.w); + + edje_object_part_swallow(wd->base, "elm.swallow.arrowRight", wd->arrow); + if (base_size.h > 0) + { + if (y -base_size.y < 0) y = 0; + else if (y > base_size.y + base_size.h) y = base_size.h; + else y = y - base_size.y; + edje_object_part_drag_value_set(wd->base, "elm.swallow.arrowRight", 0.5, + (double) (y) / (double) (base_size.h)); + } break; case ELM_CTXPOPUP_DIRECTION_UP: edje_object_signal_emit(wd->arrow, "elm,state,top", "elm"); + + // if user does not use dragable part arrow_size.x = (x - (arrow_size.w * 0.5)); arrow_size.y = y; + + edje_object_part_swallow(wd->base, "elm.swallow.arrowUp", wd->arrow); + if (base_size.w > 0) + { + if (x - base_size.x < 0) x = 0; + else if (x > base_size.x + base_size.w) x = base_size.w; + else x = x - base_size.x; + edje_object_part_drag_value_set(wd->base, "elm.swallow.arrowUp", + (double) (x) / (double) (base_size.w), 0.5); + } break; case ELM_CTXPOPUP_DIRECTION_DOWN: edje_object_signal_emit(wd->arrow, "elm,state,bottom", "elm"); + + // if user does not use dragable part arrow_size.x = (x - (arrow_size.w * 0.5)); arrow_size.y = (y - arrow_size.h); + + edje_object_signal_emit(wd->arrow, "elm,state,bottom", "elm"); + edje_object_part_swallow(wd->base, "elm.swallow.arrowDown", wd->arrow); + if (base_size.w > 0) + { + if (x - base_size.x < 0) x = 0; + else if (x > base_size.x + base_size.w) x = base_size.w; + else x = x - base_size.x; + edje_object_part_drag_value_set(wd->base, "elm.swallow.arrowDown", + (double) (x) / (double) (base_size.w), 0.5); + } break; default: break; } + // if user does not use dragable part evas_object_move(wd->arrow, arrow_size.x, arrow_size.y); }