label: Reset sd->lastw as '-1' in some elm_label APIs for ensure the sizing_eval.

Summary:
In some cases, elm_label doesn't calculate its min size if it is not resized from outside.
It is happened when only elm_label used with elm_label_line_wrap_set API.
The following APIs can change min size of the widget, so we can't skip the sizing_eval func.

elm_label_line_wrap_set
elm_label_line_width_set
elm_object_text_set -> _elm_label_elm_layout_text_set will be called.

@fix

Test Plan:
I put a change to test_notify.c for test.
elementary_test notify
-> click "top" button. -> You can't see elm_label without the patch.

Reviewers: woohyun, tasn, seoz

Reviewed By: seoz

Subscribers: herdsman

Differential Revision: https://phab.enlightenment.org/D1652
This commit is contained in:
Youngbok Shin 2014-11-10 14:06:32 +09:00 committed by Daniel Juyung Seo
parent 34375b9113
commit 40bc9198aa
2 changed files with 6 additions and 2 deletions

View File

@ -61,7 +61,9 @@ test_notify(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
evas_object_show(bx);
lb = elm_label_add(win);
elm_object_text_set(lb, "This position is the default.");
elm_label_line_wrap_set(lb, ELM_WRAP_MIXED);
elm_label_wrap_width_set(lb, ELM_SCALE_SIZE(140));
elm_object_text_set(lb, "This position is the default. This is multiline text.");
elm_box_pack_end(bx, lb);
evas_object_show(lb);

View File

@ -330,7 +330,7 @@ _elm_label_elm_layout_text_set(Eo *obj, Elm_Label_Data *sd, const char *part, co
eo_do_super(obj, MY_CLASS, int_ret = elm_obj_layout_text_set(part, label));
if (int_ret)
{
sd->lastw = 0;
sd->lastw = -1;
eo_do(obj, elm_obj_layout_sizing_eval());
}
return int_ret;
@ -453,6 +453,7 @@ _elm_label_line_wrap_set(Eo *obj, Elm_Label_Data *sd, Elm_Wrap_Type wrap)
if (_stringshare_key_value_replace(&sd->format, "wrap", wrap_str, 0) == 0)
{
sd->lastw = -1;
_label_format_set(wd->resize_obj, sd->format);
elm_layout_sizing_eval(obj);
}
@ -476,6 +477,7 @@ _elm_label_wrap_width_set(Eo *obj, Elm_Label_Data *sd, Evas_Coord w)
if (sd->ellipsis)
_label_format_set(wd->resize_obj, sd->format);
sd->wrap_w = w;
sd->lastw = -1;
elm_layout_sizing_eval(obj);
}