From: Shinwoo Kim Date: Tue, 20 Dec 2011 05:58:03 +0000 (+0900) Subject: [*][ctxpopup] add box for setting user content X-Git-Tag: REL_F_I9500_20120125_1~35^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0a7ed03864e5f953dc0985a8cb40aa1a04da3d54;p=framework%2Fuifw%2Felementary.git [*][ctxpopup] add box for setting user content Change-Id: Ia61c143090e95dfa0a84c982af51101d1702224f --- diff --git a/src/lib/elc_ctxpopup.c b/src/lib/elc_ctxpopup.c index 78903c0..28c7338 100644 --- a/src/lib/elc_ctxpopup.c +++ b/src/lib/elc_ctxpopup.c @@ -64,7 +64,9 @@ static void _ctxpopup_changed_size_hints(void *data __UNUSED__, void *event_info __UNUSED__); static Elm_Ctxpopup_Direction _calc_base_geometry(Evas_Object *obj, Evas_Coord_Rectangle *rect); -static void _update_arrow(Evas_Object *obj, Elm_Ctxpopup_Direction dir); +static void _update_arrow(Evas_Object *obj, + Elm_Ctxpopup_Direction dir, + Evas_Coord_Rectangle rect); static void _sizing_eval(Evas_Object *obj); static void _shift_base_by_arrow(Evas_Object *arrow, Elm_Ctxpopup_Direction dir, @@ -105,6 +107,10 @@ static void _ctxpopup_hide(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _content_resize(void *data, + Evas *e, + Evas_Object *obj, + void *event_info); static void _scroller_resize(void *data, Evas *e, Evas_Object *obj, @@ -484,11 +490,11 @@ _calc_base_geometry(Evas_Object *obj, Evas_Coord_Rectangle *rect) } static void -_update_arrow(Evas_Object *obj, Elm_Ctxpopup_Direction dir) +_update_arrow(Evas_Object *obj, Elm_Ctxpopup_Direction dir, + Evas_Coord_Rectangle base_size) { Evas_Coord x, y; Evas_Coord_Rectangle arrow_size; - Evas_Coord_Rectangle base_size; Widget_Data *wd; double drag; @@ -498,8 +504,6 @@ _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); edje_object_part_unswallow(wd->base, wd->arrow); @@ -675,7 +679,7 @@ _sizing_eval(Evas_Object *obj) if (!wd->horizontal && !wd->content) _compress_item(obj); - _update_arrow(obj, wd->dir); + _update_arrow(obj, wd->dir, rect); _shift_base_by_arrow(wd->arrow, wd->dir, &rect); //resize scroller according to final size. @@ -723,6 +727,8 @@ _del_pre_hook(Evas_Object *obj) evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_RESIZE, _parent_resize, obj); + evas_object_event_callback_del_full(wd->box, EVAS_CALLBACK_RESIZE, + _content_resize, obj); _parent_cut_off(obj); } @@ -821,6 +827,7 @@ _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) { ELM_CHECK_WIDTYPE(obj, widtype); + Evas_Coord min_w = -1, min_h = -1; Widget_Data *wd; @@ -832,14 +839,29 @@ _content_set_hook(Evas_Object *obj, const char *part, if (wd->items) elm_ctxpopup_clear(obj); if (wd->content) evas_object_del(wd->content); - evas_object_event_callback_add(content, EVAS_CALLBACK_DEL, _content_del, - obj); + //Use Box + wd->box = elm_box_add(obj); + evas_object_size_hint_weight_set(wd->box, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_fill_set(content, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_show(content); + evas_object_size_hint_min_get(content, &min_w, &min_h); + evas_object_size_hint_min_set(wd->box, min_w, min_h); + elm_box_pack_end(wd->box, content); - elm_widget_sub_object_add(obj, content); - edje_object_part_swallow(wd->base, "elm.swallow.content", content); - edje_object_message_signal_process(wd->base); + evas_object_event_callback_add(wd->box, EVAS_CALLBACK_RESIZE, + _content_resize, obj); + evas_object_event_callback_add(wd->box, EVAS_CALLBACK_DEL, + _content_del, obj); + + elm_widget_sub_object_add(obj, wd->box); + edje_object_part_swallow(wd->base, "elm.swallow.content", wd->box); wd->content = content; + wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; if (wd->visible) _sizing_eval(obj); @@ -857,17 +879,19 @@ _content_unset_hook(Evas_Object *obj, const char *part) if (!wd) return NULL; content = wd->content; - if (!content) return NULL; + if (!content || !wd->box) return NULL; - edje_object_part_unswallow(wd->base, content); - elm_widget_sub_object_del(obj, content); - evas_object_event_callback_del(content, EVAS_CALLBACK_DEL, _content_del); + edje_object_part_unswallow(wd->base, wd->box); + elm_widget_sub_object_del(obj, wd->box); + evas_object_event_callback_del(wd->box, EVAS_CALLBACK_DEL, _content_del); edje_object_signal_emit(wd->base, "elm,state,content,disable", "elm"); + evas_object_del(wd->box); + wd->box = NULL; wd->content = NULL; + wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; return content; - } static Evas_Object * @@ -1057,6 +1081,16 @@ _ctxpopup_hide(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, } static void +_content_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (!wd) return; + elm_box_recalculate(wd->box); + _sizing_eval(data); +} + +static void _scroller_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) { diff --git a/src/lib/elm_diskselector.c b/src/lib/elm_diskselector.c index 88e6165..47351eb 100644 --- a/src/lib/elm_diskselector.c +++ b/src/lib/elm_diskselector.c @@ -167,7 +167,7 @@ _theme_data_get(Widget_Data *wd) } str = edje_object_data_get(wd->right_blank, "min_width"); - if (str) wd->minw = MAX(-1, atoi(str)); + if (str) wd->minw = MAX(-1, atoi(str)) * elm_scale_get(); else { parent = elm_widget_parent_widget_get(wd->self); @@ -176,7 +176,7 @@ _theme_data_get(Widget_Data *wd) } str = edje_object_data_get(wd->right_blank, "min_height"); - if (str) wd->minh = MAX(-1, atoi(str)); + if (str) wd->minh = MAX(-1, atoi(str)) * elm_scale_get(); else wd->minh = -1; }