label: Reset sd->lastw as '-1' in some elm_label APIs for ensure the sizing_eval.
authorYoungbok Shin <youngb.shin@samsung.com>
Mon, 10 Nov 2014 05:06:32 +0000 (14:06 +0900)
committerDaniel Juyung Seo <seojuyung2@gmail.com>
Mon, 10 Nov 2014 05:06:32 +0000 (14:06 +0900)
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

src/bin/test_notify.c
src/lib/elm_label.c

index 03bf890a2fe9ba71291405d79b3a7405ebb50044..f5ae7cb08c11131b9133124b3bcbc7ca77008828 100644 (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);
 
index 24c6474ddfd199ba588ee2a98c21d598760a95be..505b717702d13044868cba4414c07c4b80c2e9f7 100644 (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);
 }