From: Bruno Dilly Date: Tue, 9 Nov 2010 20:26:22 +0000 (+0000) Subject: Fix flippicker item selection X-Git-Tag: v1.0.0~3828 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c0001442337e3db8320855798ab7b7ab2e20a275;p=platform%2Fupstream%2Felementary.git Fix flippicker item selection SVN revision: 54376 --- diff --git a/src/bin/test_flippicker.c b/src/bin/test_flippicker.c index a0a51ad..d1b9f04 100644 --- a/src/bin/test_flippicker.c +++ b/src/bin/test_flippicker.c @@ -14,11 +14,13 @@ _sel_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) } void -_first_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_third_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { Elm_Flippicker_Item *it; Evas_Object *fp = data; it = elm_flippicker_first_item_get(fp); + it = elm_flippicker_item_next(it); + it = elm_flippicker_item_next(it); elm_flippicker_item_selected_set(it); } @@ -88,8 +90,8 @@ test_flippicker(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_ evas_object_show(fp); bt = elm_button_add(win); - elm_button_label_set(bt, "Select 1990"); - evas_object_smart_callback_add(bt, "clicked", _first_cb, fp); + elm_button_label_set(bt, "Select 1992"); + evas_object_smart_callback_add(bt, "clicked", _third_cb, fp); elm_box_pack_end(bx, bt); evas_object_show(bt); diff --git a/src/lib/elm_flippicker.c b/src/lib/elm_flippicker.c index 40df2c0..4538dde 100644 --- a/src/lib/elm_flippicker.c +++ b/src/lib/elm_flippicker.c @@ -389,9 +389,20 @@ _changed(Widget_Data *wd) } static void -_flip_up(Widget_Data *wd) +_send_msg(Widget_Data *wd, int flipside, char *label) { Edje_Message_String msg; + + msg.str = label; + edje_object_message_send(wd->base, EDJE_MESSAGE_STRING, flipside, &msg); + edje_object_message_signal_process(wd->base); + + _changed(wd); +} + +static void +_flip_up(Widget_Data *wd) +{ Elm_Flippicker_Item *item; if (!wd->current) @@ -409,12 +420,7 @@ _flip_up(Widget_Data *wd) if (!item) return; - msg.str = (char *)item->label; - edje_object_message_send(wd->base, EDJE_MESSAGE_STRING, MSG_FLIP_UP, &msg); - edje_object_message_signal_process(wd->base); - - _changed(wd); - return; + _send_msg(wd, MSG_FLIP_UP, (char *)item->label); } static Eina_Bool @@ -461,7 +467,6 @@ _signal_val_up_start(void *data, Evas_Object *obj __UNUSED__, const char *emissi static void _flip_down(Widget_Data *wd) { - Edje_Message_String msg; Elm_Flippicker_Item *item; if (!wd->current) @@ -478,13 +483,7 @@ _flip_down(Widget_Data *wd) if (!item) return; - msg.str = (char *)item->label; - - edje_object_message_send(wd->base, EDJE_MESSAGE_STRING, MSG_FLIP_DOWN, &msg); - edje_object_message_signal_process(wd->base); - - _changed(wd); - return; + _send_msg(wd, MSG_FLIP_DOWN, (char *)item->label); } static Eina_Bool @@ -864,7 +863,8 @@ elm_flippicker_item_selected_set(Elm_Flippicker_Item *item) { ELM_FLIPPICKER_ITEM_CHECK_DELETED_RETURN(item); - Elm_Flippicker_Item *_item; + Elm_Flippicker_Item *_item, *cur; + int flipside = MSG_FLIP_UP; Widget_Data *wd; Eina_List *l; @@ -872,14 +872,21 @@ elm_flippicker_item_selected_set(Elm_Flippicker_Item *item) if (!wd) return; + cur = DATA_GET(wd->current); + if (cur == item) + return; + _flippicker_walk(wd); EINA_LIST_FOREACH(wd->items, l, _item) { + if (_item == cur) + flipside = MSG_FLIP_DOWN; + if (_item == item) { wd->current = l; - _update_view(item->base.widget); + _send_msg(wd, flipside, (char *)item->label); break; } }