On Thu, Mar 22, 2012 at 7:14 AM, Enlightenment SVN < no-re...@enlightenment.org> wrote:
> Log: > From: cnook <kimci...@gmail.com> > Subject: [E-devel] [Patch][elementary] elc_ctxpopup using elm_list > internally. > > The patch is for using elm_list as a item controller of elc_ctxpopup. > I have learned that there was an opinion to change the internal > structure > of ctxpopup using the list. > It would be able to match up to your expectation. but it is just a draft > version of using list in ctxpopup. > So, It would be pretty good to me if you give any feedback on this. > Thanks. > > My 1st rewrite of the 1st drop-in of this widget used list as its building block. The widget was then renamed and reverted back to what it looked like originally in code, so I stopped following it. > > > > Author: raster > Date: 2012-03-22 03:14:58 -0700 (Thu, 22 Mar 2012) > New Revision: 69561 > Trac: http://trac.enlightenment.org/e/changeset/69561 > > Modified: > trunk/elementary/src/lib/elc_ctxpopup.c > > Modified: trunk/elementary/src/lib/elc_ctxpopup.c > =================================================================== > --- trunk/elementary/src/lib/elc_ctxpopup.c 2012-03-22 10:10:29 UTC > (rev 69560) > +++ trunk/elementary/src/lib/elc_ctxpopup.c 2012-03-22 10:14:58 UTC > (rev 69561) > @@ -7,9 +7,7 @@ > struct _Elm_Ctxpopup_Item > { > ELM_WIDGET_ITEM; > - const char *label; > - Evas_Object *icon; > - Evas_Smart_Cb func; > + Elm_Object_Item *list_item; > }; > > struct _Widget_Data > @@ -17,16 +15,15 @@ > Evas_Object *parent; > Evas_Object *base; > Evas_Object *content; > + Evas_Object *list; > Evas_Object *box; > Evas_Object *arrow; > - Evas_Object *scr; > Evas_Object *bg; > - Eina_List *items; > Elm_Ctxpopup_Direction dir; > Elm_Ctxpopup_Direction dir_priority[4]; > - Evas_Coord max_sc_w, max_sc_h; > Eina_Bool horizontal:1; > Eina_Bool visible:1; > + Eina_Bool list_visible:1; > Eina_Bool finished:1; > }; > > @@ -36,7 +33,6 @@ > static void _freeze_off(void *data, Evas_Object *obj, void *event_info); > static void _hold_on(void *data, Evas_Object *obj, void *event_info); > static void _hold_off(void *data, Evas_Object *obj, void *event_info); > -static void _scroller_size_reset(Widget_Data *wd); > static void _on_focus_hook(void *data, Evas_Object *obj); > static Eina_Bool _event_hook(Evas_Object *obj, > Evas_Object *src, > @@ -55,7 +51,6 @@ > Evas *e, > Evas_Object *obj, > void *event_info); > -static void _item_sizing_eval(Elm_Ctxpopup_Item *item); > static void _adjust_pos_x(Evas_Coord_Point *pos, > Evas_Coord_Point *base_size, > Evas_Coord_Rectangle *hover_area); > @@ -118,28 +113,16 @@ > Evas *e, > Evas_Object *obj, > void *event_info); > -static void _scroller_resize(void *data, > - Evas *e, > - Evas_Object *obj, > - void *event_info); > 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); > -static void _item_icon_set(Elm_Ctxpopup_Item *item, Evas_Object *icon); > -static void _item_label_set(Elm_Ctxpopup_Item *item, const char *label); > -static void _item_new(Elm_Ctxpopup_Item *item, char *group_name); > static void _content_del(void *data, > Evas *e, > Evas_Object *obj, > void *event_info); > static void _list_del(Widget_Data *wd); > -static void _list_new(Evas_Object *obj); > -static void _remove_items(Widget_Data * wd); > static void _disable_hook(Evas_Object *obj); > static void _signal_emit_hook(Evas_Object *obj, const char *emission, > const char *source); > static void _signal_callback_add_hook(Evas_Object *obj, const char > *emission, const char *source, Edje_Signal_Cb func_cb, void *data); > @@ -158,8 +141,8 @@ > { > Widget_Data *wd = elm_widget_data_get(obj); > > - if ((!wd) || (!wd->scr)) return; > - elm_object_scroll_freeze_push(wd->scr); > + if ((!wd) || (!wd->list)) return; > + elm_widget_scroll_freeze_push(wd->list); > } > > static void > @@ -168,8 +151,8 @@ > { > Widget_Data *wd = elm_widget_data_get(obj); > > - if ((!wd) || (!wd->scr)) return; > - elm_object_scroll_freeze_pop(wd->scr); > + if ((!wd) || (!wd->list)) return; > + elm_widget_scroll_freeze_pop(wd->list); > } > > static void > @@ -177,8 +160,8 @@ > { > Widget_Data *wd = elm_widget_data_get(obj); > > - if ((!wd) || (!wd->scr)) return; > - elm_object_scroll_hold_push(wd->scr); > + if ((!wd) || (!wd->list)) return; > + elm_widget_scroll_hold_push(wd->list); > } > > static void > @@ -186,24 +169,17 @@ > { > Widget_Data *wd = elm_widget_data_get(obj); > > - if ((!wd) || (!wd->scr)) return; > - elm_object_scroll_hold_pop(wd->scr); > + if ((!wd) || (!wd->list)) return; > + elm_widget_scroll_hold_pop(wd->list); > } > > static void > -_scroller_size_reset(Widget_Data *wd) > -{ > - wd->finished = EINA_FALSE; > - wd->max_sc_h = -1; > - wd->max_sc_w = -1; > -} > - > -static void > _on_focus_hook(void *data __UNUSED__, Evas_Object *obj) > { > Widget_Data *wd = elm_widget_data_get(obj); > if (!wd) return; > > + > if (elm_widget_focus_get(obj)) > { > //FIXME: > @@ -286,7 +262,6 @@ > > if (wd->visible) > { > - _scroller_size_reset(wd); > _sizing_eval(obj); > } > } > @@ -301,19 +276,6 @@ > } > > static void > -_item_sizing_eval(Elm_Ctxpopup_Item *item) > -{ > - Evas_Coord min_w = -1, min_h = -1, max_w = -1, max_h = -1; > - > - if (!item) return; > - > - edje_object_size_min_restricted_calc(VIEW(item), &min_w, &min_h, min_w, > - min_h); > - evas_object_size_hint_min_set(VIEW(item), min_w, min_h); > - evas_object_size_hint_max_set(VIEW(item), max_w, max_h); > -} > - > -static void > _adjust_pos_x(Evas_Coord_Point *pos, Evas_Coord_Point *base_size, > Evas_Coord_Rectangle *hover_area) > { > @@ -394,6 +356,7 @@ > if ((max_size.x > 0) && (base_size.x > max_size.x)) > base_size.x = max_size.x; > > + > //Limit to Min Size > evas_object_size_hint_min_get(obj, &min_size.x, &min_size.y); > > @@ -453,7 +416,7 @@ > { > Evas_Coord length[2]; > > - if(!wd->horizontal) > + if (!wd->horizontal) > { > length[0] = pos.y - hover_area.y; > length[1] = (hover_area.y + hover_area.h) - pos.y; > @@ -538,7 +501,7 @@ > evas_object_geometry_get(wd->arrow, NULL, NULL, &arrow_size.w, > &arrow_size.h); > > - edje_object_part_unswallow(wd->base, wd->arrow); > + //edje_object_part_unswallow(wd->base, wd->arrow); > > switch (dir) > { > @@ -622,6 +585,9 @@ > default: > break; > } > + > + //should be here for getting accurate geometry value > + evas_object_smart_calculate(wd->base); > } > > static void > @@ -659,7 +625,8 @@ > Widget_Data *wd; > > wd = elm_widget_data_get(obj); > - if (wd->visible) return; > + if (!wd->visible) return; > + if ((wd->list) && (!wd->list_visible)) return; > > switch (dir) > { > @@ -678,60 +645,39 @@ > default: > break; > } > + edje_object_signal_emit(wd->bg, "elm,state,show", "elm"); > + edje_object_signal_emit(wd->base, "elm,state,show", "elm"); > } > > static void > _sizing_eval(Evas_Object *obj) > { > Widget_Data *wd; > - Eina_List *elist; > - Elm_Ctxpopup_Item *item; > Evas_Coord_Rectangle rect = { 0, 0, 1, 1 }; > - Evas_Coord_Point box_size = { 0, 0 }; > - Evas_Coord_Point _box_size = { 0, 0 }; > + Evas_Coord_Point list_size = { 0, 0 }; > > wd = elm_widget_data_get(obj); > if (!wd) return; > > - //Box, Scroller > - EINA_LIST_FOREACH(wd->items, elist, item) > - { > - _item_sizing_eval(item); > - evas_object_size_hint_min_get(VIEW(item), &_box_size.x, > &_box_size.y); > - if (!wd->horizontal) > - { > - if (_box_size.x > box_size.x) > - box_size.x = _box_size.x; > - if (_box_size.y != -1) > - box_size.y += _box_size.y; > - } > - else > - { > - if (_box_size.x != -1) > - box_size.x += _box_size.x; > - if (_box_size.y > box_size.y) > - box_size.y = _box_size.y; > - } > - } > - > - if (!wd->content) > - { > - evas_object_size_hint_min_set(wd->box, box_size.x, box_size.y); > - evas_object_size_hint_min_set(wd->scr, box_size.x, box_size.y); > - } > - > //Base > wd->dir = _calc_base_geometry(obj, &rect); > - _show_signal_emit(obj, wd->dir); > _update_arrow(obj, wd->dir, rect); > _shift_base_by_arrow(wd->arrow, wd->dir, &rect); > > - //resize scroller according to final size. > - if (!wd->content) > - evas_object_smart_calculate(wd->scr); > + if ((wd->list) && (wd->list_visible)) > + { > + evas_object_geometry_get(wd->list, 0, 0, &list_size.x, > &list_size.y); > + if ((list_size.x >= rect.w) || (list_size.y >= rect.h)) > + { > + elm_list_mode_set(wd->list, ELM_LIST_COMPRESS); > + evas_object_size_hint_min_set(wd->box, rect.w, rect.h); > + evas_object_size_hint_min_set(obj, rect.w, rect.h); > + } > + } > > evas_object_move(wd->base, rect.x, rect.y); > evas_object_resize(wd->base, rect.w, rect.h); > + _show_signal_emit(obj, wd->dir); > } > > static void > @@ -741,7 +687,6 @@ > Evas_Coord arrow_w, arrow_h; > > evas_object_geometry_get(arrow, NULL, NULL, &arrow_w, &arrow_h); > - > switch (dir) > { > case ELM_CTXPOPUP_DIRECTION_RIGHT: > @@ -793,8 +738,6 @@ > _theme_hook(Evas_Object *obj) > { > Widget_Data *wd; > - Eina_List *elist; > - Elm_Ctxpopup_Item *item; > Eina_Bool rtl; > > wd = elm_widget_data_get(obj); > @@ -810,43 +753,18 @@ > _elm_theme_object_set(obj, wd->arrow, "ctxpopup", "arrow", > elm_widget_style_get(obj)); > > - //Items > - EINA_LIST_FOREACH(wd->items, elist, item) > + if (wd->list) > { > - edje_object_mirrored_set(VIEW(item), rtl); > - > - if (item->label && item->icon) > - _elm_theme_object_set(obj, VIEW(item), "ctxpopup", > - "icon_text_style_item", > - elm_widget_style_get(obj)); > - else if (item->label) > - _elm_theme_object_set(obj, VIEW(item), "ctxpopup", > "text_style_item", > - elm_widget_style_get(obj)); > - else if (item->icon) > - _elm_theme_object_set(obj, VIEW(item), "ctxpopup", > "icon_style_item", > - elm_widget_style_get(obj)); > - if (item->label) > - edje_object_part_text_set(VIEW(item), "elm.text", item->label); > - > - if (elm_widget_item_disabled_get(item)) > - edje_object_signal_emit(VIEW(item), "elm,state,disabled", > "elm"); > - > - edje_object_message_signal_process(VIEW(item)); > - } > - > - if (wd->scr) > - { > if (!strncmp(elm_object_style_get(obj), "default", > strlen("default"))) > - elm_object_style_set(wd->scr, "ctxpopup"); > + elm_object_style_set(wd->list, "ctxpopup"); > else > - elm_object_style_set(wd->scr, elm_object_style_get(obj)); > + elm_object_style_set(wd->list, elm_object_style_get(obj)); > } > > wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; > > if (wd->visible) > { > - _scroller_size_reset(wd); > _sizing_eval(obj); > } > } > @@ -859,12 +777,12 @@ > > Widget_Data *wd; > > - if (part && strcmp(part, "default")) return; > + if ((part) && (strcmp(part, "default"))) return; > > wd = elm_widget_data_get(obj); > if ((!wd) || (!content)) return; > > - if (wd->items) elm_ctxpopup_clear(obj); > + //TODO: wd->list > if (wd->content) evas_object_del(wd->content); > > //Use Box > @@ -902,12 +820,12 @@ > > Widget_Data *wd; > Evas_Object *content; > - if (part && strcmp(part, "default")) return NULL; > + if ((part) && (strcmp(part, "default"))) return NULL; > wd = elm_widget_data_get(obj); > if (!wd) return NULL; > > content = wd->content; > - if (!content || !wd->box) return NULL; > + if ((!content) || (!wd->box)) return NULL; > > edje_object_part_unswallow(wd->base, wd->box); > elm_widget_sub_object_del(obj, wd->box); > @@ -927,7 +845,7 @@ > { > ELM_CHECK_WIDTYPE(obj, widtype) NULL; > Widget_Data *wd; > - if (part && strcmp(part, "default")) return NULL; > + if ((part) && (strcmp(part, "default"))) return NULL; > wd = elm_widget_data_get(obj); > if (!wd) return NULL; > return wd->content; > @@ -939,19 +857,18 @@ > Widget_Data *wd; > Elm_Ctxpopup_Item *ctxpopup_it; > > - if (part && strcmp(part, "default")) return; > + if ((part) && (strcmp(part, "default"))) return; > > ctxpopup_it = (Elm_Ctxpopup_Item *)it; > > wd = elm_widget_data_get(WIDGET(ctxpopup_it)); > if (!wd) return; > > - _item_label_set(ctxpopup_it, label); > + elm_object_item_part_text_set(ctxpopup_it->list_item, "default", > label); > wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; > > if (wd->visible) > { > - _scroller_size_reset(wd); > _sizing_eval(WIDGET(ctxpopup_it)); > } > } > @@ -962,7 +879,7 @@ > Elm_Ctxpopup_Item *ctxpopup_it; > if (part && strcmp(part, "default")) return NULL; > ctxpopup_it = (Elm_Ctxpopup_Item *)it; > - return ctxpopup_it->label; > + return elm_object_item_part_text_get(ctxpopup_it->list_item, > "default"); > } > > static void > @@ -973,19 +890,24 @@ > Widget_Data *wd; > Elm_Ctxpopup_Item *ctxpopup_it; > > - if (part && strcmp(part, "icon")) return; > + if ((part) && (strcmp(part, "icon")) > + && (strcmp(part, "start")) > + && (strcmp(part, "end"))) return; > > ctxpopup_it = (Elm_Ctxpopup_Item *)it; > > wd = elm_widget_data_get(WIDGET(ctxpopup_it)); > if (!wd) return; > > - _item_icon_set(ctxpopup_it, content); > + if ((part) && (!strcmp(part, "end"))) > + elm_object_item_part_content_set(ctxpopup_it->list_item, "end", > content); > + else > + elm_object_item_part_content_set(ctxpopup_it->list_item, "start", > content); > + > wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; > > if (wd->visible) > { > - _scroller_size_reset(wd); > _sizing_eval(WIDGET(ctxpopup_it)); > } > } > @@ -994,9 +916,16 @@ > _item_content_get_hook(const Elm_Object_Item *it, const char *part) > { > Elm_Ctxpopup_Item *ctxpopup_it; > - if (part && strcmp(part, "icon")) return NULL; > + > + if (part && strcmp(part, "icon") && strcmp(part, "start") > + && strcmp(part, "end")) return NULL; > + > ctxpopup_it = (Elm_Ctxpopup_Item *)it; > - return ctxpopup_it->icon; > + > + if (part && !strcmp(part, "end")) > + return elm_object_item_part_content_get(ctxpopup_it->list_item, > "end"); > + else > + return elm_object_item_part_content_get(ctxpopup_it->list_item, > "start"); > } > > static void > @@ -1008,10 +937,8 @@ > wd = elm_widget_data_get(WIDGET(ctxpopup_it)); > if (!wd) return; > > - if (elm_widget_item_disabled_get(it)) > - edje_object_signal_emit(VIEW(ctxpopup_it), "elm,state,disabled", > "elm"); > - else > - edje_object_signal_emit(VIEW(ctxpopup_it), "elm,state,enabled", > "elm"); > + elm_object_item_disabled_set(ctxpopup_it->list_item, > + > elm_widget_item_disabled_get(ctxpopup_it)); > } > > static void > @@ -1019,7 +946,7 @@ > const char *source) > { > Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *)it; > - edje_object_signal_emit(VIEW(ctxpopup_it), emission, source); > + elm_object_item_signal_emit(ctxpopup_it->list_item, emission, source); > } > > static void > @@ -1040,8 +967,15 @@ > wd = elm_widget_data_get(obj); > if (!wd) return; > > - if ((!wd->items) && (!wd->content)) return; > + if ((!wd->list) && (!wd->content)) return; > > + if (wd->list) > + { > + elm_list_go(wd->list); > + wd->visible = EINA_TRUE; > + return; > + } > + > wd->visible = EINA_TRUE; > > evas_object_show(wd->bg); > @@ -1075,9 +1009,8 @@ > evas_object_hide(wd->arrow); > evas_object_hide(wd->base); > > - _scroller_size_reset(wd); > - > wd->visible = EINA_FALSE; > + wd->list_visible = EINA_FALSE; > } > > static void > @@ -1091,35 +1024,20 @@ > } > > static void > -_scroller_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, > +_list_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, > void *event_info __UNUSED__) > { > - Widget_Data *wd; > - Evas_Coord w, h; > - > - wd = elm_widget_data_get(data); > + Widget_Data *wd = elm_widget_data_get(data); > if (!wd) return; > if (!wd->visible) return; > - if (wd->finished) return; > + if (wd->list_visible) return; > > - evas_object_geometry_get(obj, 0, 0, &w, &h); > + wd->list_visible = EINA_TRUE; > > - if (w != 0 && h != 0) > - { > - if ((w <= wd->max_sc_w) && (h <= wd->max_sc_h)) > - { > - _sizing_eval(data); > - wd->finished = EINA_TRUE; > - return; > - } > - } > - > - if (wd->max_sc_w < w) > - wd->max_sc_w = w; > - if (wd->max_sc_h < h) > - wd->max_sc_h = h; > - > - _sizing_eval(data); > + evas_object_show(wd->bg); > + evas_object_show(wd->base); > + evas_object_show(wd->arrow); > + _sizing_eval(obj); > } > > static void > @@ -1135,7 +1053,6 @@ > if (wd->visible) > evas_object_show(wd->arrow); > > - _scroller_size_reset(wd); > _sizing_eval(obj); > } > > @@ -1151,60 +1068,6 @@ > } > > static void > -_item_select_cb(void *data, Evas_Object *obj __UNUSED__, > - const char *emission __UNUSED__, const char *source > __UNUSED__) > -{ > - Elm_Ctxpopup_Item *item = data; > - > - if (!item) return; > - if (elm_widget_item_disabled_get(item)) return; > - > - if (item->func) > - item->func((void*)item->base.data, WIDGET(item), data); > -} > - > -static void > -_item_icon_set(Elm_Ctxpopup_Item *item, Evas_Object *icon) > -{ > - if (item->icon) > - evas_object_del(item->icon); > - > - item->icon = icon; > - if (!icon) return; > - > - edje_object_part_swallow(VIEW(item), "elm.swallow.icon", item->icon); > - edje_object_message_signal_process(VIEW(item)); > -} > - > -static void > -_item_label_set(Elm_Ctxpopup_Item *item, const char *label) > -{ > - if (!eina_stringshare_replace(&item->label, label)) > - return; > - > - edje_object_part_text_set(VIEW(item), "elm.text", label); > - edje_object_message_signal_process(VIEW(item)); > -} > - > -static void > -_item_new(Elm_Ctxpopup_Item *item, char *group_name) > -{ > - Widget_Data *wd; > - > - wd = elm_widget_data_get(WIDGET(item)); > - if (!wd) return; > - > - VIEW(item) = edje_object_add(evas_object_evas_get(wd->base)); > - edje_object_mirrored_set(VIEW(item), > elm_widget_mirrored_get(WIDGET(item))); > - _elm_theme_object_set(WIDGET(item), VIEW(item), "ctxpopup", group_name, > - elm_widget_style_get(WIDGET(item))); > - edje_object_signal_callback_add(VIEW(item), "elm,action,click", "", > - _item_select_cb, item); > - evas_object_size_hint_align_set(VIEW(item), EVAS_HINT_FILL, > EVAS_HINT_FILL); > - evas_object_show(VIEW(item)); > -} > - > -static void > _content_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, > void *event_info __UNUSED__) > { > @@ -1214,86 +1077,38 @@ > static void > _list_del(Widget_Data *wd) > { > - if (!wd->scr) return; > + if (!wd->list) return; > > - edje_object_part_unswallow(wd->base, wd->scr); > - evas_object_del(wd->scr); > - wd->scr = NULL; > + edje_object_part_unswallow(wd->base, wd->box); > + elm_box_unpack(wd->box, wd->list); > + evas_object_del(wd->list); > + wd->list = NULL; > wd->box = NULL; > } > > -static void > -_list_new(Evas_Object *obj) > -{ > - Widget_Data *wd; > - wd = elm_widget_data_get(obj); > - if (!wd) return; > - > - //scroller > - wd->scr = elm_scroller_add(obj); > - elm_object_style_set(wd->scr, "ctxpopup"); > - evas_object_size_hint_align_set(wd->scr, EVAS_HINT_FILL, > EVAS_HINT_FILL); > - evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_RESIZE, > - _scroller_resize, obj); > - edje_object_part_swallow(wd->base, "elm.swallow.content", wd->scr); > - > - //box > - wd->box = elm_box_add(obj); > - evas_object_size_hint_weight_set(wd->box, EVAS_HINT_EXPAND, > - EVAS_HINT_EXPAND); > - > - elm_object_content_set(wd->scr, wd->box); > - elm_ctxpopup_horizontal_set(obj, wd->horizontal); > -} > - > -static void > -_remove_items(Widget_Data *wd) > -{ > - Eina_List *elist; > - Elm_Ctxpopup_Item *item; > - > - if (!wd->items) return; > - > - EINA_LIST_FOREACH(wd->items, elist, item) > - { > - if (item->label) > - eina_stringshare_del(item->label); > - if (item->icon) > - evas_object_del(item->icon); > - wd->items = eina_list_remove(wd->items, item); > - elm_widget_item_free(item); > - } > - > - wd->items = NULL; > -} > - > static Eina_Bool > _item_del_pre_hook(Elm_Object_Item *it) > { > + Evas_Object *list; > Widget_Data *wd; > Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *)it; > > wd = elm_widget_data_get(WIDGET(ctxpopup_it)); > if (!wd) return EINA_FALSE; > > - if (ctxpopup_it->icon) > - evas_object_del(ctxpopup_it->icon); > - if (VIEW(ctxpopup_it)) > - evas_object_del(VIEW(ctxpopup_it)); > - > - eina_stringshare_del(ctxpopup_it->label); > - > - wd->items = eina_list_remove(wd->items, ctxpopup_it); > - > wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; > > - if (eina_list_count(wd->items) < 1) > + list = elm_object_item_widget_get(ctxpopup_it->list_item); > + > + if (eina_list_count(elm_list_items_get(list)) < 2) > { > + elm_object_item_del(ctxpopup_it->list_item); > evas_object_hide(WIDGET(ctxpopup_it)); > return EINA_TRUE; > } > > - if (wd->visible) > + elm_object_item_del(ctxpopup_it->list_item); > + if (wd->list_visible) > _sizing_eval(WIDGET(ctxpopup_it)); > > return EINA_TRUE; > @@ -1302,14 +1117,11 @@ > static void > _disable_hook(Evas_Object *obj) > { > - Eina_List *l; > - Elm_Object_Item *it; > - > + //TODO: elm_object_disabled_set(); does not ignite this part > Widget_Data *wd = elm_widget_data_get(obj); > if (!wd) return; > > - EINA_LIST_FOREACH(wd->items, l, it) > - elm_object_item_disabled_set(it, elm_widget_disabled_get(obj)); > + elm_object_disabled_set(wd->list, elm_widget_disabled_get(obj)); > } > > static void > @@ -1470,7 +1282,6 @@ > Widget_Data *wd = elm_widget_data_get(obj); > if (!wd) return; > > - _remove_items(wd); > _list_del(wd); > wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; > } > @@ -1487,18 +1298,16 @@ > > wd->horizontal = !!horizontal; > > - if ((!wd->scr) && (!wd->box)) > + if ((!wd->list)) > return; > > if (!horizontal) > { > - elm_box_horizontal_set(wd->box, EINA_FALSE); > - elm_scroller_bounce_set(wd->scr, EINA_FALSE, EINA_TRUE); > + elm_list_horizontal_set(wd->list, wd->horizontal); > } > else > { > - elm_box_horizontal_set(wd->box, EINA_TRUE); > - elm_scroller_bounce_set(wd->scr, EINA_TRUE, EINA_FALSE); > + elm_list_horizontal_set(wd->list, wd->horizontal); > } > > wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; > @@ -1528,7 +1337,6 @@ > ELM_CHECK_WIDTYPE(obj, widtype) NULL; > > Widget_Data *wd; > - Evas_Object *content; > Elm_Ctxpopup_Item *item; > > wd = elm_widget_data_get(obj); > @@ -1545,34 +1353,22 @@ > elm_widget_item_content_get_hook_set(item, _item_content_get_hook); > elm_widget_item_signal_emit_hook_set(item, _item_signal_emit_hook); > > - //The first item is appended. > - content = elm_object_content_unset(obj); > - if (content) evas_object_del(content); > + if (!wd->list) > + { > + //The first item is appended. > + wd->list = elm_list_add(obj); > + elm_list_mode_set(wd->list, ELM_LIST_EXPAND); > + elm_list_horizontal_set(wd->list, wd->horizontal); > + evas_object_event_callback_add(wd->list, EVAS_CALLBACK_RESIZE, > + _list_resize, obj); > + _content_set_hook(obj, "default", wd->list); > + } > > - if (!wd->items) > - _list_new(obj); > + item->list_item = elm_list_item_append(wd->list, label, icon, NULL, > func, data); > > - item->func = func; > - item->base.data = data; > - > - if (icon && label) > - _item_new(item, "icon_text_style_item"); > - else if (label) > - _item_new(item, "text_style_item"); > - else > - _item_new(item, "icon_style_item"); > - > - _item_icon_set(item, icon); > - _item_label_set(item, label); > - elm_box_pack_end(wd->box, VIEW(item)); > - wd->items = eina_list_append(wd->items, item); > wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; > > - if (wd->visible) > - { > - _scroller_size_reset(wd); > - _sizing_eval(obj); > - } > + if (wd->visible) _sizing_eval(obj); > > return (Elm_Object_Item *)item; > } > > > > ------------------------------------------------------------------------------ > This SF email is sponsosred by: > Try Windows Azure free for 90 days Click Here > http://p.sf.net/sfu/sfd2d-msazure > _______________________________________________ > enlightenment-svn mailing list > enlightenment-...@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn > -- Gustavo Lima Chaves Senior Developer ProFUSION embedded systems http://profusion.mobi ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel