spinner: entry text makes to registered special value instead of number.

Summary:
Entry has only number text when activated and value changed, Even user registered special value to each spinner value.
If the user registered special value, we should check then showing the special value instead of number text.
Its will more helpful to expect the result when user set a spinner value using spinner entry.

@fix

Test Plan:
There is a spinner sample in elementary_test.
Changing editable value as TRUE for the last spinner object.
Click the spinner to activated entry and check the result.

Reviewers: Hermet, Jaehyun, cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2844

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
woochan lee 2015-07-29 22:17:34 +02:00 committed by Cedric BAIL
parent 5efa4831de
commit fcce7736d8
1 changed files with 12 additions and 0 deletions

View File

@ -53,8 +53,18 @@ static void _access_increment_decrement_info_say(Evas_Object *obj,
static void
_entry_show(Elm_Spinner_Data *sd)
{
Eina_List *l;
Elm_Spinner_Special_Value *sv;
char buf[32], fmt[32] = "%0.f";
EINA_LIST_FOREACH(sd->special_values, l, sv)
{
if (sv->value == sd->val)
{
snprintf(buf, sizeof(buf), "%s", sv->label);
goto apply;
}
}
/* try to construct just the format from given label
* completely ignoring pre/post words
*/
@ -91,6 +101,8 @@ _entry_show(Elm_Spinner_Data *sd)
}
}
snprintf(buf, sizeof(buf), fmt, sd->val);
apply:
elm_object_text_set(sd->ent, buf);
}